Instructions to use niamaelkhbir/qwen2.5-7b-parhaf-v1-synth-v2-xml-en-roles with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use niamaelkhbir/qwen2.5-7b-parhaf-v1-synth-v2-xml-en-roles with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen2.5-7B-Instruct") model = PeftModel.from_pretrained(base_model, "niamaelkhbir/qwen2.5-7b-parhaf-v1-synth-v2-xml-en-roles") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Desktop
qwen2.5-7b-parhaf-v1-synth-v2-xml-en-roles
LoRA adapter on unsloth/Qwen2.5-7B-Instruct for French clinical NER / de-identification (PARHAF schema), with role qualifiers on person/location/contact entities.
Trained on PARHAF_v1 (cleaned gold) + synthetic_v2 (FAMILY_STATUS re-annotated with marital status and kin/household mentions).
Intended use
- Extract PARHAF entity types from French clinical reports (XML tagging).
- Predict roles (
Patient,Carer,Hospital,Other) when applicable. - Research / benchmarking of clinical de-identification — not a medical device.
Training data
| Split | Source | Docs |
|---|---|---|
| Train | PARHAF_v1 + synth_v2 | 504 |
| Dev (eval) | PARHAF_v1 | 101 |
- PARHAF_v1: manually reviewed annotations (titles, ages-as-dates, FAMILY_STATUS, PSI, dates, CITY, etc.).
- synth_v2: same synthetic CRH corpus as v1, with
FAMILY_STATUSre-labeled via Mistral to include kin (spouse, parents, children, …), aligned with the PARHAF_v1 definition.
Training setup
| Hyperparameter | Value |
|---|---|
| Base model | unsloth/Qwen2.5-7B-Instruct |
| Method | LoRA (Unsloth / TRL SFT), r=16, alpha=16 |
| Format | XML, English system prompt |
| Roles | yes (--with-roles) |
| Entity types | full (PARHAF ∪ AP-HP overlap, incl. FAMILY_STATUS) |
| Context | chunks 1500 chars, overlap 300 |
| Epochs | 3 |
| Max seq length | 4096 |
ft_config.json:
{
"with_roles": true,
"format": "xml",
"prompt_lang": "en",
"schema": "parhaf",
"entity_types": "full",
"context_mode": "chunk",
"chunk_size": 1500,
"overlap": 300
}
Evaluation (PARHAF_v1 /dev, offset, post-filtered)
| Metric | F1 |
|---|---|
| Entity (with label) | 0.881 |
| Entity (without label) | 0.882 |
| Char BIO (with label) | 0.924 |
| Role end-to-end | 0.971 |
| Role on matched entity spans | 0.999 |
Selected per-label entity F1: FIRST_NAME 0.995, LAST_NAME 0.958, IDENTIFYING_DATE 0.940, FAMILY_STATUS 0.622, PATIENT_SOCIAL_IDENTITY 0.629.
Cross-eval on AP-HP (aphp2 test) not included in this card yet.
Entity labels
FIRST_NAME, LAST_NAME, IDENTIFYING_DATE, PATIENT_BIRTHDATE, PATIENT_SOCIAL_IDENTITY, FAMILY_STATUS, CITY, COUNTRY, ADDRESS, ZIP, MAIL, CODEIDENTIFIANT, PHONE_NUMBER, PATIENT_NATIONALITY, UNIDENTIFYING_DATE, URL (+ AP-HP overlap extras when present in mix).
FAMILY_STATUS covers marital status and identifying kin/household mentions (spouse, parents, children, siblings, etc.).
Load
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = "unsloth/Qwen2.5-7B-Instruct"
adapter = "niamaelkhbir/qwen2.5-7b-parhaf-v1-synth-v2-xml-en-roles" # after push
tok = AutoTokenizer.from_pretrained(adapter)
model = AutoModelForCausalLM.from_pretrained(base, device_map="auto", torch_dtype="auto")
model = PeftModel.from_pretrained(model, adapter)
Related adapters
niamaelkhbir/qwen2.5-7b-parhaf-v1-xml-en— PARHAF_v1 only (no synth, no roles)niamaelkhbir/qwen2.5-7b-parhaf-xml-en-chunk— earlier PARHAF (pre-cleanup)
Framework versions
- PEFT 0.19.1
- TRL 0.24.0
- Transformers 5.5.0
- PyTorch 2.10.0
- Unsloth
Citation
If you use this adapter, please cite the PARHAF / CU1 clinical NER work and:
@misc{vonwerra2022trl,
title = {{TRL: Transformer Reinforcement Learning}},
author = {Leandro von Werra and others},
year = 2020,
howpublished = {\\url{https://github.com/huggingface/trl}}
}
- Downloads last month
- 20