Views
No views yet
1import torch
2
3tokenizer = AutoTokenizer.from_pretrained("astromis/presuisidal_rubert")
4model = BertForSequenceClassification.from_pretrained("astromis/presuisidal_rubert")
5model.eval()
6
7text = ["мне так плохо я хочу умереть", "вчера была на сходке с друзьями было оч клево"]
8
9tokenized_text = tokenizer(text, padding="max_length", truncation=True, max_length=512, return_tensors="pt")
10
11with torch.no_grad():
12prediction = model(**tokenized_text).logits
13print(prediction.argmax(dim=1).numpy())
14# >>> [1, 0]<emoji>emoja_name</emoji>;Trainier class that have next parameters:TrainingArguments(evaluation_strategy="epoch",
per_device_train_batch_size=16,
per_device_eval_batch_size=32,
learning_rate=1e-5,
num_train_epochs=5,
weight_decay=1e-3,
load_best_model_at_end=True,
save_strategy="epoch")| F1-micro | F1-macro | F1-weighted |
|---|---|---|
| 0.811926 | 0.726722 | 0.831000 |
1@article {Buyanov2022TheDF,
2title={The dataset for presuicidal signals detection in text and its analysis},
3author={Igor Buyanov and Ilya Sochenkov},
4journal={Computational Linguistics and Intellectual Technologies},
5year={2022},
6month={June},
7number={21},
8pages={81--92},
9url={https://api.semanticscholar.org/CorpusID:253195162},
10}