Spaces:
Running
Running
Fail early if model requires `trust_remote_code`
Browse filesSo we don't have to download the model only to fail during conversion.
cc
@reach-vb
@awni
app.py
CHANGED
|
@@ -15,6 +15,7 @@ from gradio_huggingfacehub_search import HuggingfaceHubSearch
|
|
| 15 |
from apscheduler.schedulers.background import BackgroundScheduler
|
| 16 |
|
| 17 |
from textwrap import dedent
|
|
|
|
| 18 |
|
| 19 |
import mlx_lm
|
| 20 |
from mlx_lm import convert
|
|
@@ -108,6 +109,9 @@ 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 |
if q_method == "FP16":
|
| 112 |
upload_repo = f"{username}/{model_name}-mlx-fp16"
|
| 113 |
with tempfile.TemporaryDirectory(dir="converted") as tmpdir:
|
|
|
|
| 15 |
from apscheduler.schedulers.background import BackgroundScheduler
|
| 16 |
|
| 17 |
from textwrap import dedent
|
| 18 |
+
from transformers import AutoConfig
|
| 19 |
|
| 20 |
import mlx_lm
|
| 21 |
from mlx_lm import convert
|
|
|
|
| 109 |
model_name = model_id.split('/')[-1]
|
| 110 |
username = whoami(oauth_token.token)["name"]
|
| 111 |
try:
|
| 112 |
+
# Fail early if the model requires custom code
|
| 113 |
+
_ = AutoConfig.from_pretrained(model_id)
|
| 114 |
+
|
| 115 |
if q_method == "FP16":
|
| 116 |
upload_repo = f"{username}/{model_name}-mlx-fp16"
|
| 117 |
with tempfile.TemporaryDirectory(dir="converted") as tmpdir:
|