Instructions to use TonyLanes/natlas-mamii with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use TonyLanes/natlas-mamii with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("NCAIR1/N-ATLaS") model = PeftModel.from_pretrained(base_model, "TonyLanes/natlas-mamii") - Transformers
How to use TonyLanes/natlas-mamii with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TonyLanes/natlas-mamii") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("TonyLanes/natlas-mamii", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TonyLanes/natlas-mamii with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TonyLanes/natlas-mamii" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TonyLanes/natlas-mamii", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TonyLanes/natlas-mamii
- SGLang
How to use TonyLanes/natlas-mamii with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "TonyLanes/natlas-mamii" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TonyLanes/natlas-mamii", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "TonyLanes/natlas-mamii" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TonyLanes/natlas-mamii", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use TonyLanes/natlas-mamii with Docker Model Runner:
docker model run hf.co/TonyLanes/natlas-mamii
N-ATLaS-MAMII
N-ATLaS-MAMII is a research prototype that fine-tunes N-ATLaS for structured interpretation of maternal and newborn healthcare narratives. It aims to extract reported findings, identify potential danger signs, represent uncertainty, and produce structured information about urgency, risk, actions, and timeframes.
Status: Research prototype. Not clinically validated. Not for use in patient care.
Model Details
Model Description
- Developed by: N-ATLaS-MAMII project team
- Shared by: TonyLanes
- Model type: Parameter-efficient fine-tuned language model adapter
- Domain: Maternal and newborn healthcare
- Language(s): Not comprehensively evaluated; no language-specific performance claims are made.
- Finetuned from: NCAIR1/N-ATLaS
- Fine-tuning method: QLoRA
- Model artefact: PEFT adapter; not a standalone full model
- License: Refer to the base model's licence and access conditions. The adapter's redistribution permissions must be confirmed before reuse.
The intended scope spans five areas:
- Preconception
- Antenatal care
- Labour and delivery
- Postpartum care
- Newborn care
The prototype is designed to preserve negation, uncertainty, and missing information rather than treating every unreported finding as absent.
Model Sources
- Model repository: https://huggingface.co/TonyLanes/natlas-mamii
- Base model: https://huggingface.co/NCAIR1/N-ATLaS
- Project repository: https://github.com/AnthonyOyenuga/natlas-mamii
- Demo: No publicly deployed interactive demo is currently provided.
Uses
Direct Use
The adapter is intended for research into domain adaptation and structured extraction from synthetic maternal and newborn clinical narratives. It can be used to investigate whether fine-tuning improves adherence to a predefined response schema.
Downstream Use
Potential future research applications include clinical-information structuring, referral-information workflows, and evaluation of domain-adapted language models for maternal and newborn healthcare.
These are prospective applications, not validated capabilities or deployed services.
Out-of-Scope Use
Do not use this model to:
- Diagnose, triage, or treat real patients.
- Make autonomous clinical or referral decisions.
- Replace qualified healthcare professionals.
- Recommend treatment or medication without qualified clinical oversight.
- Support clinical deployment without independent clinical validation and safety testing.
Bias, Risks, and Limitations
This model has not been clinically validated. Its outputs may be incomplete, incorrect, misleading, or unsafe. It may misclassify danger signs, urgency, or risk; omit important findings; or provide unsupported recommendations.
The current evaluation has important limitations:
- Reference answers remain pending clinical review.
- The formal evaluation has unresolved test-set split-protection issues.
- Exact reference-field agreement measures textual agreement, not clinical correctness.
- Supplemental training and validation cases are not an independent held-out test set.
- Incomplete or invalid JSON responses remain a technical limitation.
- Performance across Nigerian languages, dialects, healthcare facilities, and patient populations has not been comprehensively established.
Recommendations
Use synthetic cases for research and testing only. Review outputs against authoritative clinical guidance and qualified clinical judgement. Before any clinical application, independently audit dataset provenance and split integrity, clinically validate reference answers, assess dangerous failure modes, and evaluate performance across relevant populations and settings.
How to Get Started with the Model
This repository contains a PEFT adapter, not the full base model. Loading it requires access to a compatible base model and compatible software dependencies.
Example loading pattern:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base_id = "NCAIR1/N-ATLaS"
adapter_id = "TonyLanes/natlas-mamii"
tokenizer = AutoTokenizer.from_pretrained(base_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_id,
torch_dtype="auto",
device_map="auto",
)
model = PeftModel.from_pretrained(
base_model,
adapter_id,
)
messages = [
{
"role": "system",
"content": (
"You are evaluating a maternal and newborn healthcare "
"research prototype. Do not infer missing clinical facts. "
"This is synthetic research only, not for patient care."
),
},
{
"role": "user",
"content": (
"Analyse this synthetic clinical narrative: "
"[Insert a synthetic test narrative here.]"
),
},
]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
do_sample=False,
)
generated = outputs[0][inputs["input_ids"].shape[1]:]
print(tokenizer.decode(generated, skip_special_tokens=True))
This is an illustrative loading example, not a validated inference pipeline. The base model may require specific access permissions, dependencies, or loading settings. Output quality and completeness are not guaranteed.
Training Details
Training Data
The project dataset contains synthetic maternal and newborn healthcare narratives and structured reference responses across five care domains: preconception, antenatal care, labour and delivery, postpartum care, and newborn care.
Reference answers are pending clinical review. Dataset size, exact provenance, filtering procedures, and split integrity should be confirmed against the project's dataset artefacts before making stronger claims.
Training Procedure
The model was fine-tuned using a QLoRA-based parameter-efficient workflow with Unsloth, PEFT, Hugging Face Transformers, and PyTorch in Google Colab with GPU acceleration.
Preprocessing
Training and evaluation artefacts use JSONL. The intended output schema includes:
findingsdanger_signsurgencyrisk_categoryactiontimeframeuncertaintysummaryguideline_basisvalidation_status
Training Hyperparameters
- Training regime: 4-bit quantized base model with QLoRA adapter training.
- Other hyperparameters: Consult the saved training configuration before reproducing the run.
Speeds, Sizes, Times
The recorded fine-tuning run completed 171 training steps in approximately 36 minutes and 14 seconds on a Google Colab T4 GPU. This is a run-specific measurement, not a general throughput guarantee.
Evaluation
Testing Data, Factors & Metrics
The project conducted a preliminary paired comparison of base N-ATLaS and the fine-tuned adapter on 100 cases. A separate supplemental structural audit examined 400 responses from 350 training cases and 50 validation cases.
The supplemental audit is not an independent held-out evaluation. The formal 100-case evaluation also has unresolved split-protection issues.
Metrics
- Complete structured-response compliance: Proportion of responses containing the complete required set of fields.
- Exact reference-field agreement: Mean exact agreement between generated fields and draft reference answers.
- Schema validity: Proportion of outputs meeting the evaluated JSON structure and field-type requirements.
- Valid JSON: Proportion of responses successfully parsed as JSON objects.
These metrics assess formatting and reference agreement. They do not establish clinical accuracy, clinical safety, or patient outcomes.
Results
Formal 100-case preliminary comparison
| Metric | Base N-ATLaS | Fine-tuned adapter |
|---|---|---|
| Valid JSON | 100/100 (100%) | 100/100 (100%) |
| Complete structured-response compliance | 24/100 (24%) | 58/100 (58%) |
| Mean exact reference-field agreement | 0.50% | 39.80% |
| Mean safety-field agreement | 1% | 40% |
Complete structured-response compliance improved by 34 percentage points. Mean exact reference-field agreement improved by 39.30 percentage points.
In paired comparisons, the fine-tuned adapter had 58 wins, 3 losses, and 39 ties. The bootstrap 95% confidence interval for the difference in field agreement was 31.70 to 47.00 percentage points.
These results are preliminary text-matching findings. The reference answers have not completed clinical review, and unresolved split-protection issues limit claims about generalisation.
Supplemental 400-case structural audit
| Metric | Base N-ATLaS | Fine-tuned adapter |
|---|---|---|
| Valid JSON | 51.0% | 54.8% |
| Exact required keys | 50.8% | 54.8% |
| Schema-valid responses | 30.8% | 54.2% |
Schema validity improved by 23.5 percentage points. However, many outputs were incomplete or invalid, and the cases came from training and validation splits. These results are supplemental diagnostics, not independent benchmark evidence.
Evaluation Summary
The preliminary evaluations suggest that fine-tuning improved adherence to the target structured-output schema and agreement with draft reference fields in the formal 100-case comparison. Output completeness remains a limitation. Clinical accuracy, safety, and generalisation have not been established.
Environmental Impact
- Hardware type: NVIDIA T4 GPU on Google Colab for the recorded training run.
- Training time: Approximately 36 minutes and 14 seconds for 171 steps.
- Cloud provider: Google Colab.
- Compute region: Not recorded.
- Carbon emitted: Not measured.
No emissions estimate is claimed because the required energy and regional data are unavailable.
Technical Specifications
Model Architecture and Objective
The adapter
- Downloads last month
- 16
Model tree for TonyLanes/natlas-mamii
Base model
NCAIR1/N-ATLaS