初始化项目,由ModelHub XC社区提供模型

Model: FrenchCastle/sexology-v4
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-08-21 05:51:17 +08:00
commit 50676c4b9b
12 changed files with 91856 additions and 0 deletions

273
README.md Normal file
View File

@@ -0,0 +1,273 @@
---
# For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
# Doc / guide: https://huggingface.co/docs/hub/model-cards
license: apache-2.0
language:
- fr
library_name: transformers
pipeline_tag: text-generation
base_model: mistralai/Mistral-7B-Instruct-v0.3
tags:
- sexual-health
- sexology
- sante-sexuelle
- health
- medical
- public-health
- french
- conversational
- instruction-tuned
---
# Model Card for Sexo-FR
**Sexo-FR** is a French-language conversational language model that provides reliable, caring, and evidence-based **sexual health information** (information en santé sexuelle). It is part of a French public-health initiative whose goal is to make trustworthy sexual-health information more accessible to the public, in plain French, while consistently redirecting users to qualified professionals and dedicated helplines.
The model is an **informational and educational tool**. It is **not** a medical device, it does **not** provide diagnoses, and it does **not** replace consultation with a healthcare professional (doctor, midwife, sexologist, psychologist, family-planning counsellor, etc.).
## Model Details
### Model Description
Sexo-FR is an instruction-tuned causal language model specialised for the sexual-health domain in French. It was fine-tuned from a general-purpose open base model on a curated corpus of French-language question/answer and instruction data covering topics such as contraception, sexually transmitted infections (IST), consent, sexual and reproductive health, relationships, sexual well-being, and inclusive information on gender identity and sexual orientation.
The training emphasised three things: (1) **factual reliability**, with content aligned to recognised public-health and clinical guidance; (2) **a caring, non-judgemental and inclusive tone**; and (3) **safe behaviour**, including refusing to produce sexually explicit content, recognising distress or emergencies, and systematically signposting appropriate professional resources and helplines.
- **Developed by:** [French public-health body — e.g., *Santé publique France* — to confirm]
- **Funded by [optional]:** Government of France — [e.g., *Ministère de la Santé et de la Prévention* — to confirm]
- **Shared by [optional]:** [Same as above / project team — to confirm]
- **Model type:** Decoder-only (causal) transformer language model, instruction-tuned for domain-specific conversational use
- **Language(s) (NLP):** French (`fr`)
- **License:** `apache-2.0` (inherited from the base model). *Note:* documentation, prompts, and any released data may additionally be published under the French government open licence (**Licence Ouverte / Etalab 2.0**). Confirm the final licensing strategy with your legal team before release.
- **Finetuned from model [optional]:** [`mistralai/Mistral-7B-Instruct-v0.3` — confirm exact base model and revision]
### Model Sources [optional]
- **Repository:** [https://huggingface.co/your-org/sexo-fr — to add]
- **Paper [optional]:** [Link or DOI, if any — to add]
- **Demo [optional]:** [Link to the official public service / demo — to add]
## Uses
### Direct Use
Sexo-FR is intended to power a French-language assistant that answers general sexual-health questions and points people to appropriate care. Representative in-scope topics include:
- **Contraception:** available methods, emergency contraception, where and how to obtain them.
- **Sexually transmitted infections (IST):** prevention, awareness of symptoms, screening (*dépistage*), prevention tools (condoms, PrEP), and how to seek testing or treatment.
- **Consent and healthy relationships** (*consentement*): understanding consent, communication, recognising coercion or violence.
- **Sexual and reproductive health:** anatomy and physiology, pregnancy, contraception, and information about IVG (voluntary termination of pregnancy).
- **Sexual well-being and common difficulties:** general, non-clinical information about desire, pleasure, pain, or function — always with a recommendation to consult a professional for personal situations.
- **Life stages:** puberty and adolescence, menopause, and sexuality with age, disability, or chronic illness.
- **Identity and inclusion:** respectful, inclusive information regarding sexual orientation and gender identity (LGBTQ+).
- **Prevention and support:** recognising sexual violence and signposting dedicated support services.
Typical deployments: a chatbot or Q&A feature on an official public-health website, an FAQ-assistance layer, or an internal drafting aid reviewed by human experts.
### Downstream Use [optional]
The model can be further adapted for specific public-health programmes, for example:
- Fine-tuning on additional, expert-validated content for a particular campaign or audience (e.g., youth, new parents, specific clinical pathways).
- Integration into a retrieval-augmented (RAG) system grounded in an authoritative, regularly updated knowledge base so that answers cite up-to-date official sources.
- Use as an assistant for trained counsellors and helpline operators, with human review before any message is sent to a member of the public.
Any downstream use should preserve the safety behaviours described below and undergo renewed evaluation.
### Out-of-Scope Use
This model must **not** be used for:
- **Medical diagnosis, treatment decisions, prescriptions, or dosing.** It is not a medical device and provides general information only.
- **Emergency or crisis situations.** It is not designed to handle medical emergencies, acute distress, suicidal ideation, or ongoing violence/abuse. Such cases must be routed to emergency services and dedicated helplines.
- **Replacing professional care** by a doctor, midwife, sexologist, psychologist, or family-planning service.
- **Generating sexually explicit, pornographic, or arousal-oriented content.** The model is for health information and education, not erotica.
- **Unsupervised use with minors.** Deployments accessible to adolescents must align with national sexual-education standards, remain age-appropriate, and route to youth-appropriate services. The model must never be used to facilitate any sexualisation of, or harm to, minors.
- **Legal advice** (e.g., precise statutory or regulatory determinations).
- **Use outside the French language and the French health/care context** without separate validation.
- **Profiling, surveillance, or any re-identification** of users based on the sensitive content of their questions.
## Bias, Risks, and Limitations
This model operates in a **sensitive and high-stakes domain**. Incorrect, incomplete, or poorly framed information about sexual health can cause real harm. The following limitations are inherent and must be communicated to users and deployers.
**Technical limitations**
- **Hallucination and factual error.** Like all LLMs, the model can produce plausible-sounding but incorrect statements, including about medical facts. It can also reflect outdated guidance, since its knowledge is frozen at training time and recommendations evolve.
- **No source guarantees.** Unless deployed with retrieval grounding, the model cannot reliably cite or verify sources.
- **Sensitivity to phrasing.** Answers may vary with prompt wording; ambiguous questions may be misinterpreted.
- **Language scope.** The model targets standard French; it may handle regional variants, slang, mixed languages, or non-French input less reliably.
**Sociotechnical risks and biases**
- **Cultural and demographic bias.** Training data may over-represent certain perspectives and under-represent others (e.g., LGBTQ+ experiences, people with disabilities, diverse cultural or religious contexts). The model may carry heteronormative or other normative biases.
- **France-centric framing.** Guidance, services, and helplines referenced may be specific to France and not transferable elsewhere.
- **Tone and stigma.** Despite tuning for a non-judgemental tone, the model could occasionally produce content that feels stigmatising or insufficiently inclusive.
- **Privacy and sensitivity.** Users may disclose highly intimate or identifying information. Deployers are responsible for data minimisation, secure handling, and compliance with the GDPR and applicable French regulations.
- **Over-reliance.** Users may treat answers as personal medical advice. Clear, persistent disclaimers and easy routes to human help are essential.
### Recommendations
Users (both direct and downstream) should be made aware of the risks, biases, and limitations of the model. In addition:
- **Always present the model as informational, not a substitute for professional care**, with a visible disclaimer at the point of use.
- **Keep a human in the loop** for any individual situation, clinical question, or message sent to a vulnerable user.
- **Prefer retrieval-grounded deployment** against an authoritative, current knowledge base, and review content periodically against the latest official guidance.
- **Surface professional resources and helplines** prominently, and verify these contacts are current for your jurisdiction. Examples of French resources to consider signposting (please verify numbers before release):
- Emergencies: **15** (SAMU), **112** (European emergency number), **114** (emergency by SMS, for deaf/hard-of-hearing).
- Suicide prevention: **3114** (national prevention line).
- Violence against women: **3919** (*Violences Femmes Info*).
- Child protection: **119** (*Allô Enfance en Danger*).
- Youth sexual-health information: *Fil Santé Jeunes*.
- General sexual-health information: a public, official sexual-health information service (e.g., a `questionsexualite.fr`-type resource).
- HIV/IST information and support: a dedicated national IST/HIV information line.
- Family planning / contraception / IVG information services.
- **Apply content safeguards** to refuse explicit-content requests, detect distress, and escalate appropriately.
- **Re-evaluate after any fine-tuning or major integration change.**
## How to Get Started with the Model
The model uses a standard chat/instruction format. A system prompt should encode the informational-only, caring, and safety-first behaviour. Always verify the chat template of your chosen base model.
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "your-org/sexo-fr" # replace with the published repo id
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
system_prompt = (
"Tu es un assistant d'information en santé sexuelle conçu dans le cadre "
"d'une initiative de santé publique française. Tu fournis des informations "
"fiables, bienveillantes, inclusives et fondées sur des données probantes, "
"en français clair. Tu ne poses jamais de diagnostic et tu ne remplaces pas "
"un professionnel de santé. Tu ne produis aucun contenu sexuellement "
"explicite. En cas d'urgence, de détresse ou de violence, tu orientes vers "
"les services et numéros d'aide appropriés."
)
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": "Quelles sont les principales méthodes de contraception ?"},
]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt"
).to(model.device)
outputs = model.generate(
inputs,
max_new_tokens=512,
temperature=0.3,
top_p=0.9,
do_sample=True,
)
print(tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True))
```
A low temperature (e.g., 0.2–0.4) is recommended to favour factual, conservative answers in this domain.
## Training Details
### Training Procedure
#### Training Hyperparameters
The following are representative values for a parameter-efficient (LoRA/QLoRA) supervised fine-tune on L40 GPUs — **replace with your actual configuration**:
- **Training regime:** bf16 mixed precision
- **Method:** Supervised fine-tuning (SFT) with LoRA (optionally an additional preference-optimisation pass, e.g., DPO, for safety/tone)
- **LoRA config (example):** rank `r = 16`, `alpha = 32`, dropout `0.05`, applied to attention/MLP projection layers
- **Optimizer:** AdamW (paged 8-bit if using QLoRA)
- **Effective batch size (example):** `32` (per-device batch × gradient accumulation)
- **Max sequence length (example):** `2048`
## Evaluation
### Factors & Metrics
#### Factors
Evaluation should be disaggregated by, at minimum:
- **Topic** (contraception, IST, consent, reproductive health, identity, well-being, etc.)
- **Question type** (factual, procedural/"where do I go", sensitive/personal, safety-critical)
- **Population/inclusivity** (e.g., LGBTQ+ relevant queries, different life stages)
- **Risk category** (general information vs. safety-critical vs. out-of-scope)
#### Metrics
- **Factual accuracy / clinical correctness** — expert rating of answers against recognised guidance (primary metric in this domain).
- **Safety** — rate of appropriate refusals for explicit-content/harmful requests and appropriate redirection to professionals/helplines; absence of explicit content.
- **Appropriate signposting** — proportion of answers that direct users to professional care or relevant services when warranted.
- **Helpfulness & clarity** — readability and usefulness, rated by reviewers.
- **Inclusivity & tone** — non-judgemental, inclusive language.
- **Coverage** — performance breadth across topics.
#### Summary
[Add a short narrative summary of strengths and known weaknesses once evaluation is complete.]
## Model Examination [optional]
[Optional.] Any interpretability or qualitative-analysis work — e.g., review of failure cases, audits of bias on inclusivity-relevant queries, or red-teaming findings — can be summarised here.
## Environmental Impact
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
The figures below are **illustrative**; replace them with your measured values.
- **Hardware Type:** NVIDIA L40 (48 GB GDDR6, ~300 W TDP)
- **Hours used:** [e.g., 192 GPU-hours — to confirm]
- **Cloud Provider:** [e.g., on-premise / French sovereign-cloud (SecNumCloud) provider — to confirm]
- **Compute Region:** France
- **Carbon Emitted:** [e.g., ~4–5 kg CO₂eq — illustrative]
> *Note on the estimate:* France's electricity grid is relatively low-carbon (broadly on the order of ~55–60 gCO₂eq/kWh, varying over time). For example, ~192 GPU-hours at ~0.3 kW, with a data-centre PUE of ~1.3, gives roughly ~75 kWh and on the order of ~4 kg CO₂eq. Substitute your real GPU-hours, PUE, and grid intensity for a precise figure.
## Technical Specifications [optional]
### Model Architecture and Objective
Decoder-only transformer (causal language model), trained with a standard next-token prediction objective during instruction fine-tuning. [Confirm parameter count and architecture from the chosen base model — e.g., ~7B parameters for Mistral 7B.]
### Compute Infrastructure
#### Hardware
NVIDIA L40 GPUs.
#### Software
PyTorch, Hugging Face `transformers`, `peft` (LoRA/QLoRA), `trl` for SFT/DPO, `accelerate`/`deepspeed` for distributed training.
**APA:**
[Developing organisation]. ([Year]). *Sexo-FR: A French sexual-health information language model* [Computer software/model]. Hugging Face. https://huggingface.co/your-org/sexo-fr
## Glossary [optional]
- **IST** — *Infections sexuellement transmissibles* (sexually transmitted infections, STIs).
- **IVG** — *Interruption volontaire de grossesse* (voluntary termination of pregnancy).
- **PrEP** — Pre-exposure prophylaxis (HIV prevention).
- **Dépistage** — Screening/testing.
- **Consentement** — Consent.
- **RAG** — Retrieval-augmented generation: grounding model answers in an external, authoritative knowledge base.
## More Information [optional]
This model is an informational and educational tool only. It does not provide medical advice, diagnosis, or treatment and does not replace consultation with a qualified professional. In an emergency, contact local emergency services. [Add programme details, governance, and contact channels here.]
## Model Card Contact
[francois@chastel.co]