Text Classification
Transformers
Safetensors
PyTorch
Bulgarian
English
xlm-roberta
sentiment-analysis,
roberta
bulgaria
custom_code
text-embeddings-inference
Instructions to use AleksandarDimitrov06/bg-ecommerce-sentiment-roberta with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AleksandarDimitrov06/bg-ecommerce-sentiment-roberta with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="AleksandarDimitrov06/bg-ecommerce-sentiment-roberta", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("AleksandarDimitrov06/bg-ecommerce-sentiment-roberta", trust_remote_code=True) model = AutoModelForSequenceClassification.from_pretrained("AleksandarDimitrov06/bg-ecommerce-sentiment-roberta", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
RoBERTa Base Sentiment BG - Fine-tuned
This model is a fine-tuned version of rmihaylov/roberta-base-sentiment-bg for binary sentiment analysis (Positive/Negative). It has been trained on custom review data to classify text sentiment in Bulgarian and English.
Model Description
- Developed by: Aleksandar Dimitrov
- Language(s): Bulgarian (bg), English (en)
- Model Type: Text Classification (Sentiment Analysis)
- Base Model: rmihaylov/roberta-base-sentiment-bg
- License: MIT
Как да използвате модела (How to Use)
Можете да използвате модела директно с библиотеката transformers в Python. Ето пример как да заредите модела и да направите предсказание:
You can use this model directly with the transformers library in Python. Here is a script to load the model and run inference:
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
model_id = "AleksandarDimitrov06/bg-ecommerce-sentiment-roberta"
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id).to(device)
model.eval()
def predict_sentiment(text: str):
with torch.no_grad():
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True).to(device)
outputs = model(**inputs)
probabilities = torch.softmax(outputs.logits, dim=1).tolist()[0]
# 0: NEGATIVE, 1: POSITIVE
if probabilities[1] >= probabilities[0]:
return "POSITIVE", probabilities[1]
return "NEGATIVE", probabilities[0]
# Тест / Test
text = "Този продукт е страхотен и работи перфектно!"
label, confidence = predict_sentiment(text)
print(f"Резултат: {label} ({confidence:.2%})")
- Downloads last month
- 5
Model tree for AleksandarDimitrov06/bg-ecommerce-sentiment-roberta
Base model
rmihaylov/roberta-base-sentiment-bg