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-base")
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[{'label': 'LABEL_1', 'score': 0.5048992037773132}]| Epoch | Training Loss | Validation Loss | Accuracy | F1 | Precision | Recall | AUC |
|---|---|---|---|---|---|---|---|
| 1.0 | 0.68 | 0.66 | 0.59 | 0.63 | 0.56 | 0.73 | 0.59 |
| 2.0 | 0.60 | 0.68 | 0.63 | 0.69 | 0.59 | 0.83 | 0.63 |
| 3.0 | 0.52 | 0.67 | 0.64 | 0.66 | 0.62 | 0.72 | 0.65 |