Spaces:
Runtime error
Runtime error
Deploy SafeChat ML service to Hugging Face Space
Browse files- app/models/toxicity_classifier.py +2 -1
- requirements.txt +1 -0
app/models/toxicity_classifier.py
CHANGED
|
@@ -423,7 +423,8 @@ class ToxicityClassifier:
|
|
| 423 |
"""Load MuRIL model into memory."""
|
| 424 |
logger.info(f"Loading tokenizer and model ({self._model_name}) on {self.device}...")
|
| 425 |
try:
|
| 426 |
-
|
|
|
|
| 427 |
self.model = AutoModelForSequenceClassification.from_pretrained(
|
| 428 |
self._model_name,
|
| 429 |
num_labels=len(LABELS),
|
|
|
|
| 423 |
"""Load MuRIL model into memory."""
|
| 424 |
logger.info(f"Loading tokenizer and model ({self._model_name}) on {self.device}...")
|
| 425 |
try:
|
| 426 |
+
# MuRIL can require protobuf-backed slow tokenizer loading in lean container environments.
|
| 427 |
+
self.tokenizer = AutoTokenizer.from_pretrained(self._model_name, use_fast=False)
|
| 428 |
self.model = AutoModelForSequenceClassification.from_pretrained(
|
| 429 |
self._model_name,
|
| 430 |
num_labels=len(LABELS),
|
requirements.txt
CHANGED
|
@@ -8,6 +8,7 @@ transformers>=4.36.0
|
|
| 8 |
tokenizers>=0.15.0
|
| 9 |
accelerate>=0.25.0
|
| 10 |
sentencepiece>=0.1.99
|
|
|
|
| 11 |
|
| 12 |
# --- FastAPI ---
|
| 13 |
fastapi>=0.109.0
|
|
|
|
| 8 |
tokenizers>=0.15.0
|
| 9 |
accelerate>=0.25.0
|
| 10 |
sentencepiece>=0.1.99
|
| 11 |
+
protobuf>=4.25.3
|
| 12 |
|
| 13 |
# --- FastAPI ---
|
| 14 |
fastapi>=0.109.0
|