From 4c3b5bacbf9623390922545433344085e92f418f Mon Sep 17 00:00:00 2001 From: jingyaogong Date: Fri, 24 Oct 2025 00:35:56 +0800 Subject: [PATCH] [fix] 1024-bugs --- README.md | 27 +++++++++++++++++++++------ README_en.md | 33 +++++++++++++++++++++++---------- requirements.txt | 12 ++++++------ trainer/train_pretrain_vlm.py | 3 +-- trainer/train_sft_vlm.py | 3 +-- 5 files changed, 52 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 698da6a..09a6c7e 100644 --- a/README.md +++ b/README.md @@ -192,16 +192,29 @@ print(torch.cuda.is_available()) ### 2.数据下载 -从下文提供的[数据集下载链接](https://huggingface.co/datasets/jingyaogong/minimind-v_dataset) -下载需要的数据文件(创建`./dataset`目录)并放到`./dataset`下。 - -`*.jsonl`为问答数据集,`*images`为配套的图片数据,下载完成后需要解压图像数据。 +从下文提供的[数据集链接](https://huggingface.co/datasets/jingyaogong/minimind-v_dataset) +下载所需内容并放到`./dataset`下。
注:数据集须知 -请预留~5GB空间存放数据集,若无多余空间存放pretrain数据, -可尝试跳过pretrain训练步骤直接进行sft训练。 +Pretrain数据: +```bash +wget https://hf-mirror.com/datasets/jingyaogong/minimind-v_dataset/resolve/main/pretrain_data.jsonl +wget https://hf-mirror.com/datasets/jingyaogong/minimind-v_dataset/resolve/main/pretrain_images.zip +unzip pretrain_images.zip && rm pretrain_images.zip +``` + +SFT数据: +```bash +wget https://hf-mirror.com/datasets/jingyaogong/minimind-v_dataset/resolve/main/sft_data.jsonl +wget https://hf-mirror.com/datasets/jingyaogong/minimind-v_dataset/resolve/main/sft_images.zip +unzip sft_images.zip && rm sft_images.zip +``` + +`*.jsonl`为问答文本,`*images`为配套的图片数据,下载完成后需要解压图像数据。 + +请预留~5GB空间存放数据集,若无多余空间存放pretrain数据,可尝试跳过pretrain训练步骤直接进行sft训练。
@@ -275,6 +288,8 @@ python train_xxx.py --use_wandb 通过添加`--use_wandb`参数,可以记录训练过程,训练完成后,可以在wandb网站上查看训练过程。通过修改`wandb_project` 和`wandb_run_name`参数,可以指定项目名称和运行名称。 +【注】:25年6月后,国内网络环境无法直连WandB,MiniMind项目默认转为使用[SwanLab](https://swanlab.cn/)作为训练可视化工具(完全兼容WandB API),即`import wandb`改为`import swanlab as wandb`即可,其他均无需改动。 + # 📌 VLM Detail diff --git a/README_en.md b/README_en.md index ab56257..499556f 100644 --- a/README_en.md +++ b/README_en.md @@ -153,7 +153,7 @@ https://modelscope.cn/models/gongjy/MiniMind2-V-PyTorch/resolve/master/llm_512.p ### 1. Environment Preparation ```bash -pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple +pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple ``` ### 2. Download the model @@ -180,7 +180,7 @@ python web_demo_vlm.py ### 1. Environment Preparation ```bash -pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple +pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple ```
@@ -200,18 +200,29 @@ for help. ### 2. Download Data -Download the required dataset files from -the [dataset download link](https://huggingface.co/datasets/jingyaogong/minimind-v_dataset), create a `./dataset` -directory, and place the files under `./dataset`. - -`*.jsonl` is the Q&A dataset, and `*images` are the accompanying image data. After downloading, decompress the image -data. +Download the required content from the [dataset link](https://huggingface.co/datasets/jingyaogong/minimind-v_dataset) +and place it under `./dataset`.
Note: Dataset Details -Please reserve about 5GB of space for the dataset. If there is insufficient space for pretrain data, you can try -skipping the pretrain training step and proceed directly to SFT training. +Pretrain data: +```bash +wget https://hf-mirror.com/datasets/jingyaogong/minimind-v_dataset/resolve/main/pretrain_data.jsonl +wget https://hf-mirror.com/datasets/jingyaogong/minimind-v_dataset/resolve/main/pretrain_images.zip +unzip pretrain_images.zip && rm pretrain_images.zip +``` + +SFT data: +```bash +wget https://hf-mirror.com/datasets/jingyaogong/minimind-v_dataset/resolve/main/sft_data.jsonl +wget https://hf-mirror.com/datasets/jingyaogong/minimind-v_dataset/resolve/main/sft_images.zip +unzip sft_images.zip && rm sft_images.zip +``` + +`*.jsonl` contains Q&A text, and `*images` are the accompanying image data. After downloading, decompress the image data. + +Please reserve about 5GB of space for the dataset. If there is insufficient space for pretrain data, you can try skipping the pretrain training step and proceed directly to SFT training.
@@ -288,6 +299,8 @@ By adding the `--use_wandb` parameter, you can log the training process, and aft the process on the wandb website. You can specify the project name and run name by modifying the `wandb_project` and `wandb_run_name` parameters. +[Note]: After June 2025, the domestic network environment cannot directly connect to WandB. The MiniMind project by default switches to using [SwanLab](https://swanlab.cn/) as the training visualization tool (fully compatible with WandB API), that is, just change `import wandb` to `import swanlab as wandb`, no other changes are needed. +
# 📌 VLM Detail diff --git a/requirements.txt b/requirements.txt index 20df3fb..10ab74f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,6 @@ ngrok==1.4.0 nltk==3.8 numpy==1.26.4 openai==1.59.6 -pandas==1.5.3 peft==0.7.1 psutil==5.9.8 pydantic==2.8.2 @@ -18,14 +17,15 @@ rich==13.7.1 scikit_learn==1.5.1 sentence_transformers==2.3.1 simhash==2.1.2 -tiktoken==0.5.1 -transformers==4.48.0 +tiktoken==0.10.0 +transformers==4.57.1 jinja2==3.1.2 jsonlines==4.0.0 trl==0.13.0 ujson==5.1.0 wandb==0.18.3 -streamlit==1.30.0 -torch==2.2.2 -torchvision==0.17.2 +streamlit==1.50.0 gradio==5.0.0b5 +swanlab==0.6.12 +torch==2.6.0 +torchvision==0.21.0 diff --git a/trainer/train_pretrain_vlm.py b/trainer/train_pretrain_vlm.py index aca682a..c4f1100 100644 --- a/trainer/train_pretrain_vlm.py +++ b/trainer/train_pretrain_vlm.py @@ -175,8 +175,7 @@ if __name__ == "__main__": args.device = torch.device(DEVICE) if args.use_wandb and (not ddp or ddp_local_rank == 0): - import wandb - + import swanlab as wandb wandb.init(project=args.wandb_project, name=args.wandb_run_name) else: wandb = None diff --git a/trainer/train_sft_vlm.py b/trainer/train_sft_vlm.py index 56da672..204d8ad 100644 --- a/trainer/train_sft_vlm.py +++ b/trainer/train_sft_vlm.py @@ -176,8 +176,7 @@ if __name__ == "__main__": args.device = torch.device(DEVICE) if args.use_wandb and (not ddp or ddp_local_rank == 0): - import wandb - + import swanlab as wandb wandb.init(project=args.wandb_project, name=args.wandb_run_name) else: wandb = None