Model Card for Model ID
Modelin Tanıtımı
Aspect-Based Sentiment Analysis (ABSA) için ince ayar yapılmış bir GPT-2 modelidir. Model, giyim ürünlerine ait "aspectler" hakkında yapılan yorumların duygu analizini gerçekleştirmek için eğitilmiştir.
Temel Alınan Model: [openai-community/gpt2]
Eğitildiği Veri Kümesi: [ebrukilic/ytu-araproje-absa-7400]
Duygu Sınıfları: negatif: 0, nötr: 1, pozitif: 2
Dil: Türkçe
Developed by: [ebru kılıç]
Language(s) (NLP): Turkish
Sentiment Classes: negative: 0, neutral: 1, positive: 2
Finetuned from model [optional]: [openai-community/gpt2]
Modeli Nasıl Kullanabiliriz?
from transformers import GPT2Tokenizer, GPT2ForSequenceClassification
import torch
model_name = "ebrukilic/absa-gpt-2"
tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
tokenizer.pad_token = tokenizer.eos_token
model = GPT2ForSequenceClassification.from_pretrained(model_name)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
def predict_sentiment(text, aspect, model, tokenizer):
inputs = tokenizer.encode_plus(
text=f"{aspect} hakkında: {text}",
add_special_tokens=True,
max_length=128,
padding="max_length",
truncation=True,
return_attention_mask=True,
return_tensors="pt"
)
input_ids = inputs["input_ids"].to(device)
attention_mask = inputs["attention_mask"].to(device)
with torch.no_grad():
outputs = model(input_ids, attention_mask=attention_mask)
predicted_class = torch.argmax(outputs.logits, dim=1).item()
return predicted_class
new_text = "Ürünün kumaşı çok güzel, bayıldım!"
aspect = "kumaş"
predicted_sentiment = predict_sentiment(new_text, aspect, model, tokenizer)
print("Yorum:", new_text)
print("Aspect:", aspect)
print("Tahmin Edilen Duygu:", predicted_sentiment)
- Downloads last month
- 28
Inference Providers
NEW
This model is not currently available via any of the supported third-party Inference Providers, and
the model is not deployed on the HF Inference API.
Model tree for ebrukilic/absa-gpt-2
Base model
openai-community/gpt2