Downloads · 30 days
8
1% of all-time downloads
alex2awesome/stance-detection-t5
stance-detection-t5 is a machine learning model from alex2awesome. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
Stance detection model distilled from a news dataset label by a larger model. The larger model was trained on a combination of stance datasets in the literature:
Downloads · 30 days
8
1% of all-time downloads
All-time downloads
767
Public
Parameters
223M
892 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors892 MB · 99%
From the Hugging Face model README
Stance detection model distilled from a news dataset label by a larger model. The larger model was trained on a combination of stance datasets in the literature:
FNC-1 (Pomerleau and Rao, 2017), Perspectrum (Chen et al., 2019), ARC (Habernal et al., 2017), Emergent (Ferreira and Vlachos, 2016) NewsClaims (Reddy et al., 2021)7.
Achieves a .0.5712643678160919 f1-score on hand labeled indomain news data
To run:
from transformers import AutoTokenizer, T5ForConditionalGeneration
model = T5ForConditionalGeneration.from_pretrained('alex2awesome/stance-detection-t5')
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
tokenizer_with_prefix_space = AutoTokenizer.from_pretrained(model_name_or_path, add_prefix_space=True)
def get_tokens_as_tuple(word):
return tuple(tokenizer_with_prefix_space([word], add_special_tokens=False).input_ids[0])
input_ids = tokenizer(text, return_tensors="pt").input_ids
y_pred_gen_output = model.generate(
input_ids,
renormalize_logits=True,
sequence_bias= {
get_tokens_as_tuple('__Affirm__'): 0.143841,
get_tokens_as_tuple('__Discuss__'): -0.294732,
get_tokens_as_tuple('__Neutral__'): -0.103820,
get_tokens_as_tuple('__Refute__'): 0.637734,
},
)
You can tweak the class weights yourself if you want.