astromis/presuicidal_signals
Viewer • Updated • 32.6k • 24 • 1
How to use astromis/presuisidal_rubert with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="astromis/presuisidal_rubert") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("astromis/presuisidal_rubert")
model = AutoModelForSequenceClassification.from_pretrained("astromis/presuisidal_rubert")The fine-tuned ruBert on the presuicidal dataset. Aims to help the psychologists to find text with useful information about person's suicide behavior.
The model has two categories:
import torch
tokenizer = AutoTokenizer.from_pretrained("astromis/presuisidal_rubert")
model = BertForSequenceClassification.from_pretrained("astromis/presuisidal_rubert")
model.eval()
text = ["мне так плохо я хочу умереть", "вчера была на сходке с друзьями было оч клево"]
tokenized_text = tokenizer(text, padding="max_length", truncation=True, max_length=512, return_tensors="pt")
with torch.no_grad():
prediction = model(**tokenized_text).logits
print(prediction.argmax(dim=1).numpy())
# >>> [1, 0]
Before training, the text was transformed in the next way:
<emoji>emoja_name</emoji>;As the dataset is heavily imbalanced, the train part of normal texts was randomly downsampled to have only 22% samples out of source volume.
The training was done with 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 |
@article {Buyanov2022TheDF,
title={The dataset for presuicidal signals detection in text and its analysis},
author={Igor Buyanov and Ilya Sochenkov},
journal={Computational Linguistics and Intellectual Technologies},
year={2022},
month={June},
number={21},
pages={81--92},
url={https://api.semanticscholar.org/CorpusID:253195162},
}