]> khamidou — GitHub mirrors - safetensors.git/commitdiff
Small qol. (#101)
authorNicolas Patry <patry.nicolas@protonmail.com>
Tue, 22 Nov 2022 15:07:47 +0000 (16:07 +0100)
committerGitHub <noreply@github.com>
Tue, 22 Nov 2022 15:07:47 +0000 (16:07 +0100)
bindings/python/convert.py

index 1c461c9172c39b4ad71783c089449d345061554a..dcd79f6244704f537ec76d548508a0d93e72928b 100644 (file)
@@ -231,17 +231,20 @@ def convert(api: "HfApi", model_id: str, force: bool = False) -> Optional["Commi
                     operations = convert_multi(model_id, folder)
                 else:
                     raise RuntimeError(f"Model {model_id} doesn't seem to be a valid pytorch model. Cannot convert")
+                check_final_model(model_id, folder)
             else:
                 operations = convert_generic(model_id, folder, filenames)
 
             if operations:
-                check_final_model(model_id, folder)
-                # new_pr = api.create_commit(
-                #     repo_id=model_id,
-                #     operations=operations,
-                #     commit_message=pr_title,
-                #     create_pr=True,
-                # )
+                new_pr = api.create_commit(
+                    repo_id=model_id,
+                    operations=operations,
+                    commit_message=pr_title,
+                    create_pr=True,
+                )
+                print(f"Pr created at {new_pr.pr_url}")
+            else:
+                print("No files to convert")
         finally:
             shutil.rmtree(folder)
         return new_pr