Views
No views yet
| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 |
|---|---|---|---|---|---|
| 0.3669 | 1.0 | 20313 | 0.3651 | 0.8484 | 0.8436 |
| 0.3343 | 2.0 | 40626 | 0.3645 | 0.8485 | 0.8495 |
| 0.3133 | 3.0 | 60939 | 0.3689 | 0.8497 | 0.8481 |
| 0.2815 | 4.0 | 81252 | 0.3773 | 0.8506 | 0.8492 |
| Metric | Value |
|---|---|
| eval_loss | 0.36449944972991943 |
| eval_accuracy | 0.84846 |
| eval_f1 | 0.8494926642060322 |
| eval_runtime | 169.6017 |
| eval_samples_per_second | 294.808 |
| eval_steps_per_second | 4.611 |
| epoch | 4.0 |
1from transformers import pipeline
2model_path = "FinchW/my-yelp-sentiment-model-finetuned"
3tokenizer_path = "distilbert/distilbert-base-uncased"
4id2label = {
5 0: "NEGATIVE",
6 1: "NEUTRAL",
7 2: "POSITIVE",
8}
9label2id = {
10 "NEGATIVE": 0,
11 "NEUTRAL": 1,
12 "POSITIVE": 2
13}
14tokenizer = AutoTokenizer.from_pretrained(tokenizer_path)
15model = AutoModelForSequenceClassification.from_pretrained(model_path, num_labels=3, id2label=id2label, label2id=label2id)
16
17pipe = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer, truncation=True)
18#pass single string
19print("Single String:")
20display(pipe("My food was disgusting!"))
21#pass list of strings
22print("List of Strings:")
23display(pipe(["My food was amazing", "my food was sub-par", "gross"]))