Instructions to use luispoveda93/MiniCPM5-2B-catalan-chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use luispoveda93/MiniCPM5-2B-catalan-chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="luispoveda93/MiniCPM5-2B-catalan-chat") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("luispoveda93/MiniCPM5-2B-catalan-chat") model = AutoModelForCausalLM.from_pretrained("luispoveda93/MiniCPM5-2B-catalan-chat", device_map="auto") 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 luispoveda93/MiniCPM5-2B-catalan-chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "luispoveda93/MiniCPM5-2B-catalan-chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "luispoveda93/MiniCPM5-2B-catalan-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/luispoveda93/MiniCPM5-2B-catalan-chat
- SGLang
How to use luispoveda93/MiniCPM5-2B-catalan-chat 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 "luispoveda93/MiniCPM5-2B-catalan-chat" \ --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": "luispoveda93/MiniCPM5-2B-catalan-chat", "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 "luispoveda93/MiniCPM5-2B-catalan-chat" \ --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": "luispoveda93/MiniCPM5-2B-catalan-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use luispoveda93/MiniCPM5-2B-catalan-chat with Docker Model Runner:
docker model run hf.co/luispoveda93/MiniCPM5-2B-catalan-chat
MiniCPM5-2B-catalan-chat
A conversational Catalan chat model: LoRA fine-tune of openbmb/MiniCPM5-2B on the full projecte-aina/InstruCAT instruction dataset (165,100 samples, 11 task categories, ~43M tokens, 1 epoch).
Model Details
- Base model: openbmb/MiniCPM5-2B (2.5B params, Llama architecture, Apache-2.0)
- Fine-tuned on: projecte-aina/InstruCAT — Catalan instructions converted from caBreu, CatalanQA, CaWikiTC, ceil, CoqCat, GuiaCat, IntoxiCat, NLUCat, Parafraseja, PAWS-ca, sts-ca, teca and WikiCat
- Language: Catalan (ca-ES)
- Task: conversational instruction following
- License: base model Apache-2.0; training data CC-BY-NC-ND-4.0 (non-commercial) — check the InstruCAT license terms before commercial use
Training
| Setting | Value |
|---|---|
| Method | LoRA (r=32, α=64, dropout 0.05, all attention+MLP projections) |
| Trainer | TRL SFTTrainer v1.12.0, transformers 5.16.1, peft 0.20.0 |
| Prompt format | MiniCPM5 chat template; system prompt "Ets un assistent conversacional que respon sempre en català ."; completion-only loss on the assistant turn |
| Sequence length | 2048, packed |
| Effective batch | 32 (4 × grad-accum 8) |
| LR / schedule | 2e-4, cosine, 200 warmup steps |
| Steps / hardware | 711 steps (~19h) on 1× A10G 24GB, bf16 + gradient checkpointing |
Observed training curve (completion-only loss, every 10 steps): 2.39 → 1.48 (step 20) → 1.04 (step 30) → 0.45 (step 70) → ~0.35–0.40 at the end. Mean token accuracy reached **0.91–0.92** by the second half of the run. Eval on 1,000 held-out validation samples ran at step 500 without errors; metrics are on the trackio dashboard.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"luispoveda93/MiniCPM5-2B-catalan-chat",
dtype="bfloat16",
)
tok = AutoTokenizer.from_pretrained("luispoveda93/MiniCPM5-2B-catalan-chat")
messages = [{"role": "system", "content": "Ets un assistent conversacional que respon sempre en català ."},
{"role": "user", "content": "Explica'm què és la Sardana."}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
out = model.generate(inputs, max_new_tokens=256)
print(tok.decode(out[0][inputs.shape[1]:], skip_special_tokens=True))
The LoRA adapter alone is at luispoveda93/MiniCPM5-2B-catalan-chat-lora.
Limitations
- Trained on single-turn instruction data; no multi-turn Catalan conversations were used.
- InstruCAT is task-oriented (QA, paraphrase, NER, classification, summarization); general chit-chat behavior comes from the base model.
- Non-commercial data license applies to the fine-tuning dataset.
Citation
Please cite the InstruCAT dataset and Projecte AINA if you use this model:
- Dataset: projecte-aina/InstruCAT — Language Technologies Unit (langtech@bsc.es) at BSC, funded within project ILENIA (ref. 2022/TL22/00215337).
- Downloads last month
- 253