Answer questions in French using CamemBERT fine-tuned on PIAFv1.1, FQuADv1.0, and SQuAD-FR datasets. Achieves ~80% F1 score on French Q&A tasks.
A specialized skill for answering questions in French using the CamemBERT model fine-tuned on three French Q&A datasets: PIAFv1.1, FQuADv1.0, and SQuAD-FR.
**Model ID**: `etalab-ia/camembert-base-squadFR-fquad-piaf`
This model is based on CamemBERT-base and has been fine-tuned on a combination of:
**Performance**:
When the user requests French question answering capabilities:
1. **Install Dependencies**
```bash
pip install transformers torch
```
2. **Load the Model**
Create a question-answering pipeline using the HuggingFace transformers library:
```python
from transformers import pipeline
nlp = pipeline(
'question-answering',
model='etalab-ia/camembert-base-squadFR-fquad-piaf',
tokenizer='etalab-ia/camembert-base-squadFR-fquad-piaf'
)
```
3. **Answer Questions**
Use the pipeline with a question and context:
```python
result = nlp({
'question': "Qui est Claude Monet?",
'context': "Claude Monet, né le 14 novembre 1840 à Paris et mort le 5 décembre 1926 à Giverny, est un peintre français et l'un des fondateurs de l'impressionnisme."
})
print(result)
```
4. **Process Results**
The model returns:
- `answer`: The extracted answer text
- `score`: Confidence score (0-1)
- `start`: Character position where answer starts
- `end`: Character position where answer ends
5. **Best Practices**
- Provide sufficient context (at least a few sentences)
- Keep context under 384 tokens for optimal performance
- Questions should be specific and answerable from the context
- The model works best with factual questions
- Ensure both question and context are in French
```python
from transformers import pipeline
qa_model = pipeline(
'question-answering',
model='etalab-ia/camembert-base-squadFR-fquad-piaf',
tokenizer='etalab-ia/camembert-base-squadFR-fquad-piaf'
)
context1 = """
Etalab est une administration publique française qui fait notamment office de
Chief Data Officer de l'État et coordonne la conception et la mise en œuvre de
sa stratégie dans le domaine de la donnée. Ainsi, Etalab développe et maintient
le portail des données ouvertes du gouvernement français data.gouv.fr.
"""
answer1 = qa_model({
'question': "Comment s'appelle le portail open data du gouvernement ?",
'context': context1
})
print(f"Answer: {answer1['answer']}, Score: {answer1['score']:.3f}")
context2 = """
Claude Monet, né le 14 novembre 1840 à Paris et mort le 5 décembre 1926 à
Giverny, est un peintre français et l'un des fondateurs de l'impressionnisme.
"""
answer2 = qa_model({
'question': "Qui est Claude Monet?",
'context': context2
})
print(f"Answer: {answer2['answer']}, Score: {answer2['score']:.3f}")
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/french-question-answering-with-camembert/raw