Text Generation
Transformers
Safetensors
Chinese
qwen2
qwen
sft
instruction-tuning
chinese
chat
conversational
text-generation-inference
Instructions to use flylcw/seq_monkey_pretrain_sft_optimization_1.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use flylcw/seq_monkey_pretrain_sft_optimization_1.5B with vLLM:
Install from pip and serve model
# 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?" } ] }'Use Docker
docker model run hf.co/flylcw/seq_monkey_pretrain_sft_optimization_1.5B
- SGLang
How to use flylcw/seq_monkey_pretrain_sft_optimization_1.5B 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 "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?" } ] }'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 "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 Model Runner
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
File size: 2,647 Bytes
72b1f60 8dadef8 72b1f60 8dadef8 72b1f60 5c62793 72b1f60 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
---
license: mit
library_name: transformers
base_model:
- flylcw/seq_monkey_pretrain_base_1.5B
language:
- zh
tags:
- qwen2
- qwen
- sft
- instruction-tuning
- chinese
- chat
datasets:
- BelleGroup/train_3.5M_CN
- m-a-p/COIG-CQIA
---
# seq_monkey_pretrain_sft_optimization_1.5B(中文指令微调模型)
在 [seq_monkey_pretrain_base_1.5B](https://huggingface.co/flylcw/seq_monkey_pretrain_base_1.5B) 之上,经过 **两阶段全参 SFT** 得到的中文指令对话模型:第一阶段用 BelleGroup 通用指令数据建立指令跟随能力,第二阶段用 COIG-CQIA 高质量数据进一步对齐。
## 模型结构(与 Base 完全一致)
**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 |
## 两阶段 SFT 流程
| 阶段 | 数据 | 规模 | 学习率 | epoch | 目的 |
|---|---|---|---|---|---|
| 阶段一 | [BelleGroup/train_3.5M_CN](https://huggingface.co/datasets/BelleGroup/train_3.5M_CN) | 3.5M 中文指令 | 2e-5 | 3 | 建立通用指令跟随 |
| 阶段二 | [m-a-p/COIG-CQIA](https://huggingface.co/datasets/m-a-p/COIG-CQIA) | 数万条高质量中文指令 | 5e-6 | 3 | 高质量对齐、提升回答质量 |
- **训练方式**:全参 SFT(非 LoRA),Causal LM,仅对 assistant 回答部分计算 loss
- **对话模板**:Qwen ChatML(`<|im_start|> / <|im_end|>`)
- **序列长度**:1024
- **优化**:bf16,cosine 学习率调度
- **第二阶段说明**:在阶段一 checkpoint 基础上继续 SFT,学习率调小以防破坏已学能力
## 快速开始(对话)
```python
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))
|