Run this model with HF Jobs
Run IlyaGusev/xlm_roberta_large_headline_cause_simple on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/IlyaGusev/xlm_roberta_large_headline_cause_simple. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/IlyaGusev/xlm_roberta_large_headline_cause_simple on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use IlyaGusev/xlm_roberta_large_headline_cause_simple with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IlyaGusev/xlm_roberta_large_headline_cause_simple with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="IlyaGusev/xlm_roberta_large_headline_cause_simple")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("IlyaGusev/xlm_roberta_large_headline_cause_simple") model = AutoModelForSequenceClassification.from_pretrained("IlyaGusev/xlm_roberta_large_headline_cause_simple", device_map="auto") - Notebooks
- Google Colab
- Kaggle
XLM-RoBERTa HeadlineCause Simple
Model description
This model was trained to predict the presence of causal relations between two headlines. This model is for the Simple task with 3 possible labels: A causes B, B causes A, no causal relation. English and Russian languages are supported.
You can use hosted inference API to infer a label for a headline pair. To do this, you shoud seperate headlines with </s> token.
For example:
Песков опроверг свой перевод на удаленку</s>Дмитрий Песков перешел на удаленку
Intended uses & limitations
How to use
from tqdm.notebook import tqdm
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
def get_batch(data, batch_size):
start_index = 0
while start_index < len(data):
end_index = start_index + batch_size
batch = data[start_index:end_index]
yield batch
start_index = end_index
def pipe_predict(data, pipe, batch_size=64):
raw_preds = []
for batch in tqdm(get_batch(data, batch_size)):
raw_preds += pipe(batch)
return raw_preds
MODEL_NAME = TOKENIZER_NAME = "IlyaGusev/xlm_roberta_large_headline_cause_simple"
tokenizer = AutoTokenizer.from_pretrained(TOKENIZER_NAME, do_lower_case=False)
model = AutoModelForSequenceClassification.from_pretrained(MODEL_NAME)
model.eval()
pipe = pipeline("text-classification", model=model, tokenizer=tokenizer, framework="pt", return_all_scores=True)
texts = [
(
"Judge issues order to allow indoor worship in NC churches",
"Some local churches resume indoor services after judge lifted NC governor’s restriction"
),
(
"Gov. Kevin Stitt defends $2 million purchase of malaria drug touted by Trump",
"Oklahoma spent $2 million on malaria drug touted by Trump"
),
(
"Песков опроверг свой перевод на удаленку",
"Дмитрий Песков перешел на удаленку"
)
]
pipe_predict(texts, pipe)
Limitations and bias
The models are intended to be used on news headlines. No other limitations are known.
Training data
- HuggingFace dataset: IlyaGusev/headline_cause
- GitHub: IlyaGusev/HeadlineCause
Training procedure
- Notebook: HeadlineCause
- Stand-alone script: train.py
Eval results
Evaluation results can be found in the arxiv paper.
BibTeX entry and citation info
@misc{gusev2021headlinecause,
title={HeadlineCause: A Dataset of News Headlines for Detecting Causalities},
author={Ilya Gusev and Alexey Tikhonov},
year={2021},
eprint={2108.12626},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
- Downloads last month
- 58