Views
No views yet
train split of richarddzh/chinese-small-lm-corpus. The dataset is shuffled with seed 42, after which 10,000 documents are reserved for validation and the remaining documents are used for training.<|endoftext|>.<|endoftext|>, <unk>, <|im_start|>, and <|im_end|>. The tokenizer supports sequences up to 1,024 tokens, while pretraining uses 512-token sequences.| Parameter | Value |
|---|---|
| Architecture | Qwen3ForCausalLM |
| Parameters | 29,567,616 |
| Vocabulary size | 8,192 |
| Hidden size | 512 |
| Transformer layers | 9 |
| Attention heads | 8 |
| Key/value heads | 2 (GQA) |
| Head dimension | 64 |
| MLP intermediate size | 1,408 |
| Maximum position embeddings | 1,024 |
| RoPE theta | 1,000,000 |
| Tied input/output embeddings | Yes |
Trainer, packed iterable datasets, mixed precision when supported, gradient accumulation, periodic validation, and checkpoint-based resume.| Parameter | Value |
|---|---|
| Optimizer | AdamW (adamw_torch_fused on CUDA) |
| Maximum optimizer steps | 30,000 |
| Sequence length | 512 |
| Micro-batch size | 32 sequences/device |
| Gradient accumulation | 2 steps |
| Effective batch size | 64 sequences / 32,768 tokens |
| Learning rate | 5e-4 |
| Scheduler | Cosine |
| Warmup steps | 200 |
| Weight decay | 0.1 |
| Adam betas | (0.9, 0.95) |
| Gradient clipping | 1.0 |
| Precision | BF16 when supported; otherwise FP16 on CUDA or FP32 on CPU |
| Evaluation interval | 250 steps |
| Checkpoint interval | 250 steps |
| Random seed | 42 |
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4repo_id = "richarddzh/tiny-qwen3-30m-zh"
5tokenizer = AutoTokenizer.from_pretrained(repo_id)
6model = AutoModelForCausalLM.from_pretrained(repo_id)
7
8prompt = "问题:太阳是地球的什么?回答:太阳是"
9inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
10
11with torch.no_grad():
12 output = model.generate(
13 **inputs,
14 max_new_tokens=80,
15 do_sample=True,
16 temperature=0.8,
17 top_p=0.9,
18 repetition_penalty=1.1,
19 pad_token_id=tokenizer.eos_token_id,
20 )
21
22print(tokenizer.decode(output[0], skip_special_tokens=True))