|
|
--- |
|
|
library_name: transformers |
|
|
license: apache-2.0 |
|
|
language: |
|
|
- fr |
|
|
base_model: |
|
|
- bigscience/mt0-xxl |
|
|
--- |
|
|
|
|
|
# Model Card for Model ID |
|
|
|
|
|
<!-- Provide a quick summary of what the model is/does. --> |
|
|
This is the model ranked first in the [TextMine 2025 competition](https://www.kaggle.com/competitions/defi-text-mine-2025). |
|
|
|
|
|
## Model Details |
|
|
|
|
|
### Model Description |
|
|
|
|
|
<!-- Provide a longer summary of what this model is. --> |
|
|
This model processes a prompt that decribes a candidate relation between two entities in a French intelligence report, and predicts wether this relation exists in the given text by simply outputting yer or no. |
|
|
|
|
|
- **Developed by:** Adrien Guille, Université Lumière Lyon 2 |
|
|
- **Language:** French |
|
|
- **License:** Apache 2.0 |
|
|
- **Finetuned from model:** [bigscience/mt0-xxl](https://huggingface.co/bigscience/mt0-xxl) |
|
|
|
|
|
|
|
|
## How to Get Started with the Model |
|
|
|
|
|
Use the code below to get started with the model. |
|
|
|
|
|
```python |
|
|
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM |
|
|
import torch |
|
|
|
|
|
model = AutoModelForSeq2SeqLM.from_pretrained( |
|
|
"AdrienGuille/TextMine2025", |
|
|
torch_dtype=torch.bfloat16, # requires a compatible GPU, otherwise should be set to torch.float16 |
|
|
return_dict=True, |
|
|
device_map="auto" |
|
|
) |
|
|
tokenizer = AutoTokenizer.from_pretrained("bigscience/mt0-xxl") |
|
|
|
|
|
# format the prompt according to the following template |
|
|
prompt = """Does the relation (head_entity: [Constance Dupuis], relation_type: is_in_contact_with}, |
|
|
tail_entity: [Airîle, compagnie aérienne]), exists in the following text: "L’avion NY8 de la |
|
|
compagnie Airîle a lancé sa dernière position via le signal radio avant de se crasher dans une forêt |
|
|
en Malaisie le 19 février 2003. La compagnie aérienne a alerté les secours pour évacuer les |
|
|
passagers. Les hélicoptères d’urgence ont retrouvé l’appareil en feu. Les autorités malaisiennes ont |
|
|
recensé 15 morts au total. Cet incident n’a fait que peu de survivants, dont Constance Dupuis, |
|
|
présidente de l’association « des médicaments pour tous » en Grèce. D’après son témoignage, le |
|
|
NY8 a connu une défaillance technique que les pilotes n’ont pas pu contrôler. Les corps ont été |
|
|
transportés par brancard à la morgue."?""" |
|
|
|
|
|
# do not do sample for generation |
|
|
input_ids = tokenizer(prompt, return_tensors="pt").to("cuda") |
|
|
output_ids = model.generate(**input_ids, num_beams=1, do_sample=False, max_new_tokens=4) |
|
|
|
|
|
# output should be either yer or no |
|
|
answer = tokenizer.decode(output_ids[0], skip_special_tokens=True) |
|
|
prediction = "yes" in answer.lower() |
|
|
``` |
|
|
|
|
|
|
|
|
## Citation |
|
|
|
|
|
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. --> |
|
|
|
|
|
**BibTeX:** |
|
|
|
|
|
``` |
|
|
@inproceedings{guille_textmine_2025, |
|
|
title={Adaptation d’un modèle de langue encodeur-décodeur pour l'extraction de relations dans des rapports de renseignement.}, |
|
|
author={Guille, Adrien}, |
|
|
booktitle={Actes de l'atelier TextMine 2025}, |
|
|
pages={5-7}, |
|
|
year={2025}} |
|
|
``` |
|
|
|
|
|
|
|
|
**APA:** |
|
|
``` |
|
|
Guille, A. (2025). Adaptation d’un modèle de langue encodeur-décodeur pour l'extraction de relations dans des rapports de renseignement. Actes de l'atelier TextMine 2025. 5-7. |
|
|
``` |