1from huggingface_hub import hf_hub_download
2
3# 下载推理权重
4model_path = hf_hub_download(
5 repo_id="swagger00/minimind-demo",
6 filename="full_sft_768.pth"
7)
8
9# 或下载checkpoint(如需续训)
10checkpoint_path = hf_hub_download(
11 repo_id="swagger00/minimind-demo",
12 filename="full_sft_768_resume.pth"
13)
1import torch
2from model.model_minimind import MiniMind # 需要MiniMind代码
3
4# 加载模型
5model = MiniMind(...)
6model.load_state_dict(torch.load(model_path))
7model.eval()
8
9# 推理
10output = model.generate("你好")
1模型配置:
2 hidden_size: 768
3 num_hidden_layers: 16
4
5训练超参数:
6 batch_size: 16
7 accumulation_steps: 8
8 learning_rate: 1e-5
9 epochs: 2
10 dtype: bfloat16