Instructions to use TilQazyna/Til-mini-1B-GEC with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TilQazyna/Til-mini-1B-GEC with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TilQazyna/Til-mini-1B-GEC") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TilQazyna/Til-mini-1B-GEC") model = AutoModelForCausalLM.from_pretrained("TilQazyna/Til-mini-1B-GEC") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TilQazyna/Til-mini-1B-GEC with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TilQazyna/Til-mini-1B-GEC" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TilQazyna/Til-mini-1B-GEC", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TilQazyna/Til-mini-1B-GEC
- SGLang
How to use TilQazyna/Til-mini-1B-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 "TilQazyna/Til-mini-1B-GEC" \ --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": "TilQazyna/Til-mini-1B-GEC", "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 "TilQazyna/Til-mini-1B-GEC" \ --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": "TilQazyna/Til-mini-1B-GEC", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use TilQazyna/Til-mini-1B-GEC with Docker Model Runner:
docker model run hf.co/TilQazyna/Til-mini-1B-GEC
Til-mini-1B-GEC
Til-mini-1B-GEC — қазақ мәтініндегі грамматикалық, орфографиялық және пунктуациялық қателерді түзететін модель. Til-mini-1B base-моделінің жеңіл fine-tune нұсқасы.
Til-mini-1B-GEC is a Kazakh grammatical-error-correction model: a light instruction fine-tune of the Til-mini-1B base model. Given a Kazakh sentence with spelling, grammar or punctuation errors, it returns a corrected version.
What it fixes
- Kazakh-specific letter confusions:
жанбыр → жаңбыр,кызыкты → қызық(ты),окыдым → оқыдым,бул → бұл - Capitalization at sentence start
- Missing end-of-sentence punctuation
- Common agreement/spelling slips in informal text
Model details
| Base | TilQazyna/Til-mini-1B (956.3M, dense + MLA) |
| Fine-tune format | ChatML (`< |
| Loss | assistant tokens only |
| Data | Kazakh GEC pairs: organic social-media sentences + synthetic errors (~900 pairs) |
| Epochs / LR | 5 / 1e-5 (cosine), bf16 |
| Context | 2048 |
The training instruction (fixed, Kazakh):
Мәтіндегі грамматикалық, орфографиялық және пунктуациялық қателерді түзет. Тек түзетілген мәтінді қайтар.
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "TilQazyna/Til-mini-1B-GEC"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, device_map="auto")
INSTR = ("Мәтіндегі грамматикалық, орфографиялық және пунктуациялық қателерді түзет. "
"Тек түзетілген мәтінді қайтар.")
def correct(text: str) -> str:
msgs = [{"role": "user", "content": f"{INSTR}\n\nМәтін: {text}"}]
prompt = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
ids = tok(prompt, return_tensors="pt", add_special_tokens=False).input_ids.to(model.device)
out = model.generate(ids, max_new_tokens=128, do_sample=False, pad_token_id=0,
eos_token_id=tok.convert_tokens_to_ids("<|im_end|>"))
text_out = tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True)
# The model may continue after the corrected sentence — keep the first line/sentence.
return text_out.strip().split("\n")[0].strip()
print(correct("Алматыда ауа райы жақсы болды кеше жанбыр жауды"))
# → Алматыда ауа райы жақсы болды кеше жаңбыр жауды.
Real examples (greedy decoding):
| Input | Output (first sentence) |
|---|---|
мен мектепке барамын деп айтты ол кеше |
Мен мектепке барамын деп айтты ол кеше. |
Алматыда ауа райы жақсы болды кеше жанбыр жауды |
Алматыда ауа райы жақсы болды кеше жаңбыр жауды. |
бул кітап өте кызыкты екен мен оны окыдым |
Кітап өте қызық екен мен оны оқыдым. |
Intended use & limitations
- Intended: correcting single sentences or short paragraphs of informal Kazakh text.
- Stopping: the fine-tune corpus is small (~900 pairs), so the model does not
always emit
<|im_end|>reliably and may repeat the corrected sentence — always post-process to the first line/sentence as in the snippet above. Long multi-sentence inputs are best corrected sentence-by-sentence. - The model may occasionally rephrase rather than minimally correct.
- Not a style checker and not a translator; Kazakh only.
- No safety alignment has been applied.
License
Apache 2.0. Access is gated (manual approval) for usage tracking.
- Downloads last month
- -
Model tree for TilQazyna/Til-mini-1B-GEC
Base model
TilQazyna/Til-mini-1B