Update convert.py
Browse files- convert.py +17 -0
convert.py
CHANGED
|
@@ -16,6 +16,22 @@ from transformers import AutoConfig
|
|
| 16 |
from transformers.pipelines.base import infer_framework_load_model
|
| 17 |
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
class AlreadyExists(Exception):
|
| 20 |
pass
|
| 21 |
|
|
@@ -253,6 +269,7 @@ def convert(api: "HfApi", model_id: str, force: bool = False) -> Optional["Commi
|
|
| 253 |
repo_id=model_id,
|
| 254 |
operations=operations,
|
| 255 |
commit_message=pr_title,
|
|
|
|
| 256 |
create_pr=True,
|
| 257 |
)
|
| 258 |
print(f"Pr created at {new_pr.pr_url}")
|
|
|
|
| 16 |
from transformers.pipelines.base import infer_framework_load_model
|
| 17 |
|
| 18 |
|
| 19 |
+
COMMIT_DESCRIPTION = """
|
| 20 |
+
This is an automated PR create with https://huggingface.co/spaces/safetensors/convert
|
| 21 |
+
|
| 22 |
+
This new file is equivalent to `pytorch_model.bin` but safe in the sense that
|
| 23 |
+
no arbitrary code can be put into it.
|
| 24 |
+
|
| 25 |
+
These files also happen to load much faster than their pytorch counterpart:
|
| 26 |
+
https://colab.research.google.com/github/huggingface/notebooks/blob/main/safetensors_doc/en/speed.ipynb
|
| 27 |
+
|
| 28 |
+
The widgets on your model page will run using this model even if this is not merged
|
| 29 |
+
making sure the file actually works.
|
| 30 |
+
|
| 31 |
+
Feel free to ignore this PR.
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
|
| 35 |
class AlreadyExists(Exception):
|
| 36 |
pass
|
| 37 |
|
|
|
|
| 269 |
repo_id=model_id,
|
| 270 |
operations=operations,
|
| 271 |
commit_message=pr_title,
|
| 272 |
+
commit_description=COMMIT_DESCRIPTION
|
| 273 |
create_pr=True,
|
| 274 |
)
|
| 275 |
print(f"Pr created at {new_pr.pr_url}")
|