Compare commits
8 Commits
23dd4c2fa8
...
0897641b9f
| Author | SHA1 | Date |
|---|---|---|
|
|
0897641b9f | |
|
|
6fc918beb6 | |
|
|
4bd6062ead | |
|
|
4d7a74acab | |
|
|
77946fda00 | |
|
|
fc585a9bf9 | |
|
|
c3199c7240 | |
|
|
56d4cddfd8 |
|
|
@ -1599,6 +1599,15 @@ MiniMind 的数据规模远小于表中其他模型,且训练比例偏向中
|
||||||
| [SmolLM2-135M](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct) | HuggingFace | 135M | 24.44 / 24.71 | 58.50 / 68.17 / 32.80 / 43.15 / 39.46 |
|
| [SmolLM2-135M](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct) | HuggingFace | 135M | 24.44 / 24.71 | 58.50 / 68.17 / 32.80 / 43.15 / 39.46 |
|
||||||
| [Aquila-135M](https://huggingface.co/BAAI/Aquila-135M-Instruct) | BAAI | 135M | 25.19 / 25.10 | 54.59 / 67.52 / 34.40 / 41.67 / 39.66 |
|
| [Aquila-135M](https://huggingface.co/BAAI/Aquila-135M-Instruct) | BAAI | 135M | 25.19 / 25.10 | 54.59 / 67.52 / 34.40 / 41.67 / 39.66 |
|
||||||
|
|
||||||
|
> **这张表的分辨率**:`lm_eval` 对每个指标都会同时输出一个 `stderr`,它主要由测试集大小决定,因此下面的数值对表中所有模型都近似适用(随准确率略有浮动):
|
||||||
|
>
|
||||||
|
> | 数据集 | obqa | ceval | piqa | siqa | arc | hellaswag | cmmlu |
|
||||||
|
> |---|---|---|---|---|---|---|---|
|
||||||
|
> | 样本量 | 500 | ~1.3k | 1838 | 1954 | 2376 | 10042 | 11582 |
|
||||||
|
> | ± 标准误 | **1.9** | 1.2 | 1.2 | 1.1 | 0.9 | 0.5 | **0.4** |
|
||||||
|
>
|
||||||
|
> 比较两个模型时,差值的标准误约为单项的 `√2` 倍。因此 obqa 上小于约 5 个百分点、ceval / piqa / siqa 上小于约 3 个百分点的差异,都不足以区分两个模型——这也解释了为什么本表中同一量级的模型排序不宜过度解读。
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><strong>补充说明(来源/无污染/复现)</strong></summary>
|
<summary><strong>补充说明(来源/无污染/复现)</strong></summary>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1597,6 +1597,15 @@ MiniMind is trained on far less data than the other models listed here, and its
|
||||||
| [SmolLM2-135M](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct) | HuggingFace | 135M | 24.44 / 24.71 | 58.50 / 68.17 / 32.80 / 43.15 / 39.46 |
|
| [SmolLM2-135M](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct) | HuggingFace | 135M | 24.44 / 24.71 | 58.50 / 68.17 / 32.80 / 43.15 / 39.46 |
|
||||||
| [Aquila-135M](https://huggingface.co/BAAI/Aquila-135M-Instruct) | BAAI | 135M | 25.19 / 25.10 | 54.59 / 67.52 / 34.40 / 41.67 / 39.66 |
|
| [Aquila-135M](https://huggingface.co/BAAI/Aquila-135M-Instruct) | BAAI | 135M | 25.19 / 25.10 | 54.59 / 67.52 / 34.40 / 41.67 / 39.66 |
|
||||||
|
|
||||||
|
> **The resolution of this table**: `lm_eval` reports a `stderr` alongside every metric. It is set mainly by the size of the test set, so the values below apply approximately to every model in the table (they shift slightly with accuracy):
|
||||||
|
>
|
||||||
|
> | dataset | obqa | ceval | piqa | siqa | arc | hellaswag | cmmlu |
|
||||||
|
> |---|---|---|---|---|---|---|---|
|
||||||
|
> | samples | 500 | ~1.3k | 1838 | 1954 | 2376 | 10042 | 11582 |
|
||||||
|
> | ± stderr | **1.9** | 1.2 | 1.2 | 1.1 | 0.9 | 0.5 | **0.4** |
|
||||||
|
>
|
||||||
|
> When comparing two models, the standard error of the difference is about `√2` times the single-model value. So a gap smaller than roughly 5 points on obqa, or roughly 3 points on ceval / piqa / siqa, does not separate two models — which is why the ordering of similarly-sized models in this table should not be over-read.
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><strong>Additional note (source / no contamination / reproduction)</strong></summary>
|
<summary><strong>Additional note (source / no contamination / reproduction)</strong></summary>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,12 @@ def pre_processing_chat(conversations, add_system_ratio=0.2):
|
||||||
return [{'role': 'system', 'content': random.choice(SYSTEM_PROMPTS)}] + conversations
|
return [{'role': 'system', 'content': random.choice(SYSTEM_PROMPTS)}] + conversations
|
||||||
return conversations
|
return conversations
|
||||||
|
|
||||||
def post_processing_chat(prompt_content, empty_think_ratio=0.2):
|
def post_processing_chat(prompt_content, empty_think_ratio=0.2, remove_empty_think=None):
|
||||||
# 以80%概率移除空思考标签
|
# 以80%概率移除空思考标签
|
||||||
if '<think>\n\n</think>\n\n' in prompt_content and random.random() > empty_think_ratio:
|
if '<think>\n\n</think>\n\n' in prompt_content:
|
||||||
|
if remove_empty_think is None:
|
||||||
|
remove_empty_think = random.random() > empty_think_ratio
|
||||||
|
if remove_empty_think:
|
||||||
prompt_content = prompt_content.replace('<think>\n\n</think>\n\n', '')
|
prompt_content = prompt_content.replace('<think>\n\n</think>\n\n', '')
|
||||||
return prompt_content
|
return prompt_content
|
||||||
|
|
||||||
|
|
@ -139,12 +142,13 @@ class DPODataset(Dataset):
|
||||||
chosen_prompt = self.tokenizer.apply_chat_template(
|
chosen_prompt = self.tokenizer.apply_chat_template(
|
||||||
chosen, tokenize=False, add_generation_prompt=False
|
chosen, tokenize=False, add_generation_prompt=False
|
||||||
)
|
)
|
||||||
chosen_prompt = post_processing_chat(chosen_prompt)
|
|
||||||
|
|
||||||
rejected_prompt = self.tokenizer.apply_chat_template(
|
rejected_prompt = self.tokenizer.apply_chat_template(
|
||||||
rejected, tokenize=False, add_generation_prompt=False
|
rejected, tokenize=False, add_generation_prompt=False
|
||||||
)
|
)
|
||||||
rejected_prompt = post_processing_chat(rejected_prompt)
|
remove_empty_think = random.random() > 0.2
|
||||||
|
chosen_prompt = post_processing_chat(chosen_prompt, remove_empty_think=remove_empty_think)
|
||||||
|
rejected_prompt = post_processing_chat(rejected_prompt, remove_empty_think=remove_empty_think)
|
||||||
chosen_encoding = self.tokenizer(
|
chosen_encoding = self.tokenizer(
|
||||||
chosen_prompt, truncation=True, max_length=self.max_length, padding='max_length'
|
chosen_prompt, truncation=True, max_length=self.max_length, padding='max_length'
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ if __name__ == "__main__":
|
||||||
parser.add_argument('--num_hidden_layers', default=8, type=int, help="隐藏层数量")
|
parser.add_argument('--num_hidden_layers', default=8, type=int, help="隐藏层数量")
|
||||||
parser.add_argument('--max_seq_len', default=768, type=int, help="训练的最大截断长度(中文1token≈1.5~1.7字符)")
|
parser.add_argument('--max_seq_len', default=768, type=int, help="训练的最大截断长度(中文1token≈1.5~1.7字符)")
|
||||||
parser.add_argument('--use_moe', default=0, type=int, choices=[0, 1], help="是否使用MoE架构(0=否,1=是)")
|
parser.add_argument('--use_moe', default=0, type=int, choices=[0, 1], help="是否使用MoE架构(0=否,1=是)")
|
||||||
|
parser.add_argument('--seed', default=42, type=int, help="随机种子(DDP下每个rank为seed+rank,每轮为seed+epoch)")
|
||||||
parser.add_argument("--data_path", type=str, default="../dataset/sft_t2t_mini.jsonl", help="训练数据路径")
|
parser.add_argument("--data_path", type=str, default="../dataset/sft_t2t_mini.jsonl", help="训练数据路径")
|
||||||
parser.add_argument('--from_weight', default='pretrain', type=str, help="基于哪个权重训练,为none则不基于任何权重训练")
|
parser.add_argument('--from_weight', default='pretrain', type=str, help="基于哪个权重训练,为none则不基于任何权重训练")
|
||||||
parser.add_argument('--from_resume', default=0, type=int, choices=[0, 1], help="是否自动检测&续训(0=否,1=是)")
|
parser.add_argument('--from_resume', default=0, type=int, choices=[0, 1], help="是否自动检测&续训(0=否,1=是)")
|
||||||
|
|
@ -110,7 +111,7 @@ if __name__ == "__main__":
|
||||||
# ========== 1. 初始化环境和随机种子 ==========
|
# ========== 1. 初始化环境和随机种子 ==========
|
||||||
local_rank = init_distributed_mode()
|
local_rank = init_distributed_mode()
|
||||||
if dist.is_initialized(): args.device = f"cuda:{local_rank}"
|
if dist.is_initialized(): args.device = f"cuda:{local_rank}"
|
||||||
setup_seed(42 + (dist.get_rank() if dist.is_initialized() else 0))
|
setup_seed(args.seed + (dist.get_rank() if dist.is_initialized() else 0))
|
||||||
|
|
||||||
# ========== 2. 配置目录、模型参数、检查ckp ==========
|
# ========== 2. 配置目录、模型参数、检查ckp ==========
|
||||||
os.makedirs(args.save_dir, exist_ok=True)
|
os.makedirs(args.save_dir, exist_ok=True)
|
||||||
|
|
@ -157,7 +158,7 @@ if __name__ == "__main__":
|
||||||
# ========== 8. 开始训练 ==========
|
# ========== 8. 开始训练 ==========
|
||||||
for epoch in range(start_epoch, args.epochs):
|
for epoch in range(start_epoch, args.epochs):
|
||||||
train_sampler and train_sampler.set_epoch(epoch)
|
train_sampler and train_sampler.set_epoch(epoch)
|
||||||
setup_seed(42 + epoch); indices = torch.randperm(len(train_ds)).tolist()
|
setup_seed(args.seed + epoch); indices = torch.randperm(len(train_ds)).tolist()
|
||||||
skip = start_step if (epoch == start_epoch and start_step > 0) else 0
|
skip = start_step if (epoch == start_epoch and start_step > 0) else 0
|
||||||
batch_sampler = SkipBatchSampler(train_sampler or indices, args.batch_size, skip)
|
batch_sampler = SkipBatchSampler(train_sampler or indices, args.batch_size, skip)
|
||||||
loader = DataLoader(train_ds, batch_sampler=batch_sampler, num_workers=args.num_workers, pin_memory=True)
|
loader = DataLoader(train_ds, batch_sampler=batch_sampler, num_workers=args.num_workers, pin_memory=True)
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ if __name__ == "__main__":
|
||||||
parser.add_argument('--num_hidden_layers', default=8, type=int, help="隐藏层数量")
|
parser.add_argument('--num_hidden_layers', default=8, type=int, help="隐藏层数量")
|
||||||
parser.add_argument('--max_seq_len', default=340, type=int, help="训练的最大截断长度(中文1token≈1.5~1.7字符)")
|
parser.add_argument('--max_seq_len', default=340, type=int, help="训练的最大截断长度(中文1token≈1.5~1.7字符)")
|
||||||
parser.add_argument('--use_moe', default=0, type=int, choices=[0, 1], help="是否使用MoE架构(0=否,1=是)")
|
parser.add_argument('--use_moe', default=0, type=int, choices=[0, 1], help="是否使用MoE架构(0=否,1=是)")
|
||||||
|
parser.add_argument('--seed', default=42, type=int, help="随机种子(DDP下每个rank为seed+rank,每轮为seed+epoch)")
|
||||||
parser.add_argument("--data_path", type=str, default="../dataset/pretrain_t2t_mini.jsonl", help="预训练数据路径")
|
parser.add_argument("--data_path", type=str, default="../dataset/pretrain_t2t_mini.jsonl", help="预训练数据路径")
|
||||||
parser.add_argument('--from_weight', default='none', type=str, help="基于哪个权重训练,为none则从头开始")
|
parser.add_argument('--from_weight', default='none', type=str, help="基于哪个权重训练,为none则从头开始")
|
||||||
parser.add_argument('--from_resume', default=0, type=int, choices=[0, 1], help="是否自动检测&续训(0=否,1=是)")
|
parser.add_argument('--from_resume', default=0, type=int, choices=[0, 1], help="是否自动检测&续训(0=否,1=是)")
|
||||||
|
|
@ -109,7 +110,7 @@ if __name__ == "__main__":
|
||||||
# ========== 1. 初始化环境和随机种子 ==========
|
# ========== 1. 初始化环境和随机种子 ==========
|
||||||
local_rank = init_distributed_mode()
|
local_rank = init_distributed_mode()
|
||||||
if dist.is_initialized(): args.device = f"cuda:{local_rank}"
|
if dist.is_initialized(): args.device = f"cuda:{local_rank}"
|
||||||
setup_seed(42 + (dist.get_rank() if dist.is_initialized() else 0))
|
setup_seed(args.seed + (dist.get_rank() if dist.is_initialized() else 0))
|
||||||
|
|
||||||
# ========== 2. 配置目录、模型参数、检查ckp ==========
|
# ========== 2. 配置目录、模型参数、检查ckp ==========
|
||||||
os.makedirs(args.save_dir, exist_ok=True)
|
os.makedirs(args.save_dir, exist_ok=True)
|
||||||
|
|
@ -156,7 +157,7 @@ if __name__ == "__main__":
|
||||||
# ========== 8. 开始训练 ==========
|
# ========== 8. 开始训练 ==========
|
||||||
for epoch in range(start_epoch, args.epochs):
|
for epoch in range(start_epoch, args.epochs):
|
||||||
train_sampler and train_sampler.set_epoch(epoch)
|
train_sampler and train_sampler.set_epoch(epoch)
|
||||||
setup_seed(42 + epoch); indices = torch.randperm(len(train_ds)).tolist()
|
setup_seed(args.seed + epoch); indices = torch.randperm(len(train_ds)).tolist()
|
||||||
skip = start_step if (epoch == start_epoch and start_step > 0) else 0
|
skip = start_step if (epoch == start_epoch and start_step > 0) else 0
|
||||||
batch_sampler = SkipBatchSampler(train_sampler or indices, args.batch_size, skip)
|
batch_sampler = SkipBatchSampler(train_sampler or indices, args.batch_size, skip)
|
||||||
loader = DataLoader(train_ds, batch_sampler=batch_sampler, num_workers=args.num_workers, pin_memory=True)
|
loader = DataLoader(train_ds, batch_sampler=batch_sampler, num_workers=args.num_workers, pin_memory=True)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue