Downloads · 30 days
0
jeromex1/lyra_air_sante_mistral7B_qLoRA
lyra_air_sante_mistral7B_qLoRA is a text generation model from jeromex1. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
🌐 Looking for the English version? Scroll down 👇
Downloads · 30 days
0
Access
Public
Updated Oct 30, 2025
Repo size
672 MB
Likes
0
Public
Click a slice to open those files.
.safetensors671 MB · 99%
From the Hugging Face model README
🌐 Looking for the English version? Scroll down 👇
<img src="https://upload.wikimedia.org/wikipedia/en/c/c3/Flag_of_France.svg" width="40px" height="auto" />
Ce modèle est une adaptation LoRA (qLoRA 4 bits) du modèle mistralai/Mistral-7B-Instruct-v0.3, spécialisée pour l’évaluation rapide des risques santé liés à la qualité de l’air et aux conditions atmosphériques.
Le modèle apprend à répondre à des scénarios du type :
Objectif : générer des alertes lisibles par des non-spécialistes, réutilisables dans des tableaux de bord santé-environnement, ou des assistants conseil air/santé locaux.
Ce modèle n’est pas un dispositif médical. C’est un système de priorisation / alerte précoce.
mistralai/Mistral-7B-Instruct-v0.3transformers, trl (SFTTrainer), bitsandbytes, peft[{"role": "user", "content": ...}, {"role": "assistant", "content": ...}]L’entraînement n’a pas modifié tous les poids du modèle Mistral 7B. Seules de petites matrices d’adaptation (LoRA adapters) ont été apprises. C’est pourquoi ce repo publie uniquement ces adapters, pas les poids complets du modèle d’origine.
| Epoch | Training Loss | Validation Loss | Entropy | Tokens traités | Mean Token Accuracy |
|---|---|---|---|---|---|
| 1 | 0.3566 | 0.3021 | 0.2266 | 41 887 | 0.9258 |
| 2 | 0.2265 | 0.2253 | 0.2272 | 83 774 | 0.9293 |
| 3 | 0.2215 | 0.2218 | 0.2273 | 125 661 | 0.9299 |
Chaque exemple du jeu d'entraînement est une conversation courte :
{
"messages": [
{
"role": "user",
"content": "Conditions météo : Température = >30°C, Humidité = 40-70%, Inversion thermique = oui, Pollens = élevé, IQA = 5, Vent fort = oui, Pluie forte = non.\nQuels sont les impacts potentiels sur la santé ?"
},
{
"role": "assistant",
"content": "Niveau d’allergie : très élevé. Sensibilité cardiovasculaire : élevé."
}
]
}
Le tokenizer Mistral (mistralai/Mistral-7B-Instruct-v0.3) a été utilisé avec son chat_template pour convertir ces messages en texte d’entraînement.
Les exemples ci-dessous montrent le comportement du modèle lyra_air_sante_mistral7B_qLoRA sur cinq scénarios climatiques typiques. Les entrées suivent la structure exacte du dataset (messages → user / assistant).
🧩 Test 1 Conditions météo : Température = 34°C, Humidité = 45%, Inversion thermique = oui, Pollens = très élevé, IQA = 6, Vent fort = non, Pluie forte = non. Question : Quels sont les impacts potentiels sur la santé ?
🧩 Test 2 Conditions météo : Température = 10°C, Humidité = 80%, Inversion thermique = non, Pollens = faible, IQA = 2, Vent fort = oui, Pluie forte = oui. Question : Effets possibles sur les personnes âgées ?
🧩 Test 3 Conditions météo : Température = 28°C, Humidité = 30%, Inversion thermique = oui, Pollens = moyen, IQA = 8, Vent fort = non, Pluie forte = non. Question : Quels conseils pour les personnes asthmatiques ?
🧩 Test 4 Conditions météo : Température = 22°C, Humidité = 60%, Inversion thermique = non, Pollens = élevé, IQA = 4, Vent fort = oui, Pluie forte = non. Question : Risque pour les travailleurs en extérieur ?
🧩 Test 5 Conditions météo : Température = 36°C, Humidité = 50%, Inversion thermique = oui, Pollens = faible, IQA = 7, Vent fort = non, Pluie forte = non. Question : Quels effets combinés chaleur + pollution prévoir ?
Réponse :
Niveau d’allergie : faible.
Sensibilité cardiovasculaire : élevé.
Exemple (Python) :
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "mistralai/Mistral-7B-Instruct-v0.3"
adapter_id = "jeromex1/lyra_air_sante_mistral7B_qLoRA"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.float16,
device_map="auto"
)
model = PeftModel.from_pretrained(
model,
adapter_id
)
prompt = (
"Conditions météo : Température = 32°C, Humidité = 60%, "
"Inversion thermique = oui, Pollens = très élevé, "
"IQA = 5 (mauvais), Vent fort = non, Pluie forte = non.\n"
"Quels sont les impacts potentiels sur la santé ?"
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
out = model.generate(
**inputs,
max_new_tokens=128,
temperature=0.7,
top_p=0.9,
)
print(tokenizer.decode(out[0], skip_special_tokens=True))
Le modèle doit répondre avec une synthèse structurée du risque, par exemple :
📘 Découvrez mes 40 projets IA et sciences STEM ici : 👉 github.com/Jerome-openclassroom
📘 Pour en savoir plus, rendez-vous sur ma page GitHub consacrée au projet : 👉 Mistral_7B_AirQuality_LoRA
<a name="english-version"></a>
This model is a LoRA adaptation (qLoRA 4-bit) of mistralai/Mistral-7B-Instruct-v0.3, specialized for rapid health risk assessment related to air quality and atmospheric conditions.
The model learns to respond to scenarios combining:
Goal: produce short, readable alerts suitable for environmental health dashboards or local air/health assistant systems.
⚠️ This model is not a medical device, but an early alert and prioritization system.
mistralai/Mistral-7B-Instruct-v0.3transformers, trl (SFTTrainer), bitsandbytes, peft[{"role": "user", "content": ...}, {"role": "assistant", "content": ...}]Only small LoRA adapter matrices were trained — not the full model weights.
Therefore, this repository only publishes the adapters, not the base weights.
| Epoch | Training Loss | Validation Loss | Entropy | Tokens Processed | Mean Token Accuracy |
|---|---|---|---|---|---|
| 1 | 0.3566 | 0.3021 | 0.2266 | 41,887 | 0.9258 |
| 2 | 0.2265 | 0.2253 | 0.2272 | 83,774 | 0.9293 |
| 3 | 0.2215 | 0.2218 | 0.2273 | 125,661 | 0.9299 |
Each training sample is a short chat pair:
{
"messages": [
{
"role": "user",
"content": "Weather conditions: Temperature = >30°C, Humidity = 40-70%, Thermal inversion = yes, Pollen = high, AQI = 5, Strong wind = yes, Heavy rain = no.\nWhat are the potential health impacts?"
},
{
"role": "assistant",
"content": "Allergy level: very high. Cardiovascular sensitivity: high."
}
]
}
The Mistral tokenizer (mistralai/Mistral-7B-Instruct-v0.3) was used with its chat_template to convert these messages into training text.
🧪 Inference Examples
Below are five sample predictions illustrating the behavior of lyra_air_sante_mistral7B_qLoRA.
🧩 Test 1
Weather: Temperature = 34°C, Humidity = 45%, Thermal inversion = yes, Pollen = very high, AQI = 6, Strong wind = no, Heavy rain = no.
Question: What are the potential health impacts?
Answer:
Allergy level: very high.
Cardiovascular sensitivity: high.
🧩 Test 2
Weather: Temperature = 10°C, Humidity = 80%, Thermal inversion = no, Pollen = low, AQI = 2, Strong wind = yes, Heavy rain = yes.
Question: Effects on elderly people?
Answer:
Allergy level: low.
Cardiovascular sensitivity: low.
🧩 Test 3
Weather: Temperature = 28°C, Humidity = 30%, Thermal inversion = yes, Pollen = medium, AQI = 8, Strong wind = no, Heavy rain = no.
Question: Recommendations for asthmatic individuals?
Answer:
Allergy level: high.
Cardiovascular sensitivity: high.
🧩 Test 4
Weather: Temperature = 22°C, Humidity = 60%, Thermal inversion = no, Pollen = high, AQI = 4, Strong wind = yes, Heavy rain = no.
Question: Risk for outdoor workers?
Answer:
Allergy level: high.
Cardiovascular sensitivity: low.
🧩 Test 5
Weather: Temperature = 36°C, Humidity = 50%, Thermal inversion = yes, Pollen = low, AQI = 7, Strong wind = no, Heavy rain = no.
Question: Combined effects of heat and pollution?
Answer:
Allergy level: low.
Cardiovascular sensitivity: high.
Using the Adapters
Load the base Mistral 7B Instruct model
Load the LoRA adapters
Merge them for inference
Example (Python):
python
Copier le code
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "mistralai/Mistral-7B-Instruct-v0.3"
adapter_id = "jeromex1/lyra_air_sante_mistral7B_qLoRA"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.float16,
device_map="auto"
)
model = PeftModel.from_pretrained(model, adapter_id)
prompt = (
"Weather conditions: Temperature = 32°C, Humidity = 60%, "
"Thermal inversion = yes, Pollen = very high, "
"AQI = 5 (poor), Strong wind = no, Heavy rain = no.\n"
"What are the potential health impacts?"
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
out = model.generate(
**inputs,
max_new_tokens=128,
temperature=0.7,
top_p=0.9,
)
print(tokenizer.decode(out[0], skip_special_tokens=True))
Expected output:
A structured summary of health risks such as allergies, respiratory irritation, thermal stress, or cardio strain for vulnerable groups.
Target Use Cases
Local air/health alert systems for municipalities or associations
Public communication (short, readable messages)
Environmental health dashboards and daily reports
Risk alerts for specific populations (asthmatics, elderly, outdoor workers, etc.)
Limitations
The model does not replace medical expertise or emergency services.
Risk scores are not medically calibrated to a specific region.
Predictions depend on the completeness of the environmental input data.
The fine-tuning dataset is small (a few hundred curated examples). It’s specialized but not general-purpose.
Ethical Disclaimer
Do not use this model for clinical diagnosis or treatment.
Do not use it for insurance, HR, or legal decision-making.
Intended use: awareness, public communication, and policy support.
Author / Contact
Author / Training: Jérôme (jeromex1)
Pipeline: dataset preparation → Mistral chat template → qLoRA 4-bit fine-tuning on Colab GPU → adapter publication
Focus: Applied AI for environmental and public health intelligence.
📘 Discover my 45+ STEM and AI projects on GitHub : 👉 [github.com/Jerome-openclassroom](https://github.com/Jerome-openclassroom/)
📘 **To know more about this project**, see here : 👉 [Mistral_7B_AirQuality_LoRA](https://github.com/Jerome-openclassroom/Mistral_7B_AirQuality_LoRA/blob/main/README_En.md)