Spaces:
Runtime error
Runtime error
Update backend.py
Browse files- backend.py +3 -3
backend.py
CHANGED
@@ -3,10 +3,10 @@ from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
|
3 |
from peft import PeftModel, PeftConfig
|
4 |
|
5 |
# Load model and tokenizer only once at startup
|
6 |
-
config = PeftConfig.from_pretrained("rabindra-sss/sentiment-distilbert
|
7 |
base_model = AutoModelForSequenceClassification.from_pretrained("distilbert-base-uncased")
|
8 |
-
model = PeftModel.from_pretrained(base_model, "rabindra-sss/sentiment-distilbert
|
9 |
-
tokenizer = AutoTokenizer.from_pretrained("rabindra-sss/sentiment-distilbert
|
10 |
|
11 |
# Ensure model is in evaluation mode for inference
|
12 |
model.eval()
|
|
|
3 |
from peft import PeftModel, PeftConfig
|
4 |
|
5 |
# Load model and tokenizer only once at startup
|
6 |
+
config = PeftConfig.from_pretrained("rabindra-sss/sentiment-distilbert")
|
7 |
base_model = AutoModelForSequenceClassification.from_pretrained("distilbert-base-uncased")
|
8 |
+
model = PeftModel.from_pretrained(base_model, "rabindra-sss/sentiment-distilbert", config=config)
|
9 |
+
tokenizer = AutoTokenizer.from_pretrained("rabindra-sss/sentiment-distilbert")
|
10 |
|
11 |
# Ensure model is in evaluation mode for inference
|
12 |
model.eval()
|