Downloads · 30 days
14
14% of all-time downloads
santoshgairesharma/nepmedjp-mt5-xl
nepmedjp-mt5-xl is a machine learning model from santoshgairesharma. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
Model ID: santoshgairesharma/nepmedjp-mt5-xl Base model: google/mt5-xl (~3.7B parameters) Stage: Continued pre-training (T5-style span corruption) on English medical, Japanese, and Nepali text Project: NepMedJP
Downloads · 30 days
14
14% of all-time downloads
All-time downloads
98
Public
Parameters
3.7B
15 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors15 GB · 100%
From the Hugging Face model README
Model ID: santoshgairesharma/nepmedjp-mt5-xl
Base model: google/mt5-xl (~3.7B parameters)
Stage: Continued pre-training (T5-style span corruption) on English medical, Japanese, and Nepali text
Project: NepMedJP
This is a general-purpose continued-pretrained language model, not a task model. It has only ever been trained on the span-corruption objective. It is not a summarization model, not a translation model, and not instruction-tuned. It will not respond sensibly to task prompts such as
summarize:ortranslate:— those prefixes were never in its training data. To use it for any task, you must fine-tune it first.
This checkpoint is a continued-pretrained mT5-XL whose domain and language coverage has been adapted to English medical, Nepali (medical and general), and Japanese (general and medical) text. The adaptation is measured purely as improved span-corruption loss/perplexity in those domains (see Evaluation) — that is, better language and domain modelling, not task capability.
Within the NepMedJP project this checkpoint serves as the Stage A backbone that later stages fine-tune for Japanese→Nepali medical summarization. That downstream use is one application of this model, not a description of it.
| Architecture | mT5 encoder–decoder (MT5ForConditionalGeneration) |
| Parameters | ~3.7 billion (same as google/mt5-xl) |
Hidden size (d_model) | 2048 |
FFN (d_ff) | 5120 |
| Attention heads | 32 |
| Encoder / decoder layers | 24 / 24 |
| Vocabulary | 250,112 (SentencePiece) |
| Objective | Span corruption (noise density 0.15, mean span length 3.0) |
| Sequence length | 1024 |
| Precision (train) | bfloat16 |
| Optimizer | Adafactor |
| Peak LR / warmup | 1e-4 / 1,000 steps |
| Effective batch | 32 (per-device batch 1 × grad accum 32) |
| Training steps | 77,075 |
| License | Apache-2.0 (inherits from google/mt5-xl) |
This is a base checkpoint. Every intended use involves training something on top of it:
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
repo_id = "santoshgairesharma/nepmedjp-mt5-xl"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForSeq2SeqLM.from_pretrained(repo_id)
# Attach your task head / LoRA adapter and train on your own labelled data.
# Nothing below this line works until that fine-tuning has happened.
The only thing this checkpoint does out of the box is fill in masked spans, because that is
the sole objective it was trained on. Masked spans are marked with sentinel tokens
(<extra_id_0>, <extra_id_1>, …) and the model predicts the missing text:
text = "मधुमेह एक <extra_id_0> रोग हो जसमा रगतमा <extra_id_1> मात्रा बढ्छ।"
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=32)
print(tokenizer.decode(outputs[0], skip_special_tokens=False))
# -> sentinel-delimited span predictions, e.g. "<extra_id_0> ... <extra_id_1> ..."
This is a diagnostic, not an application. Useful output for a real task requires fine-tuning.
Note: This release is the continued-pretrained base only. Japanese→Nepali summarization capability lives in the separate NepMedJP LoRA / fine-tuned stage (Stage C) and is not present in these weights.
Continued pre-training interleaves five corpora with domain-priority sampling (inspired by mT5 temperature sampling (p(L) \propto |L|^\alpha), but here using fixed task-informed weights). English medical and project-constructed medical Nepali are heavily prioritized for cross-lingual medical transfer; general JA/NE corpora support language competence.
| Corpus key | Role | Sampling weight |
|---|---|---|
eng_medical_data | English medical (largest medical anchor) | 0.45 |
ne_medical_data | Project medical Nepali (Nepalipubmeddata) — target-language medical upsampling | 0.35 |
jp_general_data | General Japanese competence | 0.10 |
ne_general_data | General Nepali competence | 0.095 |
jp_medical_data | Japanese medical slice | 0.005 |
Caps (to control steps / cache size): English medical ≤ 3,000,000 records; Japanese general ≤ 2,000,000 records.
Split: 95% train / 5% validation per source (seed 42), then interleave_datasets with the weights above (stopping_strategy="all_exhausted" on train).
Full narrative strategy, design rationale, and hyperparameter table: see training/PRETRAINING_STRATEGY.md.
Exact training code used for this run: training/pretraining_script.py.
google/mt5-xl with dropout_rate=0.1; enable gradient checkpointing.Trainer: Adafactor, bf16, LR 1e-4, warmup 1,000, eval/save every 10,000 steps, load_best_model_at_end on eval_loss.final_model/.Wall-clock (from metrics log): ~35,000+ minutes of logged training/eval time on the original run hardware (A100-class recommended).
Span-corruption eval loss and perplexity on held-out slices of each corpus.
Baseline = unmodified google/mt5-xl.
NepMedJP final = this release after 77,075 continued-pretraining steps under the domain-priority configuration.
| Dataset | Base loss ↓ | Base PPL ↓ | NepMedJP loss ↓ | NepMedJP PPL ↓ | Δ loss | Δ PPL |
|---|---|---|---|---|---|---|
eng_medical_data | 1.2275 | 3.41 | 0.9766 | 2.66 | −0.25 | −0.75 |
ne_medical_data | 1.6492 | 5.20 | 0.9437 | 2.57 | −0.71 | −2.63 |
jp_medical_data | 2.6662 | 14.38 | 1.6649 | 5.28 | −1.00 | −9.10 |
ne_general_data | 1.0182 | 2.77 | 0.8968 | 2.45 | −0.12 | −0.32 |
jp_general_data | 3.0819 | 21.80 | 2.2675 | 9.66 | −0.81 | −12.14 |
Machine-readable table: training/baseline_vs_final_per_language.csv.
Final-only numbers: training/per_language_eval.csv.
Takeaways
A pilot continued-pretraining run using the default mT5 paper-style configuration was evaluated at step 10k against the same baseline. That pilot did not improve—per-domain loss/PPL degraded sharply vs google/mt5-xl (e.g. English medical PPL 3.41 → ~1313). We therefore discarded that configuration and retained the NepMedJP recipe documented here (Adafactor, domain-priority sampling, bf16, effective batch 32, etc.).
Evidence figure from that comparison:
training/plots/baseline_vs_default_mt5_config_step10k.png
Eval every 10k steps on the interleaved validation mixture:
| Step | Eval loss | Perplexity |
|---|---|---|
| 10,000 | 1.234 | 3.43 |
| 20,000 | 1.183 | 3.26 |
| 30,000 | 1.153 | 3.17 |
| 40,000 | 1.133 | 3.10 |
| 50,000 | 1.113 | 3.04 |
| 60,000 | 1.099 | 3.00 |
| 70,000 | 1.089 | 2.97 |
Full step-level train/eval curves: training/metrics_log.csv and training/plots/.
training/plots/metrics_final.pngmetrics_step_0010000.png … metrics_step_0077075.pngbaseline_vs_default_mt5_config_step10k.png├── config.json / generation_config.json
├── model-00001-of-00003.safetensors
├── model-00002-of-00003.safetensors
├── model-00003-of-00003.safetensors
├── model.safetensors.index.json
├── tokenizer files (spiece.model, tokenizer.json, …)
├── README.md ← this model card
└── training/
├── PRETRAINING_STRATEGY.md ← detailed method write-up
├── pretraining_script.py ← exact training script used
├── metrics_log.csv ← step-level train/eval metrics
├── per_language_eval.csv ← final per-domain eval
├── baseline_vs_final_per_language.csv ← base mT5-XL vs this release
└── plots/ ← metric dashboards + baseline figure
Intermediate optimizer checkpoints (checkpoint-60000, etc.) are not included in this Hub release; only the final loadable model and full training evidence packages are published.
NepMedJP targets improved access to medical information for Nepali speakers interacting with Japanese-sourced materials. Release of open weights and training artifacts is intended to enable reproducible research and community scrutiny. Clinical deployment requires separate validation, governance, and human oversight.
If you use this model, please cite the NepMedJP project and the original mT5 work:
@misc{nepmedjp-mt5-xl,
title = {NepMedJP mT5-XL: Continued Pre-training for Japanese--Nepali Medical NLP},
author = {Sharma, Santosh Gaire},
year = {2026},
howpublished = {\url{https://huggingface.co/santoshgairesharma/nepmedjp-mt5-xl}},
note = {Continued pre-training of google/mt5-xl}
}
@article{xue2021mt5,
title = {{mT5}: A Massively Multilingual Pre-trained Text-to-Text Transformer},
author = {Xue, Linting and Constant, Noah and Roberts, Adam and Kale, Mihir and Al-Rfou, Rami and Siddhant, Aditya and Barua, Aditya and Raffel, Colin},
journal = {NAACL},
year = {2021}
}
Codebase: github.com/Santey624/NepMedJPSum
Built on google/mt5-xl (Apache-2.0). Training used Hugging Face Transformers / Datasets and domain-priority interleaving over EN/JA/NE medical and general corpora constructed or curated for NepMedJP.