Instructions to use ynanxiu/minicpm5-coffee-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ynanxiu/minicpm5-coffee-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("openbmb/MiniCPM5-1B") model = PeftModel.from_pretrained(base_model, "ynanxiu/minicpm5-coffee-lora") - Transformers
How to use ynanxiu/minicpm5-coffee-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ynanxiu/minicpm5-coffee-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ynanxiu/minicpm5-coffee-lora", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ynanxiu/minicpm5-coffee-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ynanxiu/minicpm5-coffee-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/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
docker model run hf.co/ynanxiu/minicpm5-coffee-lora
- SGLang
How to use ynanxiu/minicpm5-coffee-lora 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 "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?" } ] }' - Docker Model Runner
How to use ynanxiu/minicpm5-coffee-lora with Docker Model Runner:
docker model run hf.co/ynanxiu/minicpm5-coffee-lora
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
- 13
Model tree for ynanxiu/minicpm5-coffee-lora
Base model
openbmb/MiniCPM5-1B