Text Generation
Transformers
Safetensors
Chinese
qwen2
qwen
base-model
pretrained
chinese
from-scratch
conversational
text-generation-inference
Instructions to use flylcw/seq_monkey_pretrain_base_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_base_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_base_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_base_1.5B") model = AutoModelForCausalLM.from_pretrained("flylcw/seq_monkey_pretrain_base_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_base_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_base_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_base_1.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/flylcw/seq_monkey_pretrain_base_1.5B
- SGLang
How to use flylcw/seq_monkey_pretrain_base_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_base_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_base_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_base_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_base_1.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use flylcw/seq_monkey_pretrain_base_1.5B with Docker Model Runner:
docker model run hf.co/flylcw/seq_monkey_pretrain_base_1.5B
| license: mit | |
| library_name: transformers | |
| language: | |
| - zh | |
| tags: | |
| - qwen2 | |
| - qwen | |
| - base-model | |
| - pretrained | |
| - chinese | |
| - from-scratch | |
| datasets: | |
| - ddzhu123/seq-monkey | |
| # seq_monkey_pretrain_base_1.5B(中文 Base 预训练模型) | |
| 基于 **Qwen2.5-1.5B 架构**、在出门问问「序列猴子」中文通用语料上 **from-scratch(随机初始化)预训练** 的中文 Base 模型。本模型为 **Base(续写)模型,未经指令微调**,适合下游继续预训练 / SFT,或直接做文本续写。 | |
| ## 模型结构 | |
| | 项目 | 值 | | |
| |---|---| | |
| | 架构 | Qwen2ForCausalLM(Decoder-only,LLaMA 同族) | | |
| | 参数量 | 1.5B 级(含 15 万词表 embedding,HF 统计约 2B) | | |
| | hidden_size | 1536 | | |
| | num_hidden_layers | 28 | | |
| | num_attention_heads | 12 | | |
| | num_key_value_heads | 2(GQA) | | |
| | intermediate_size | 8960 | | |
| | vocab_size | 151936 | | |
| | max_position_embeddings | 131072 | | |
| | 激活函数 | SiLU(SwiGLU) | | |
| | 归一化 | RMSNorm(eps=1e-6) | | |
| | 位置编码 | RoPE | | |
| | 精度 | BF16 | | |
| ## 预训练细节 | |
| - **训练方式**:from-scratch 随机初始化(非加载官方权重),Causal LM | |
| - **训练数据**:[ddzhu123/seq-monkey](https://www.modelscope.cn/datasets/ddzhu123/seq-monkey) 的 `mobvoi_seq_monkey_general_open_corpus`——序列猴子中文通用文本语料,约 **1300 万份**中文文本,来源涵盖网页、百科、书籍等,许可 Apache-2.0 | |
| - **分词器**:Qwen2.5 Tokenizer(vocab 151936) | |
| - **序列长度**:block_size = 1024 | |
| - **优化**:bf16 + DeepSpeed ZeRO-2,8×NVIDIA A800-40G | |
| - **学习率**:2e-4,warmup + cosine | |
| - **训练规模**:1 epoch | |
| - **收敛情况**:loss 从 ~12(≈ln(151936),随机初始化理论起点)平滑收敛至 ~3.x,grad_norm 稳定 | |
| ## 快速开始(Base = 续写,不用 chat template) | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| import torch | |
| name = "flylcw/seq_monkey_pretrain_base_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) | |
| prompt = "人工智能正在改变" | |
| ids = tok(prompt, return_tensors="pt").to(model.device) | |
| out = model.generate(**ids, max_new_tokens=128, do_sample=True, | |
| temperature=0.7, top_p=0.9, repetition_penalty=1.1) | |
| print(tok.decode(out[0], skip_special_tokens=True)) |