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
|
| 4 |
+
base_model: Qwen/Qwen3-4B-Instruct-2507
|
| 5 |
+
tags:
|
| 6 |
+
- axolotl
|
| 7 |
+
- base_model:adapter:Qwen/Qwen3-4B-Instruct-2507
|
| 8 |
+
- lora
|
| 9 |
+
- transformers
|
| 10 |
+
datasets:
|
| 11 |
+
- custom
|
| 12 |
+
pipeline_tag: text-generation
|
| 13 |
+
model-index:
|
| 14 |
+
- name: checkpoints/0922
|
| 15 |
+
results: []
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
| 19 |
+
should probably proofread and complete it, then remove this comment. -->
|
| 20 |
+
|
| 21 |
+
[<img src="https://raw.githubusercontent.com/axolotl-ai-cloud/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/axolotl-ai-cloud/axolotl)
|
| 22 |
+
<details><summary>See axolotl config</summary>
|
| 23 |
+
|
| 24 |
+
axolotl version: `0.12.2`
|
| 25 |
+
```yaml
|
| 26 |
+
# Automatically upload checkpoint and final model to HF
|
| 27 |
+
# hub_model_id: username/custom_model_name
|
| 28 |
+
# 是否以 8-bit 精度加载模型
|
| 29 |
+
load_in_8bit: false
|
| 30 |
+
# 是否以 4-bit 精度加载模型(与QLoRA绑定, 强制使用)
|
| 31 |
+
load_in_4bit: false
|
| 32 |
+
# 是否严格匹配模型结构,关闭表示可加载少部分差异结构(如以适配 adapter)
|
| 33 |
+
# strict: false
|
| 34 |
+
base_model: Qwen/Qwen3-4B-Instruct-2507
|
| 35 |
+
# 数据集设置
|
| 36 |
+
chat_template: qwen3
|
| 37 |
+
datasets:
|
| 38 |
+
- path: /workspace/train_dir_0922/all_data.json # - 表示列表(list)中的一项, 即可以同时使用多个数据集
|
| 39 |
+
type: chat_template # chat_template(自定义格式) alpaca
|
| 40 |
+
roles_to_train: ["assistant"]
|
| 41 |
+
field_messages: messages # 标识的字段
|
| 42 |
+
message_property_mappings: # message_property_mappings={'role':'role', 'content':'content'})
|
| 43 |
+
role: role
|
| 44 |
+
content: content
|
| 45 |
+
dataset_prepared_path:
|
| 46 |
+
val_set_size: 0.05
|
| 47 |
+
output_dir: checkpoints/0922
|
| 48 |
+
sequence_len: 16384 # 模型所能处理的最大上下文长度(默认2048)
|
| 49 |
+
pad_to_sequence_len: true
|
| 50 |
+
# context_parallel_size: 2 # 长序列拆分至多个GPU(强制要求 mirco_batch_size: 1)
|
| 51 |
+
sample_packing: false # 在训练时将多个样本拼接(packing)成一个长序列(sequence_len)输入到模型中,以提高训练效率。
|
| 52 |
+
eval_sample_packing: false # 评估时拼接多个样本
|
| 53 |
+
# 训练超参数
|
| 54 |
+
adapter: lora # lora qlora
|
| 55 |
+
lora_model_dir:
|
| 56 |
+
lora_r: 16 # lora_r默认首选 16,平衡精度与显存
|
| 57 |
+
lora_alpha: 64 # 缩放系数,用于控制 LoRA 的影响力, 一般设为 2*r 或 4*r
|
| 58 |
+
lora_dropout: 0.05
|
| 59 |
+
lora_target_linear: true
|
| 60 |
+
micro_batch_size: 4 # 微批次大小 94G的H100可以设为4(Token为1w)
|
| 61 |
+
gradient_accumulation_steps: 2 # 梯度累积: 将多个微批次的梯度(micro_batch_size)累积起来,然后更新模型权重 有效 Batch 常取 16: 小于 8 训练会抖,大于 32 只会更耗时、收益有限
|
| 62 |
+
auto_find_batch_size: false # 允许Axolotl不断调整batch_size ⚠️Zero-3不适用
|
| 63 |
+
num_epochs: 1
|
| 64 |
+
optimizer: adamw_torch_fused
|
| 65 |
+
lr_scheduler: cosine
|
| 66 |
+
learning_rate: 4e-5
|
| 67 |
+
# bf16: auto + tf32: true,可获得更好的稳定性和性能。
|
| 68 |
+
bf16: auto
|
| 69 |
+
tf32: true
|
| 70 |
+
# early_stopping_patience:
|
| 71 |
+
gradient_checkpointing: true
|
| 72 |
+
gradient_checkpointing_kwargs:
|
| 73 |
+
use_reentrant: false
|
| 74 |
+
# auto_resume_from_checkpoints: true #自动从output_dir寻找最新checkpoint断点恢复
|
| 75 |
+
logging_steps: 1
|
| 76 |
+
flash_attention: true
|
| 77 |
+
warmup_steps: 10
|
| 78 |
+
evals_per_epoch: 4
|
| 79 |
+
saves_per_epoch: 1
|
| 80 |
+
weight_decay: 0.0
|
| 81 |
+
fsdp:
|
| 82 |
+
- full_shard
|
| 83 |
+
- auto_wrap
|
| 84 |
+
fsdp_config:
|
| 85 |
+
fsdp_limit_all_gathers: true
|
| 86 |
+
fsdp_sync_module_states: true
|
| 87 |
+
fsdp_offload_params: false # H200显存足够,无需offload
|
| 88 |
+
fsdp_use_orig_params: false
|
| 89 |
+
fsdp_cpu_ram_efficient_loading: true
|
| 90 |
+
fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
|
| 91 |
+
fsdp_transformer_layer_cls_to_wrap: Qwen3DecoderLayer
|
| 92 |
+
fsdp_state_dict_type: FULL_STATE_DICT
|
| 93 |
+
fsdp_sharding_strategy: FULL_SHARD
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
</details><br>
|
| 97 |
+
|
| 98 |
+
# checkpoints/0922
|
| 99 |
+
|
| 100 |
+
This model is a fine-tuned version of [Qwen/Qwen3-4B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507) on the /workspace/train_dir_0922/all_data.json dataset.
|
| 101 |
+
It achieves the following results on the evaluation set:
|
| 102 |
+
- Loss: 0.0465
|
| 103 |
+
- Memory/max Mem Active(gib): 128.99
|
| 104 |
+
- Memory/max Mem Allocated(gib): 128.8
|
| 105 |
+
- Memory/device Mem Reserved(gib): 130.32
|
| 106 |
+
|
| 107 |
+
## Model description
|
| 108 |
+
|
| 109 |
+
More information needed
|
| 110 |
+
|
| 111 |
+
## Intended uses & limitations
|
| 112 |
+
|
| 113 |
+
More information needed
|
| 114 |
+
|
| 115 |
+
## Training and evaluation data
|
| 116 |
+
|
| 117 |
+
More information needed
|
| 118 |
+
|
| 119 |
+
## Training procedure
|
| 120 |
+
|
| 121 |
+
### Training hyperparameters
|
| 122 |
+
|
| 123 |
+
The following hyperparameters were used during training:
|
| 124 |
+
- learning_rate: 4e-05
|
| 125 |
+
- train_batch_size: 4
|
| 126 |
+
- eval_batch_size: 4
|
| 127 |
+
- seed: 42
|
| 128 |
+
- distributed_type: multi-GPU
|
| 129 |
+
- num_devices: 4
|
| 130 |
+
- gradient_accumulation_steps: 2
|
| 131 |
+
- total_train_batch_size: 32
|
| 132 |
+
- total_eval_batch_size: 16
|
| 133 |
+
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
| 134 |
+
- lr_scheduler_type: cosine
|
| 135 |
+
- lr_scheduler_warmup_steps: 10
|
| 136 |
+
- training_steps: 1535
|
| 137 |
+
|
| 138 |
+
### Training results
|
| 139 |
+
|
| 140 |
+
| Training Loss | Epoch | Step | Validation Loss | Mem Active(gib) | Mem Allocated(gib) | Mem Reserved(gib) |
|
| 141 |
+
|:-------------:|:------:|:----:|:---------------:|:---------------:|:------------------:|:-----------------:|
|
| 142 |
+
| No log | 0 | 0 | 1.0664 | 98.27 | 98.07 | 99.57 |
|
| 143 |
+
| 0.0338 | 0.2502 | 384 | 0.0558 | 128.99 | 128.8 | 130.32 |
|
| 144 |
+
| 0.0662 | 0.5003 | 768 | 0.0498 | 128.99 | 128.8 | 130.32 |
|
| 145 |
+
| 0.0563 | 0.7505 | 1152 | 0.0465 | 128.99 | 128.8 | 130.32 |
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
### Framework versions
|
| 149 |
+
|
| 150 |
+
- PEFT 0.17.0
|
| 151 |
+
- Transformers 4.55.2
|
| 152 |
+
- Pytorch 2.6.0+cu126
|
| 153 |
+
- Datasets 4.0.0
|
| 154 |
+
- Tokenizers 0.21.4
|