m-a-p/COIG-CQIA
Viewer • Updated • 44.7k • 7.02k • 757
How to use flylcw/seq_monkey_pretrain_sft_optimization_1.5B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="flylcw/seq_monkey_pretrain_sft_optimization_1.5B")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("flylcw/seq_monkey_pretrain_sft_optimization_1.5B")
model = AutoModelForCausalLM.from_pretrained("flylcw/seq_monkey_pretrain_sft_optimization_1.5B", 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]:]))How to use flylcw/seq_monkey_pretrain_sft_optimization_1.5B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "flylcw/seq_monkey_pretrain_sft_optimization_1.5B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "flylcw/seq_monkey_pretrain_sft_optimization_1.5B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/flylcw/seq_monkey_pretrain_sft_optimization_1.5B
How to use flylcw/seq_monkey_pretrain_sft_optimization_1.5B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "flylcw/seq_monkey_pretrain_sft_optimization_1.5B" \
--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": "flylcw/seq_monkey_pretrain_sft_optimization_1.5B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "flylcw/seq_monkey_pretrain_sft_optimization_1.5B" \
--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": "flylcw/seq_monkey_pretrain_sft_optimization_1.5B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use flylcw/seq_monkey_pretrain_sft_optimization_1.5B with Docker Model Runner:
docker model run hf.co/flylcw/seq_monkey_pretrain_sft_optimization_1.5B
在 seq_monkey_pretrain_base_1.5B 之上,经过 两阶段全参 SFT 得到的中文指令对话模型:第一阶段用 BelleGroup 通用指令数据建立指令跟随能力,第二阶段用 COIG-CQIA 高质量数据进一步对齐。
SFT 仅更新权重,不改变模型架构,因此本模型的 config.json 与 Base 模型完全相同:
| 项目 | 值 |
|---|---|
| 架构 | Qwen2ForCausalLM |
| 参数量 | 1.5B 级(HF 统计约 2B) |
| hidden / layers / heads / kv_heads | 1536 / 28 / 12 / 2 |
| intermediate / vocab / max_pos | 8960 / 151936 / 131072 |
| 激活 / 归一化 / 位置编码 | SiLU(SwiGLU) / RMSNorm / RoPE |
| 阶段 | 数据 | 规模 | 学习率 | epoch | 目的 |
|---|---|---|---|---|---|
| 阶段一 | BelleGroup/train_3.5M_CN | 3.5M 中文指令 | 2e-5 | 3 | 建立通用指令跟随 |
| 阶段二 | m-a-p/COIG-CQIA | 数万条高质量中文指令 | 5e-6 | 3 | 高质量对齐、提升回答质量 |
<|im_start|> / <|im_end|>)from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
name = "flylcw/seq_monkey_pretrain_sft_optimization_1.5B"
tok = AutoTokenizer.from_pretrained(name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
name, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)
messages = [{"role": "user", "content": "用三句话介绍一下序列猴子数据集"}]
text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
ids = tok(text, return_tensors="pt").to(model.device)
out = model.generate(**ids, max_new_tokens=256, do_sample=True,
temperature=0.7, top_p=0.9, repetition_penalty=1.1)
print(tok.decode(out[0], skip_special_tokens=True))
Base model
flylcw/seq_monkey_pretrain_base_1.5B
docker model run hf.co/flylcw/seq_monkey_pretrain_sft_optimization_1.5B