adjusted imput processing for rubert model
Browse files
app_models/rubert_MODEL.py
CHANGED
|
@@ -17,7 +17,7 @@ logreg_model = joblib.load(logreg_model_path)
|
|
| 17 |
|
| 18 |
def embed_bert_cls(text, model, tokenizer):
|
| 19 |
"""Generate embeddings for input text using the RuBERT model."""
|
| 20 |
-
inputs = tokenizer(text, padding=
|
| 21 |
with torch.no_grad():
|
| 22 |
outputs = model(**inputs)
|
| 23 |
embeddings = outputs.last_hidden_state[:, 0, :]
|
|
|
|
| 17 |
|
| 18 |
def embed_bert_cls(text, model, tokenizer):
|
| 19 |
"""Generate embeddings for input text using the RuBERT model."""
|
| 20 |
+
inputs = tokenizer(text, padding="max_length", truncation=True, max_length=128, return_tensors="pt")
|
| 21 |
with torch.no_grad():
|
| 22 |
outputs = model(**inputs)
|
| 23 |
embeddings = outputs.last_hidden_state[:, 0, :]
|