Compare commits
11 Commits
fa005f65aa
...
6e03191a60
| Author | SHA1 | Date |
|---|---|---|
|
|
6e03191a60 | |
|
|
6fc918beb6 | |
|
|
4bd6062ead | |
|
|
4d7a74acab | |
|
|
77946fda00 | |
|
|
fc585a9bf9 | |
|
|
c3199c7240 | |
|
|
7a6fddd63a | |
|
|
c9a8ab4632 | |
|
|
e84156818a | |
|
|
743420daac |
|
|
@ -4,3 +4,9 @@ __pycache__/
|
||||||
out
|
out
|
||||||
website/
|
website/
|
||||||
docs-minimind/
|
docs-minimind/
|
||||||
|
|
||||||
|
checkpoints/
|
||||||
|
dataset/
|
||||||
|
|
||||||
|
minimind-3/
|
||||||
|
minimind-3-moe/
|
||||||
|
|
|
||||||
11
README.md
11
README.md
|
|
@ -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>
|
||||||
|
|
||||||
|
|
@ -1909,6 +1918,8 @@ python llmexport.py --path /path/to/模型路径/ --export mnn --hqq --dst_path
|
||||||
|
|
||||||
* [@Nijikadesu](https://github.com/Nijikadesu):[🔗以交互笔记本方式分解项目代码](https://github.com/jingyaogong/minimind/issues/213)
|
* [@Nijikadesu](https://github.com/Nijikadesu):[🔗以交互笔记本方式分解项目代码](https://github.com/jingyaogong/minimind/issues/213)
|
||||||
|
|
||||||
|
* [@jaylearnstocode](https://github.com/jaylearnstocode):[🔗模型结构、注意力机制与训练流程可视化](https://llm-visualization-minimind.vercel.app/)
|
||||||
|
|
||||||
|
|
||||||
致谢以下优秀的论文与项目:
|
致谢以下优秀的论文与项目:
|
||||||
|
|
||||||
|
|
|
||||||
11
README_en.md
11
README_en.md
|
|
@ -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>
|
||||||
|
|
||||||
|
|
@ -1909,6 +1918,8 @@ Thanks to the following contributors for sharing training notes, data processing
|
||||||
|
|
||||||
* [@Nijikadesu](https://github.com/Nijikadesu): [🔗Breaking Down Project Code in Interactive Notebook Format](https://github.com/jingyaogong/minimind/issues/213)
|
* [@Nijikadesu](https://github.com/Nijikadesu): [🔗Breaking Down Project Code in Interactive Notebook Format](https://github.com/jingyaogong/minimind/issues/213)
|
||||||
|
|
||||||
|
* [@jaylearnstocode](https://github.com/jaylearnstocode): [🔗Visualization of Model Architecture, Attention Mechanisms, and Training Pipelines](https://llm-visualization-minimind.vercel.app/)
|
||||||
|
|
||||||
|
|
||||||
Thanks also to the following papers and projects:
|
Thanks also to the following papers and projects:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,17 @@ Flask_Cors==4.0.0
|
||||||
jieba==0.42.1
|
jieba==0.42.1
|
||||||
jsonlines==4.0.0
|
jsonlines==4.0.0
|
||||||
marshmallow==3.22.0
|
marshmallow==3.22.0
|
||||||
# matplotlib==3.10.0
|
|
||||||
ngrok==1.4.0
|
ngrok==1.4.0
|
||||||
nltk==3.8
|
nltk==3.8
|
||||||
numpy==1.26.4
|
numpy==1.26.4
|
||||||
openai==1.59.6
|
openai==1.59.6
|
||||||
# peft==0.7.1
|
|
||||||
psutil==5.9.8
|
psutil==5.9.8
|
||||||
|
protobuf==6.33.5
|
||||||
pydantic==2.11.5
|
pydantic==2.11.5
|
||||||
rich==13.7.1
|
rich==13.7.1
|
||||||
scikit_learn==1.5.1
|
scikit_learn==1.5.1
|
||||||
sentence_transformers==2.3.1
|
sentence_transformers==2.3.1
|
||||||
|
sentencepiece==0.2.0
|
||||||
simhash==2.1.2
|
simhash==2.1.2
|
||||||
tiktoken==0.10.0
|
tiktoken==0.10.0
|
||||||
transformers==4.57.6
|
transformers==4.57.6
|
||||||
|
|
@ -23,10 +23,12 @@ jinja2==3.1.2
|
||||||
jsonlines==4.0.0
|
jsonlines==4.0.0
|
||||||
trl==0.13.0
|
trl==0.13.0
|
||||||
ujson==5.1.0
|
ujson==5.1.0
|
||||||
wandb==0.18.3
|
wandb==0.22.3
|
||||||
streamlit==1.50.0
|
streamlit==1.50.0
|
||||||
einops==0.8.1
|
einops==0.8.1
|
||||||
swanlab==0.7.11
|
swanlab==0.9.8
|
||||||
modelscope==1.37.0
|
modelscope==1.37.0
|
||||||
# torch==2.6.0
|
# torch==2.6.0
|
||||||
# torchvision==0.21.0
|
# torchvision==0.21.0
|
||||||
|
# peft==0.7.1
|
||||||
|
# matplotlib==3.10.0
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
# .gitignore 忽略下列文件和目录
|
||||||
|
|
||||||
|
#比如minimind\scripts\minimind-3和minimind\scripts\minimind-3-moe
|
||||||
|
minimind-3/
|
||||||
|
minimind-3-moe/
|
||||||
|
|
@ -64,6 +64,28 @@ st.markdown("""
|
||||||
margin: 0 2px !important; /* 调整这里的 margin 值 */
|
margin: 0 2px !important; /* 调整这里的 margin 值 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 单独恢复侧边栏按钮(新建对话)的正常横向长方形外观,避免文字被挤成竖排 */
|
||||||
|
[data-testid="stSidebar"] .stButton > button {
|
||||||
|
border-radius: 8px !important; /* 恢复稍微圆角的矩形 */
|
||||||
|
width: 100% !important; /* 撑满侧边栏宽度 */
|
||||||
|
height: auto !important;
|
||||||
|
min-width: 100% !important; /* 覆盖掉 18px 的限制 */
|
||||||
|
min-height: 40px !important;
|
||||||
|
max-width: 100% !important;
|
||||||
|
max-height: none !important;
|
||||||
|
padding: 8px !important; /* 恢复内边距 */
|
||||||
|
background-color: #f4f6f8 !important; /* 增加一点按钮底色以免透明看不清 */
|
||||||
|
border: 1px solid #e0e0e0 !important;
|
||||||
|
font-size: 15px !important;
|
||||||
|
color: #333 !important;
|
||||||
|
margin: 10px 0 !important;
|
||||||
|
}
|
||||||
|
[data-testid="stSidebar"] .stButton > button:hover {
|
||||||
|
border-color: #999 !important;
|
||||||
|
background-color: #e4e8f0 !important;
|
||||||
|
color: #000 !important;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
""", unsafe_allow_html=True)
|
""", unsafe_allow_html=True)
|
||||||
|
|
||||||
|
|
@ -83,6 +105,7 @@ LANG_TEXTS = {
|
||||||
'disclaimer': 'AI 生成内容可能存在错误,请仔细核实',
|
'disclaimer': 'AI 生成内容可能存在错误,请仔细核实',
|
||||||
'think_tip': '自适应思考,目前多轮对话或Tool Call共存时思考不稳定',
|
'think_tip': '自适应思考,目前多轮对话或Tool Call共存时思考不稳定',
|
||||||
'tool_select': '工具选择(最多4个)',
|
'tool_select': '工具选择(最多4个)',
|
||||||
|
'new_chat': '新建对话', # 新增
|
||||||
},
|
},
|
||||||
'en': {
|
'en': {
|
||||||
'settings': 'Model Settings',
|
'settings': 'Model Settings',
|
||||||
|
|
@ -96,6 +119,7 @@ LANG_TEXTS = {
|
||||||
'disclaimer': 'AI-generated content may be inaccurate, please verify',
|
'disclaimer': 'AI-generated content may be inaccurate, please verify',
|
||||||
'think_tip': 'Adaptive thinking; may be unstable with multi-turn or Tool Call',
|
'think_tip': 'Adaptive thinking; may be unstable with multi-turn or Tool Call',
|
||||||
'tool_select': 'Tool Selection (max 4)',
|
'tool_select': 'Tool Selection (max 4)',
|
||||||
|
'new_chat': 'New Chat', # 新增
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -237,15 +261,20 @@ def regenerate_answer(index):
|
||||||
|
|
||||||
|
|
||||||
# 动态扫描模型目录
|
# 动态扫描模型目录
|
||||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
@st.cache_data(ttl=3600) # 增加缓存(有效期1小时),避免每次刷新页面都去高频读取硬盘文件树
|
||||||
MODEL_PATHS = {}
|
def get_model_paths():
|
||||||
for d in sorted(os.listdir(script_dir), reverse=True):
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
full_path = os.path.join(script_dir, d)
|
paths = {}
|
||||||
if os.path.isdir(full_path) and not d.startswith('.') and not d.startswith('_'):
|
for d in sorted(os.listdir(script_dir), reverse=True):
|
||||||
if any(f.endswith(('.bin', '.safetensors', '.pt')) or os.path.exists(os.path.join(full_path, 'model.safetensors.index.json')) for f in os.listdir(full_path) if os.path.isfile(os.path.join(full_path, f))):
|
full_path = os.path.join(script_dir, d)
|
||||||
MODEL_PATHS[d] = [d, d]
|
if os.path.isdir(full_path) and not d.startswith('.') and not d.startswith('_'):
|
||||||
if not MODEL_PATHS:
|
if any(f.endswith(('.bin', '.safetensors', '.pt')) or os.path.exists(os.path.join(full_path, 'model.safetensors.index.json')) for f in os.listdir(full_path) if os.path.isfile(os.path.join(full_path, f))):
|
||||||
MODEL_PATHS = {"No models found": ["", "No models"]}
|
paths[d] =[d, d]
|
||||||
|
if not paths:
|
||||||
|
paths = {"No models found": ["", "No models"]}
|
||||||
|
return paths
|
||||||
|
|
||||||
|
MODEL_PATHS = get_model_paths()
|
||||||
|
|
||||||
# 模型选择
|
# 模型选择
|
||||||
selected_model = st.sidebar.selectbox('Model', list(MODEL_PATHS.keys()), index=0)
|
selected_model = st.sidebar.selectbox('Model', list(MODEL_PATHS.keys()), index=0)
|
||||||
|
|
@ -285,7 +314,27 @@ with st.sidebar.expander(get_text('tools')):
|
||||||
if checked and len(st.session_state.selected_tools) < 4:
|
if checked and len(st.session_state.selected_tools) < 4:
|
||||||
st.session_state.selected_tools.append(name)
|
st.session_state.selected_tools.append(name)
|
||||||
|
|
||||||
image_url = "https://www.modelscope.cn/api/v1/studio/gongjy/MiniMind/repo?Revision=master&FilePath=images%2Flogo2.png&View=true"
|
# 新建对话
|
||||||
|
st.sidebar.markdown('<hr style="margin: 12px 0 16px 0;">', unsafe_allow_html=True)
|
||||||
|
|
||||||
|
# 新建对话
|
||||||
|
if st.sidebar.button(get_text('new_chat'), key="new_chat", use_container_width=True):
|
||||||
|
clear_chat_messages()
|
||||||
|
st.rerun()
|
||||||
|
|
||||||
|
# 将外部网络图片改为读取本地图片转 base64 渲染
|
||||||
|
import base64
|
||||||
|
@st.cache_data
|
||||||
|
def get_image_base64(image_path):
|
||||||
|
try:
|
||||||
|
with open(image_path, "rb") as img_file:
|
||||||
|
return f"data:image/png;base64,{base64.b64encode(img_file.read()).decode()}"
|
||||||
|
except:
|
||||||
|
# 如果本地图片不存在,再退回使用网络URL
|
||||||
|
return "https://www.modelscope.cn/api/v1/studio/gongjy/MiniMind/repo?Revision=master&FilePath=images%2Flogo2.png&View=true"
|
||||||
|
|
||||||
|
local_logo_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "images", "logo2.png")
|
||||||
|
image_url = get_image_base64(local_logo_path)
|
||||||
|
|
||||||
st.markdown(
|
st.markdown(
|
||||||
f'<div style="display: flex; flex-direction: column; align-items: center; text-align: center; margin: 0; padding: 0;">'
|
f'<div style="display: flex; flex-direction: column; align-items: center; text-align: center; margin: 0; padding: 0;">'
|
||||||
|
|
|
||||||
|
|
@ -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