Instructions to use HiTZ/mt5-counter-narrative-eu with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HiTZ/mt5-counter-narrative-eu with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HiTZ/mt5-counter-narrative-eu")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("HiTZ/mt5-counter-narrative-eu") model = AutoModelForSeq2SeqLM.from_pretrained("HiTZ/mt5-counter-narrative-eu") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use HiTZ/mt5-counter-narrative-eu with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HiTZ/mt5-counter-narrative-eu" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HiTZ/mt5-counter-narrative-eu", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/HiTZ/mt5-counter-narrative-eu
- SGLang
How to use HiTZ/mt5-counter-narrative-eu with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "HiTZ/mt5-counter-narrative-eu" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HiTZ/mt5-counter-narrative-eu", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "HiTZ/mt5-counter-narrative-eu" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HiTZ/mt5-counter-narrative-eu", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use HiTZ/mt5-counter-narrative-eu with Docker Model Runner:
docker model run hf.co/HiTZ/mt5-counter-narrative-eu
YAML Metadata Warning:The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
Content Warning: This card may contain examples of offensive language that do not reflect the authors’ views
Model Card for mT5-counternarrative-es
This is a fine-tuned text-to-text mT5-base model to generate counternarratives against hate speech in Basque. The model has been fine-tuned on the Basque splits of the CONAN-EUS dataset.
CONAN-EUS was created by professionally translating all 6654 English HS-CN pairs of the original CONAN dataset into Basque and Spanish. For experimentation we generated train, validation and test splits in a way that no HS-CN pairs occurred across them.
| CONAN-EUS Splits | Total HS-CN Count |
|---|---|
| train | 4833 |
| validation | 537 |
| test | 1278 |
- 📖 Paper: Basque and Spanish Counter Narrative Generation: Data Creation and Evaluation In LREC-COLING 2024.
- 💻 Github Repo (Data and Code): https://github.com/ixa-ehu/conan-e/
HS-CN example
The CONAN dataset includes HS-CN pairs, regarding the topic of Muslims and Islam. An example of a HS-CN pair in Basque, Spanish and English is illustrated below:
| HS | CN |
|---|---|
| Musulmanok ez dugu gure kultura aberastu dezakeen ezer erabilgarririk. | Zer egin dute guretzat musulmanek? Beno, kafea, erlojuak, kamerak, higienea, unibertsitateak, tresna kirurgikoak, mapak, musika, aljebra. |
| Los musulmanes no tienen nada útil que pueda enriquecer nuestra cultura. | ¿Qué han hecho los musulmanes por nosotros? Bueno, café, relojes, cámaras, higiene, universidades, instrumentos quirúrgicos, mapas, música, álgebra. |
| Muslims do not have anything useful that can enrich our culture. | What have Muslims ever done for us? Well, Coffee, Clocks, Cameras, Hygiene, Universities, Surgical Instruments, Maps, Music, Algebra. |
If you use the model please cite the following paper:
Citation
@inproceedings{bengoetxea-et-al-2024,
title={{B}asque and {S}panish {C}ounter {N}arrative {G}eneration: {D}ata {C}reation and {E}valuation},
author={Jaione Bengoetxea and Yi-Ling Chung and Marco Guerini and Rodrigo Agerri},
year={2024},
publisher = "Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING)",
}
Contact: Rodrigo Agerri HiTZ Center - Ixa, University of the Basque Country UPV/EHU
- Downloads last month
- 8