How to use from
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 "ynanxiu/minicpm5-coffee-lora" \
    --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": "ynanxiu/minicpm5-coffee-lora",
		"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 "ynanxiu/minicpm5-coffee-lora" \
        --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": "ynanxiu/minicpm5-coffee-lora",
		"messages": [
			{
				"role": "user",
				"content": "What is the capital of France?"
			}
		]
	}'
Quick Links

MiniCPM5-1B Coffee LoRA

Base model: openbmb/MiniCPM5-1B

This LoRA adapter fine-tunes MiniCPM5-1B for specialty coffee knowledge Q&A. Trained on ynanxiu/coffee-sft-dataset.

Training

  • Method: LoRA (r=16, alpha=32), BF16
  • Data: coffee-sft-dataset (80/10/10 train/val/test split)
  • Epochs: 3
  • Hardware: RTX 4060 8GB
  • Framework: TRL SFTTrainer + PEFT

Usage

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base = AutoModelForCausalLM.from_pretrained(
    "openbmb/MiniCPM5-1B",
    torch_dtype="auto",
    device_map="auto",
    trust_remote_code=True
)
model = PeftModel.from_pretrained(base, "ynanxiu/minicpm5-coffee-lora")
tokenizer = AutoTokenizer.from_pretrained("openbmb/MiniCPM5-1B", trust_remote_code=True)

messages = [{"role": "user", "content": "阿拉比卡和罗布斯塔的区别是什么?"}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Framework versions

  • PEFT 0.19.1
  • TRL 0.24.0
  • Transformers 5.5.0
  • PyTorch 2.6.0+cu124
Downloads last month
18
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ynanxiu/minicpm5-coffee-lora

Adapter
(18)
this model

Space using ynanxiu/minicpm5-coffee-lora 1