Downloads · 30 days
22
14% of all-time downloads
iue-edu/MaternaCare-ES-gemma4-qlora
MaternaCare-ES-gemma4-qlora is a text generation model from iue-edu. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
<p align="center" <img src="app-icon.png" alt="MaternaQA-es / MaternaCare-ES visual identity" width="180" / </p
Downloads · 30 days
22
14% of all-time downloads
All-time downloads
154
Public
Repo size
294 MB
Likes
0
Public
Click a slice to open those files.
.safetensors228 MB · 52%
From the Hugging Face model README
MaternaCare-ES Gemma 4 QLoRA is a PEFT/QLoRA adapter for google/gemma-4-E2B-it, fine-tuned for Spanish maternal-health question answering with grounded clinical context.
The adapter was trained on the grounded SFT split of iue-edu/MaternaQA-es, a Spanish obstetrics and maternal-health QA dataset built from curated clinical PDF sources.
This is a research artifact. It is not a medical device and must not be used as a substitute for professional clinical judgment.
iue-edu/MaternaQA-esJhonHander/MaternaCare-ESThis adapter is intended for research and development workflows such as:
It is not intended for direct patient care, autonomous diagnosis, treatment recommendation, emergency triage, or any clinical decision-making workflow.
The model was fine-tuned with the sft_grounded configuration of MaternaQA-es.
| Split | QA pairs | Source chunks | Source PDFs |
|---|---|---|---|
| Train | 5,093 | 1,744 | 52 |
| Validation | 306 | 101 | 2 |
| Test | 328 | 108 | 3 |
| Total | 5,727 | 1,953 | 57 |
In the grounded format, each example provides source context and a question, and the assistant is trained to answer using that context.
The adapter was trained with TRL supervised fine-tuning and PEFT QLoRA.
Observed training setup from the public repository:
| Setting | Value |
|---|---|
| Base model | google/gemma-4-E2B-it |
| Dataset | iue-edu/MaternaQA-es |
| Dataset variant | sft_grounded |
| Method | SFT with QLoRA |
| Max sequence length | 1024 |
| Epochs | 2.0 |
| Per-device batch size | 1 |
| Gradient accumulation | 8 |
| Learning rate | 2e-4 |
| Optimizer | adamw_8bit |
| Scheduler | cosine |
| Quantization | 4-bit NF4 with double quantization |
| LoRA rank | 16 |
| LoRA alpha | 16 |
| LoRA dropout | 0.05 |
Evaluation was run on the MaternaQA-es test split with 328 predictions. Automatic metrics are useful for comparison, but they do not establish clinical correctness.
| Model | Faithfulness | Answer relevancy | Correctness | Semantic similarity |
|---|---|---|---|---|
| Gemma 4 base | 0.3998 | 0.8144 | 0.6322 | 0.7739 |
| Gemma 4 grounded QLoRA | 0.7268 | 0.7184 | 0.7258 | 0.8608 |
Evaluation setup:
gpt-5.4-minitext-embedding-3-smallThe underlying Gemma base model is gated. Before loading this adapter, make sure you have accepted the base-model terms on Hugging Face and are authenticated locally.
from peft import AutoPeftModelForCausalLM
from transformers import AutoTokenizer
import torch
adapter_id = "iue-edu/MaternaCare-ES-gemma4-qlora"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
model = AutoPeftModelForCausalLM.from_pretrained(
adapter_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
context = """Contexto fuente: [Insert reviewed clinical context here.]"""
question = "¿Cuáles son los signos de alarma durante el embarazo?"
messages = [
{
"role": "user",
"content": f"{context}\n\nPregunta: {question}\n\nResponde en español usando el contexto fuente.",
}
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
).to(model.device)
with torch.no_grad():
output = model.generate(
inputs,
max_new_tokens=256,
temperature=0.2,
do_sample=False,
repetition_penalty=1.05,
)
print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True))
This adapter may generate fluent but incorrect or incomplete medical text. Use it only in controlled research settings with expert review.
Do not use it for:
If you use this adapter, please cite the dataset and the training/evaluation repository:
@misc{maternaqa_es,
title = {MaternaQA-es: A Spanish Maternal-Health Question Answering Dataset},
author = {Instituci\'on Universitaria de Envigado and collaborators},
year = {2026},
howpublished = {\url{https://huggingface.co/datasets/iue-edu/MaternaQA-es}}
}
@misc{maternacare_es,
title = {MaternaCare-ES: Spanish Maternal-Health QLoRA Adapters},
author = {Instituci\'on Universitaria de Envigado and collaborators},
year = {2026},
howpublished = {\url{https://github.com/JhonHander/MaternaCare-ES}}
}