Upload model_runtime.py with huggingface_hub
Browse files- model_runtime.py +4 -0
model_runtime.py
CHANGED
|
@@ -87,6 +87,10 @@ class SequenceClassifierHead:
|
|
| 87 |
def model(self):
|
| 88 |
if self._model is None:
|
| 89 |
weights_dir = self._require_local_weights()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
self._model = AutoModelForSequenceClassification.from_pretrained(str(weights_dir))
|
| 91 |
self._model.eval()
|
| 92 |
return self._model
|
|
|
|
| 87 |
def model(self):
|
| 88 |
if self._model is None:
|
| 89 |
weights_dir = self._require_local_weights()
|
| 90 |
+
alt = weights_dir / "iab_weights.safetensors"
|
| 91 |
+
canonical = weights_dir / "model.safetensors"
|
| 92 |
+
if alt.exists() and not canonical.exists():
|
| 93 |
+
os.symlink(str(alt), str(canonical))
|
| 94 |
self._model = AutoModelForSequenceClassification.from_pretrained(str(weights_dir))
|
| 95 |
self._model.eval()
|
| 96 |
return self._model
|