Views
No views yet
| Parameter | Value |
|---|---|
| Base model | LiquidAI/LFM2.5-1.2B-Instruct |
| Dataset | HuggingFaceTB/smoltalk (5k examples) |
| Rank (r) | 8 |
| Alpha | 16 |
| Dropout | 0.1 |
| Learning rate | 5e-5 |
| Epochs | 1 |
| Batch size | 1 |
q_proj, k_proj, v_proj, out_proj]w1, w2, w3]in_proj, out_proj]1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3import torch
4
5MODEL_ID = "LiquidAI/LFM2.5-1.2B-Instruct"
6LORA_ID = "LiquidAI/LFM2.5-1.2B-Instruct-smoltalk-LoRA"
7
8tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
9base_model = AutoModelForCausalLM.from_pretrained(
10 MODEL_ID,
11 torch_dtype=torch.bfloat16,
12 device_map="auto",
13 trust_remote_code=True,
14)
15
16prompt = "What are some ideas for a good short story about a city not on a planet, but rather a generation ship, or on the moon of a gas giant, or somewhere else unusual?"
17messages = [{"role": "user", "content": prompt}]
18input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
19inputs = tokenizer(input_text, return_tensors="pt").to(base_model.device)
20
21# Generate with base model (no LoRA)
22with torch.no_grad():
23 outputs = base_model.generate(**inputs, max_new_tokens=100, do_sample=False)
24print("Base:", tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
25
26# Load LoRA and generate
27lora_model = PeftModel.from_pretrained(base_model, LORA_ID)
28with torch.no_grad():
29 outputs = lora_model.generate(**inputs, max_new_tokens=100, do_sample=False)
30print("LoRA:", tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))do_sample=False), base and LoRA models produce different outputs:| Model | Output (first 100 chars) |
|---|---|
| Base | What a fascinating concept! A city on a generation ship, a moon orbiting a gas g... |
| LoRA | Imagine a city on a generation ship hurtling through the vast expanse of space, ... |
1vllm serve LiquidAI/LFM2.5-1.2B-Instruct \
2 --host 0.0.0.0 \
3 --port 30000 \
4 --dtype float16 \
5 --enable-lora \
6 --max-lora-rank 8 \
7 --lora-modules "smoltalk=LiquidAI/LFM2.5-1.2B-Instruct-smoltalk-LoRA"model field to the LoRA adapter name (smoltalk):1curl -s http://localhost:30000/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{
4 "model": "smoltalk",
5 "messages": [{"role": "user", "content": "What are some ideas for a good short story about a city not on a planet, but rather a generation ship, or on the moon of a gas giant, or somewhere else unusual?"}],
6 "max_tokens": 100,
7 "temperature": 0.0
8 }'1curl -s http://localhost:30000/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{
4 "model": "LiquidAI/LFM2.5-1.2B-Instruct",
5 "messages": [{"role": "user", "content": "What are some ideas for a good short story about a city not on a planet, but rather a generation ship, or on the moon of a gas giant, or somewhere else unusual?"}],
6 "max_tokens": 100,
7 "temperature": 0.0
8 }'1python -m sglang.launch_server \
2 --model-path LiquidAI/LFM2.5-1.2B-Instruct \
3 --port 30000 \
4 --enable-lora \
5 --max-lora-rank 8 \
6 --lora-paths "smoltalk=LiquidAI/LFM2.5-1.2B-Instruct-smoltalk-LoRA" \
7 --lora-target-modules q_proj k_proj v_proj out_proj w1 w2 w3 in_projlora_path parameter1curl -s http://localhost:30000/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{
4 "model": "LiquidAI/LFM2.5-1.2B-Instruct",
5 "lora_path": "smoltalk",
6 "messages": [{"role": "user", "content": "What are some ideas for a good short story about a city not on a planet, but rather a generation ship, or on the moon of a gas giant, or somewhere else unusual?"}],
7 "max_tokens": 100,
8 "temperature": 0.0
9 }'1curl -s http://localhost:30000/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{
4 "model": "LiquidAI/LFM2.5-1.2B-Instruct:smoltalk",
5 "messages": [{"role": "user", "content": "What are some ideas for a good short story about a city not on a planet, but rather a generation ship, or on the moon of a gas giant, or somewhere else unusual?"}],
6 "max_tokens": 100,
7 "temperature": 0.0
8 }'1curl -s http://localhost:30000/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{
4 "model": "LiquidAI/LFM2.5-1.2B-Instruct",
5 "messages": [{"role": "user", "content": "What are some ideas for a good short story about a city not on a planet, but rather a generation ship, or on the moon of a gas giant, or somewhere else unusual?"}],
6 "max_tokens": 100,
7 "temperature": 0.0
8 }'