Spaces:
Running
Running
Update convert.py
Browse files- convert.py +3 -6
convert.py
CHANGED
|
@@ -275,10 +275,8 @@ def convert(
|
|
| 275 |
pr_title = "Adding `safetensors` variant of this model"
|
| 276 |
info = api.model_info(model_id, revision=revision)
|
| 277 |
filenames = set(s.rfilename for s in info.siblings)
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
except:
|
| 281 |
-
discard_names = []
|
| 282 |
|
| 283 |
with TemporaryDirectory() as d:
|
| 284 |
folder = os.path.join(d, repo_folder_name(repo_id=model_id, repo_type="models"))
|
|
@@ -287,9 +285,8 @@ def convert(
|
|
| 287 |
try:
|
| 288 |
operations = None
|
| 289 |
pr = previous_pr(api, model_id, pr_title, revision=revision)
|
| 290 |
-
|
| 291 |
-
|
| 292 |
library_name = getattr(info, "library_name", None)
|
|
|
|
| 293 |
if any(filename.endswith(".safetensors") for filename in filenames) and not force:
|
| 294 |
raise AlreadyExists(f"Model {model_id} is already converted, skipping..")
|
| 295 |
elif pr is not None and not force:
|
|
|
|
| 275 |
pr_title = "Adding `safetensors` variant of this model"
|
| 276 |
info = api.model_info(model_id, revision=revision)
|
| 277 |
filenames = set(s.rfilename for s in info.siblings)
|
| 278 |
+
# Exception handling already happen inside this function
|
| 279 |
+
discard_names = get_discard_names(model_id, revision=revision, folder=folder, token=api.token)
|
|
|
|
|
|
|
| 280 |
|
| 281 |
with TemporaryDirectory() as d:
|
| 282 |
folder = os.path.join(d, repo_folder_name(repo_id=model_id, repo_type="models"))
|
|
|
|
| 285 |
try:
|
| 286 |
operations = None
|
| 287 |
pr = previous_pr(api, model_id, pr_title, revision=revision)
|
|
|
|
|
|
|
| 288 |
library_name = getattr(info, "library_name", None)
|
| 289 |
+
|
| 290 |
if any(filename.endswith(".safetensors") for filename in filenames) and not force:
|
| 291 |
raise AlreadyExists(f"Model {model_id} is already converted, skipping..")
|
| 292 |
elif pr is not None and not force:
|