Spaces:
Running
Running
Fix naming scheme (#38)
Browse files- Fix naming scheme (b0f308b2b54a495ab8f8ade9fbf8a7949dc0f1a3)
Co-authored-by: Anthony <[email protected]>
app.py
CHANGED
@@ -108,12 +108,13 @@ def process_model(model_id, q_method, oauth_token: gr.OAuthToken | None):
|
|
108 |
model_name = model_id.split('/')[-1]
|
109 |
username = whoami(oauth_token.token)["name"]
|
110 |
try:
|
111 |
-
|
|
|
112 |
print(upload_repo)
|
113 |
with tempfile.TemporaryDirectory(dir="converted") as tmpdir:
|
114 |
# The target dir must not exist
|
115 |
mlx_path = os.path.join(tmpdir, "mlx")
|
116 |
-
convert(model_id, mlx_path=mlx_path, quantize=True, q_bits=
|
117 |
print("Conversion done")
|
118 |
upload_to_hub(path=mlx_path, upload_repo=upload_repo, hf_path=model_id, oauth_token=oauth_token)
|
119 |
print("Upload done")
|
@@ -173,4 +174,4 @@ scheduler.add_job(restart_space, "interval", seconds=21600)
|
|
173 |
scheduler.start()
|
174 |
|
175 |
# Launch the interface
|
176 |
-
demo.queue(default_concurrency_limit=1, max_size=5).launch(debug=True, show_api=False)
|
|
|
108 |
model_name = model_id.split('/')[-1]
|
109 |
username = whoami(oauth_token.token)["name"]
|
110 |
try:
|
111 |
+
q_bits = QUANT_PARAMS[q_method]
|
112 |
+
upload_repo = f"{username}/{model_name}-{q_bits}bit"
|
113 |
print(upload_repo)
|
114 |
with tempfile.TemporaryDirectory(dir="converted") as tmpdir:
|
115 |
# The target dir must not exist
|
116 |
mlx_path = os.path.join(tmpdir, "mlx")
|
117 |
+
convert(model_id, mlx_path=mlx_path, quantize=True, q_bits=q_bits)
|
118 |
print("Conversion done")
|
119 |
upload_to_hub(path=mlx_path, upload_repo=upload_repo, hf_path=model_id, oauth_token=oauth_token)
|
120 |
print("Upload done")
|
|
|
174 |
scheduler.start()
|
175 |
|
176 |
# Launch the interface
|
177 |
+
demo.queue(default_concurrency_limit=1, max_size=5).launch(debug=True, show_api=False)
|