ebrukilic commited on
Commit
d549dbe
1 Parent(s): 9784ae3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +11 -6
README.md CHANGED
@@ -67,22 +67,27 @@ model = AutoModelForSequenceClassification.from_pretrained(model_name)
67
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
68
  model.to(device)
69
  model.eval()
 
70
 
 
71
  # Test örneği
72
- text = "Bu film harikaydı!"
73
- inputs = tokenizer(text, return_tensors="pt", truncation=True, padding='max_length', max_length=128)
74
- inputs = {key: value.to(device) for key, value in inputs.items()}
 
 
75
 
76
- # Model tahmini
77
  with torch.no_grad():
78
  outputs = model(**inputs)
79
 
80
  logits = outputs.logits
81
  predicted_class_id = torch.argmax(logits, dim=-1).item()
82
 
83
- # Etiketleri belirleme
84
  id_to_label = {0: "negatif", 1: "nötr", 2: "pozitif"}
85
- print(f"Predicted sentiment: {id_to_label[predicted_class_id]}")
 
86
  ```
87
 
88
  ## Training Details
 
67
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
68
  model.to(device)
69
  model.eval()
70
+ ```
71
 
72
+ ```python
73
  # Test örneği
74
+ text = "Ürün çok güzel ama kolları kısa ve çok dar"
75
+ aspect = "Beden"
76
+
77
+ # Tokenize etme
78
+ inputs = tokenizer(aspect, text, truncation=True, padding='max_length', max_length=128, return_tensors="pt").to(device)
79
 
80
+ # Model ile tahmin yapma
81
  with torch.no_grad():
82
  outputs = model(**inputs)
83
 
84
  logits = outputs.logits
85
  predicted_class_id = torch.argmax(logits, dim=-1).item()
86
 
87
+ # Tahmin edilen etiketin açıklaması
88
  id_to_label = {0: "negatif", 1: "nötr", 2: "pozitif"}
89
+ predicted_label = id_to_label[predicted_class_id]
90
+ print(f"Tahmin edilen etiket: {predicted_label}")
91
  ```
92
 
93
  ## Training Details