Views
No views yet
1>>> from transformers import DistilBertTokenizerFast, AutoTokenizer
2>>> tokenizer = AutoTokenizer.from_pretrained('distilbert-base-uncased')
3>>> from transformers import DistilBertForSequenceClassification
4>>> model = DistilBertForSequenceClassification.from_pretrained(r"distilbert-depression-mixed")
5>>> from transformers import pipeline
6>>> classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
7>>> tokenizer_kwargs = {'padding':True,'truncation':True,'max_length':512}
8>>> result=classifier('pain peko',**tokenizer_kwargs) #For truncation to apply in the pipeline
9>>> #Should note that the string passed as the input can be a corpus of tweets concatenated together into one document.
10
11
12[{'label': 'LABEL_1', 'score': 0.5048992037773132}]| Epoch | Training Loss | Validation Loss | Accuracy | F1 | Precision | Recall | AUC |
|---|---|---|---|---|---|---|---|
| 1.0 | 0.68 | 0.66 | 0.61 | 0.54 | 0.60 | 0.50 | 0.60 |
| 2.0 | 0.65 | 0.65 | 0.63 | 0.49 | 0.70 | 0.37 | 0.62 |
| 3.0 | 0.53 | 0.63 | 0.66 | 0.58 | 0.69 | 0.50 | 0.65 |
| 4.0 | 0.39 | 0.66 | 0.67 | 0.61 | 0.69 | 0.54 | 0.67 |
| 5.0 | 0.27 | 0.72 | 0.65 | 0.61 | 0.63 | 0.60 | 0.64 |