llm001 L05 sft: 1 epoch
Browse files- README.md +45 -0
- chat_template.jinja +8 -0
- config.json +44 -0
- generation_config.json +12 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +12 -0
- training_args.bin +3 -0
README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: complexly/olmo3-190m-zh-sft
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
language:
|
| 5 |
+
- zh
|
| 6 |
+
tags:
|
| 7 |
+
- llm001
|
| 8 |
+
- olmo3
|
| 9 |
+
- chinese
|
| 10 |
+
- sft
|
| 11 |
+
- supervised-finetuning
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# complexly/olmo3-190m-zh-sft
|
| 15 |
+
|
| 16 |
+
SFT(有监督微调)版本:基于complexly/olmo3-190m-zh-continue,
|
| 17 |
+
使用对话格式数据进行微调,学习指令遵循能力。
|
| 18 |
+
|
| 19 |
+
## 数据来源
|
| 20 |
+
- 训练数据:cmz1024/llm101-olmo3-zh-demo-data
|
| 21 |
+
- 子路径:sft/sft_t2t_mini.jsonl
|
| 22 |
+
|
| 23 |
+
## 训练配置
|
| 24 |
+
- Learning Rate:5.0e-5
|
| 25 |
+
- Warmup:5%
|
| 26 |
+
- Epochs:1 epoch
|
| 27 |
+
- Max Seq Length:2048
|
| 28 |
+
- 使用 assistant_only_loss(仅对 assistant 部分计算 loss)
|
| 29 |
+
- per_device_train_batch_size: 24
|
| 30 |
+
- packing: true
|
| 31 |
+
|
| 32 |
+
## 用法
|
| 33 |
+
```python
|
| 34 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 35 |
+
from transformers import pipeline
|
| 36 |
+
|
| 37 |
+
model = AutoModelForCausalLM.from_pretrained("{target_repo}")
|
| 38 |
+
tok = AutoTokenizer.from_pretrained("{target_repo}")
|
| 39 |
+
|
| 40 |
+
# 使用 chat template
|
| 41 |
+
messages = [{{"role": "user", "content": "你好,请介绍一下北京"}}]
|
| 42 |
+
inputs = tok.apply_chat_template(messages, return_tensors="pt")
|
| 43 |
+
outputs = model.generate(inputs, max_new_tokens=200)
|
| 44 |
+
print(tok.decode(outputs[0]))
|
| 45 |
+
```
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% for message in messages %}{% if message['role'] == 'system' %}<|im_start|>system
|
| 2 |
+
{{ message['content'] }}<|im_end|>
|
| 3 |
+
{% elif message['role'] == 'user' %}<|im_start|>user
|
| 4 |
+
{{ message['content'] }}<|im_end|>
|
| 5 |
+
{% elif message['role'] == 'assistant' %}{% generation %}<|im_start|>assistant
|
| 6 |
+
{{ message['content'] }}<|im_end|>
|
| 7 |
+
{% endgeneration %}{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
|
| 8 |
+
{% endif %}
|
config.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Olmo3ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 2,
|
| 8 |
+
"dtype": "bfloat16",
|
| 9 |
+
"eos_token_id": 0,
|
| 10 |
+
"hidden_act": "silu",
|
| 11 |
+
"hidden_size": 768,
|
| 12 |
+
"initializer_range": 0.02,
|
| 13 |
+
"intermediate_size": 3072,
|
| 14 |
+
"layer_types": [
|
| 15 |
+
"sliding_attention",
|
| 16 |
+
"sliding_attention",
|
| 17 |
+
"sliding_attention",
|
| 18 |
+
"full_attention",
|
| 19 |
+
"sliding_attention",
|
| 20 |
+
"sliding_attention",
|
| 21 |
+
"sliding_attention",
|
| 22 |
+
"full_attention",
|
| 23 |
+
"sliding_attention",
|
| 24 |
+
"sliding_attention",
|
| 25 |
+
"sliding_attention",
|
| 26 |
+
"full_attention"
|
| 27 |
+
],
|
| 28 |
+
"max_position_embeddings": 4096,
|
| 29 |
+
"model_type": "olmo3",
|
| 30 |
+
"num_attention_heads": 12,
|
| 31 |
+
"num_hidden_layers": 12,
|
| 32 |
+
"num_key_value_heads": 12,
|
| 33 |
+
"pad_token_id": 1,
|
| 34 |
+
"rms_norm_eps": 1e-06,
|
| 35 |
+
"rope_parameters": {
|
| 36 |
+
"rope_theta": 500000,
|
| 37 |
+
"rope_type": "default"
|
| 38 |
+
},
|
| 39 |
+
"sliding_window": 4096,
|
| 40 |
+
"tie_word_embeddings": false,
|
| 41 |
+
"transformers_version": "5.8.0",
|
| 42 |
+
"use_cache": false,
|
| 43 |
+
"vocab_size": 48000
|
| 44 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 2,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
0
|
| 6 |
+
],
|
| 7 |
+
"output_attentions": false,
|
| 8 |
+
"output_hidden_states": false,
|
| 9 |
+
"pad_token_id": 1,
|
| 10 |
+
"transformers_version": "5.8.0",
|
| 11 |
+
"use_cache": true
|
| 12 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f162dc3cf093bc380f15f1ea8269a2bae56e7f46b045eb562d8732baa7355263
|
| 3 |
+
size 374038864
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"bos_token": "<|bos|>",
|
| 4 |
+
"clean_up_tokenization_spaces": false,
|
| 5 |
+
"eos_token": "<|endoftext|>",
|
| 6 |
+
"is_local": true,
|
| 7 |
+
"local_files_only": false,
|
| 8 |
+
"model_max_length": 4096,
|
| 9 |
+
"pad_token": "<|pad|>",
|
| 10 |
+
"tokenizer_class": "TokenizersBackend",
|
| 11 |
+
"unk_token": "<|unk|>"
|
| 12 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:32bc6ed63d160c7ed3e2c867b671df53859981927aaa07bea1a5511b33a791aa
|
| 3 |
+
size 5368
|