Instructions to use texdata/t5-sl-medical-gec with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use texdata/t5-sl-medical-gec with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="texdata/t5-sl-medical-gec")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("texdata/t5-sl-medical-gec") model = AutoModelForSeq2SeqLM.from_pretrained("texdata/t5-sl-medical-gec", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use texdata/t5-sl-medical-gec with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "texdata/t5-sl-medical-gec" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "texdata/t5-sl-medical-gec", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/texdata/t5-sl-medical-gec
- SGLang
How to use texdata/t5-sl-medical-gec 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 "texdata/t5-sl-medical-gec" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "texdata/t5-sl-medical-gec", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "texdata/t5-sl-medical-gec" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "texdata/t5-sl-medical-gec", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use texdata/t5-sl-medical-gec with Docker Model Runner:
docker model run hf.co/texdata/t5-sl-medical-gec
t5-sl-medical-gec
A small Slovenian grammar / case-agreement corrector for post-editing
machine-translated medical text. Fine-tune of cjvt/t5-sl-small
(~76M params). It fixes the declension / adjective-noun agreement slips that a
large LLM translator tends to make in Slovenian (e.g. krvnega glukoze →
krvne glukoze), without touching numbers, units or drug names.
Intended as a cheap post-edit step after an MT model, gated by a term-preservation check.
⚠️ Disclaimer
Research/educational tool. Not medical advice, not a clinical product. It is a grammar corrector, not a source of medical information. Output must be verified by a qualified human before any real-world use. Provided as is, without warranty; no liability is accepted for its use or misuse. Because it rewrites text, always pair it with a check that numbers / units / drug names are unchanged (it is trained not to touch them, but verify).
What it does
Input: popravi: <slovenian text with case/agreement errors>
Output: <corrected slovenian text>
- Fixes case-ending and gender-agreement errors (the class an LLM translator produces): vzdrževalna odmerka → vzdrževalni odmerek, intravenskimi lorazepamom → intravenskim lorazepamom, Depresijo značata → Depresija je značilna po ….
- Does not over-edit already-correct text (trained with ~20% identity pairs).
- Does not fix lexical calques (e.g. rdeča zastavica for "red flag") or every noun-form error — those are out of scope for a case-GEC.
On a held-out set of clinical sentences it cleanly fixes ~half of the residual case/agreement slips left after beam search.
Training
- Base:
cjvt/t5-sl-small. - Data: ~147k synthetic
(corrupt, clean)pairs. Clean Slovenian sentences (the SL side of the EMEA / Europarl OPUS corpora — human translations, not MT) are corrupted by swapping noun/adjective case endings within cross-gender confusion sets; ~20% are left uncorrupted (identity) so the model learns not to over-edit. Numbers, units, ALL-CAPS codes and short words are never corrupted. - Objective: text-to-text restoration, prefix
popravi:. 3 epochs. - This is a prototype-grade corruption (rule-based, no morphological analyser); a production version would use classla MSD tags + a sloleks generator for fully realistic inflection.
Usage
from transformers import AutoModelForSeq2SeqLM, PreTrainedTokenizerFast
from huggingface_hub import hf_hub_download
repo = "<your-org>/t5-sl-medical-gec"
tok = PreTrainedTokenizerFast(
tokenizer_file=hf_hub_download(repo, "tokenizer.json"),
eos_token="</s>", unk_token="<unk>", pad_token="<pad>",
)
model = AutoModelForSeq2SeqLM.from_pretrained(repo).eval()
def fix(text):
enc = tok("popravi: " + text, return_tensors="pt", truncation=True, max_length=128)
out = model.generate(**enc, max_new_tokens=160, num_beams=5, early_stopping=True)
return tok.decode(out[0], skip_special_tokens=True)
print(fix("spremljati raven krvnega glukoze")) # -> ... krvne glukoze
Note:
cjvt/t5-sl-small's T5 slow tokenizer fails to load under recent transformers; load the fasttokenizer.jsonviaPreTrainedTokenizerFastas shown.
License
Inherits the base model's license (cjvt/t5-sl-small, CC BY-SA 4.0). Training
text is from EMEA (public) and Europarl (public) via OPUS. Attribute those
sources.
Citation
Cite this work (Tadej Fius, MediaAtlas Ltd):
@misc{fius2026gec,
title = {t5-sl-medical-gec: Slovenian Medical GEC},
author = {Fius, Tadej},
year = {2026},
publisher = {MediaAtlas Ltd},
howpublished = {Hugging Face},
url = {https://huggingface.co/texdata/t5-sl-medical-gec}
}
Upstream / source citations:
@misc{slot5, title={t5-sl-small}, author={{CJVT}}, url={https://huggingface.co/cjvt/t5-sl-small}}
@article{raffel2020t5, title={Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer}, author={Raffel, Colin and others}, journal={JMLR}, volume={21}, year={2020}}
Fine-tune of cjvt/t5-sl-small (Slovene T5). Cite the base + T5.
- Downloads last month
- 691
Model tree for texdata/t5-sl-medical-gec
Base model
cjvt/t5-sl-small