Remove the function to rename model files, as it's not needed anymore on Transformers.js v3
Browse files
app.py
CHANGED
|
@@ -113,24 +113,11 @@ class ModelConverter:
|
|
| 113 |
if result.returncode != 0:
|
| 114 |
return False, result.stderr
|
| 115 |
|
| 116 |
-
self._rename_model_files(input_model_id)
|
| 117 |
return True, result.stderr
|
| 118 |
|
| 119 |
except Exception as e:
|
| 120 |
return False, str(e)
|
| 121 |
|
| 122 |
-
def _rename_model_files(self, input_model_id: str) -> None:
|
| 123 |
-
"""Rename the converted model files."""
|
| 124 |
-
model_path = self.config.repo_path / "models" / input_model_id / "onnx"
|
| 125 |
-
|
| 126 |
-
renames = [
|
| 127 |
-
("model.onnx", "decoder_model_merged.onnx"),
|
| 128 |
-
("model_quantized.onnx", "decoder_model_merged_quantized.onnx"),
|
| 129 |
-
]
|
| 130 |
-
|
| 131 |
-
for old_name, new_name in renames:
|
| 132 |
-
(model_path / old_name).rename(model_path / new_name)
|
| 133 |
-
|
| 134 |
def upload_model(self, input_model_id: str, output_model_id: str) -> Optional[str]:
|
| 135 |
"""Upload the converted model to Hugging Face."""
|
| 136 |
try:
|
|
|
|
| 113 |
if result.returncode != 0:
|
| 114 |
return False, result.stderr
|
| 115 |
|
|
|
|
| 116 |
return True, result.stderr
|
| 117 |
|
| 118 |
except Exception as e:
|
| 119 |
return False, str(e)
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
def upload_model(self, input_model_id: str, output_model_id: str) -> Optional[str]:
|
| 122 |
"""Upload the converted model to Hugging Face."""
|
| 123 |
try:
|