Views
No views yet
cardiffnlp/twitter-xlm-roberta-base-sentiment with one addition: a prebuilt tokenizer.json.sentencepiece.bpe.model) and no tokenizer.json. On transformers v5, loading the tokenizer forces an on-the-fly SentencePiece → fast conversion, which currently fails for XLM-RoBERTa and raises:ValueError: Error parsing line b'\x0e' in .../sentencepiece.bpe.modelAttributeError: 'NoneType' object has no attribute 'endswith' from the tekken.json conversion branch).tokenizer.json generated with transformers 4.44.2, so v5 loads the tokenizer directly and never runs the broken conversion. The tokenizer is verified to produce identical token ids to the original slow tokenizer.1from transformers import pipeline
2
3clf = pipeline(
4 task="sentiment-analysis",
5 model="NetworkIsLife/twitter-xlm-roberta-base-sentiment-fast",
6 tokenizer="NetworkIsLife/twitter-xlm-roberta-base-sentiment-fast",
7)
8clf("T'estimo!")
9# [{'label': 'Positive', 'score': 0.66...}]1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2
3repo = "NetworkIsLife/twitter-xlm-roberta-base-sentiment-fast"
4tok = AutoTokenizer.from_pretrained(repo)
5mdl = AutoModelForSequenceClassification.from_pretrained(repo)| id | label |
|---|---|
| 0 | Negative |
| 1 | Neutral |
| 2 | Positive |
1@inproceedings{barbieri-etal-2022-xlm,
2 title = "{XLM}-{T}: Multilingual Language Models in {T}witter for Sentiment Analysis and Beyond",
3 author = "Barbieri, Francesco and Espinosa Anke, Luis and Camacho-Collados, Jose",
4 booktitle = "Proceedings of the Thirteenth Language Resources and Evaluation Conference",
5 year = "2022",
6 address = "Marseille, France",
7 publisher = "European Language Resources Association",
8 url = "https://aclanthology.org/2022.lrec-1.27",
9 pages = "258--266",
10}cardiffnlp/twitter-xlm-roberta-base-sentiment. Set the license: field in the frontmatter above to match it before relying on this repo.