Spaces:
Running
on
A10G
Running
on
A10G
Add an option to put all quantization variants in the same repo
#120
by
A2va
- opened
app.py
CHANGED
@@ -87,7 +87,7 @@ def split_upload_model(model_path, repo_id, oauth_token: gr.OAuthToken | None, s
|
|
87 |
|
88 |
print("Sharded model has been uploaded successfully!")
|
89 |
|
90 |
-
def process_model(model_id, q_method, use_imatrix, imatrix_q_method, private_repo, train_data_file, split_model, split_max_tensors, split_max_size, oauth_token: gr.OAuthToken | None):
|
91 |
if oauth_token.token is None:
|
92 |
raise ValueError("You must be logged in to use GGUF-my-repo")
|
93 |
model_name = model_id.split('/')[-1]
|
@@ -156,7 +156,10 @@ def process_model(model_id, q_method, use_imatrix, imatrix_q_method, private_rep
|
|
156 |
print(f"Quantized model path: {quantized_gguf_path}")
|
157 |
|
158 |
# Create empty repo
|
159 |
-
|
|
|
|
|
|
|
160 |
new_repo_id = new_repo_url.repo_id
|
161 |
print("Repo created successfully!", new_repo_url)
|
162 |
|
@@ -305,6 +308,12 @@ with gr.Blocks(css=css) as demo:
|
|
305 |
info="Create a private repo under your username."
|
306 |
)
|
307 |
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
train_data_file = gr.File(
|
309 |
label="Training Data File",
|
310 |
file_types=["txt"],
|
@@ -347,6 +356,7 @@ with gr.Blocks(css=css) as demo:
|
|
347 |
use_imatrix,
|
348 |
imatrix_q_method,
|
349 |
private_repo,
|
|
|
350 |
train_data_file,
|
351 |
split_model,
|
352 |
split_max_tensors,
|
|
|
87 |
|
88 |
print("Sharded model has been uploaded successfully!")
|
89 |
|
90 |
+
def process_model(model_id, q_method, use_imatrix, imatrix_q_method, private_repo, same_repo, train_data_file, split_model, split_max_tensors, split_max_size, oauth_token: gr.OAuthToken | None):
|
91 |
if oauth_token.token is None:
|
92 |
raise ValueError("You must be logged in to use GGUF-my-repo")
|
93 |
model_name = model_id.split('/')[-1]
|
|
|
156 |
print(f"Quantized model path: {quantized_gguf_path}")
|
157 |
|
158 |
# Create empty repo
|
159 |
+
q_suffix = imatrix_q_method if use_imatrix else q_method
|
160 |
+
repo_name = f"{username}/{model_name}-GGUF" if same_repo else f"{username}/{model_name}-{q_suffix}-GGUF"
|
161 |
+
|
162 |
+
new_repo_url = api.create_repo(repo_id=repo_name, exist_ok=True, private=private_repo)
|
163 |
new_repo_id = new_repo_url.repo_id
|
164 |
print("Repo created successfully!", new_repo_url)
|
165 |
|
|
|
308 |
info="Create a private repo under your username."
|
309 |
)
|
310 |
|
311 |
+
same_repo = gr.Checkbox(
|
312 |
+
value=False,
|
313 |
+
label="Same Repo",
|
314 |
+
info="Put all quantization variants in the same repo."
|
315 |
+
)
|
316 |
+
|
317 |
train_data_file = gr.File(
|
318 |
label="Training Data File",
|
319 |
file_types=["txt"],
|
|
|
356 |
use_imatrix,
|
357 |
imatrix_q_method,
|
358 |
private_repo,
|
359 |
+
same_repo,
|
360 |
train_data_file,
|
361 |
split_model,
|
362 |
split_max_tensors,
|