CGCTG/semantic-highlight-fr-annotations
Viewer • Updated • 76.2k • 27
How to use CGCTG/semantic-highlight-en-fr-v1 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="CGCTG/semantic-highlight-en-fr-v1") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("CGCTG/semantic-highlight-en-fr-v1", dtype="auto")Modele bilingue anglais-francais de Semantic Highlight pour les systemes RAG. Identifie les phrases pertinentes dans les documents recuperes afin de reduire le contexte transmis au LLM.
BAAI/bge-reranker-v2-m3 (XLM-RoBERTa, 568M params)[SENT] aux frontieres de phrasesFormat : Open Provence avec 3 splits (train, validation, test).
from inference import SemanticHighlighter
highlighter = SemanticHighlighter(
model_path="CGCTG/semantic-highlight-en-fr-v1",
threshold=0.5,
device="auto",
)
result = highlighter.highlight(
query="Quelles sont les causes du rechauffement climatique ?",
passage="Le rechauffement climatique est cause par les emissions de CO2. "
"La deforestation aggrave le probleme. "
"Les temperatures moyennes ont augmente de 1.1 C.",
)
for sent in result.highlighted_sentences:
print(f" [{sent.score:.3f}] {sent.text}")
print(f"Compression : {result.compression_ratio:.1%}")
Entraine avec Accelerate sur GPU A100 80 GB. Loss unifiee : FocalBCE (pruning) + MSE (distillation reranking BGE-M3).
| Parametre | Valeur |
|---|---|
| Batch effectif | 32 |
| Learning rate | 2e-5 |
| Epochs | 3 |
| Max sequence length | 8192 |
| Warmup ratio | 5% |