Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,13 @@ import spaces
|
|
5 |
|
6 |
@spaces.GPU
|
7 |
|
|
|
|
|
|
|
|
|
8 |
def merge_and_upload(weight_drop_prob, scaling_factor, repo_name, token, base_model, model_to_merge):
|
9 |
# Define a fixed output path
|
10 |
-
output_path = "/
|
11 |
|
12 |
# Write the base model and model to merge to the repo.txt file
|
13 |
with open("repo.txt", "w") as repo:
|
@@ -61,5 +65,30 @@ iface = gr.Interface(
|
|
61 |
description="Merge two models using the Super Mario merge method and upload to Hugging Face Hub."
|
62 |
)
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
# Launch the interface
|
65 |
iface.launch()
|
|
|
5 |
|
6 |
@spaces.GPU
|
7 |
|
8 |
+
def write_repo(base_model, model_to_merge):
|
9 |
+
with open("repo.txt", "w") as repo:
|
10 |
+
repo.write(base_model + "\n" + model_to_merge)
|
11 |
+
|
12 |
def merge_and_upload(weight_drop_prob, scaling_factor, repo_name, token, base_model, model_to_merge):
|
13 |
# Define a fixed output path
|
14 |
+
output_path = "/tmp/output"
|
15 |
|
16 |
# Write the base model and model to merge to the repo.txt file
|
17 |
with open("repo.txt", "w") as repo:
|
|
|
65 |
description="Merge two models using the Super Mario merge method and upload to Hugging Face Hub."
|
66 |
)
|
67 |
|
68 |
+
# Add a tutorial to the Gradio UI
|
69 |
+
tutorial = """
|
70 |
+
***Combine capabilities from multiple models.***
|
71 |
+
|
72 |
+
Works with:
|
73 |
+
|
74 |
+
Stable Diffusion (1.5, XL/XL Turbo)
|
75 |
+
LLMs(Mistral, Llama, etc)
|
76 |
+
LoRas(must be same size)
|
77 |
+
Any two homologous models
|
78 |
+
|
79 |
+
|
80 |
+
**What are the -p and -lambda flags?**
|
81 |
+
|
82 |
+
* -p: Weight drop probability (a value between 0 and 1)
|
83 |
+
* -lambda: Scaling factor (a value that determines the magnitude of the weight updates)
|
84 |
+
|
85 |
+
**Credit**
|
86 |
+
|
87 |
+
This model merger and uploader is based on the work of https://github.com/martyn/safetensors-merge-supermario. Thank you for your contribution to the community!
|
88 |
+
"""
|
89 |
+
|
90 |
+
# Add the tutorial to the Gradio UI
|
91 |
+
iface.append(gr.HTML(tutorial))
|
92 |
+
|
93 |
# Launch the interface
|
94 |
iface.launch()
|