AnyLLM To VLM
Turn any text-only LLM into a Vision-Language Model through efficient training.
Install / Use
npx skills add sunshine-JLU/AnyLLM-to-VLMInstalls into whichever agent you are using.
README
AnyLLM-to-VLM 🚀
Turn any text-only LLM into a Vision-Language Model through efficient training.
Features
- 📷 Support for CLIP and other vision encoders
- 🦙 Compatible with popular LLMs (Qwen, LLaMA, etc.)
Guidance
- Project Scalability Guide :
README_EXTENSIBILITY.md - How to change a new vision encoder :
QUICK_START_VISION_ENCODERS.md - more details concerning vision encoder :
README_VISION_ENCODERS.md - how to use multi-gpu to train:
README_MULTI_GPU.md
Quick Start
Follow these steps to get started quickly [Test SoftWare Environment : Python >= 3.12]:
- Clone the Repository
Clone the repository to your local machine:git clone https://github.com/sunshine-JLU/AnyLLM-to-VLM.git cd AnyLLM-to-VLM - Papare the environment
pip install -r requirements.txt pip install protobuf --upgrade - Papare the dataset and your models
cd dataset wget https://modelscope.cn/datasets/gongjy/minimind-v_dataset/resolve/master/sft_data.parquet wget https://modelscope.cn/datasets/gongjy/minimind-v_dataset/resolve/master/pretrain_data.parquet cd .. cd models modelscope download --model Qwen/Qwen2.5-0.5B-Instruct --local_dir ./Qwen2.5-0.5B-Instruct modelscope download --model openai-mirror/clip-vit-base-patch16 --local_dir ./clip-vit-base-patch16 modelscope download --model google/siglip-so400m-patch14-384 --local_dir ./siglip-so400m-patch14-384 cd .. - Run the Pretrain Script
python train_vlm.py --config configs/vlm_pretrain.yaml --stage pretrain # python train_vlm.py --config configs/vlm_pretrain.yaml --stage pretrain | tee pretrain.log # 使用4张GPU训练 # torchrun --nproc_per_node=4 train_vlm.py --config configs/vlm_pretrain.yaml --stage pretrain | tee pretrain.log # In a new terminal, type `nvitop` :
- Run the Supervised Fine-Tuning Script
python train_vlm.py --config configs/vlm_sft.yaml --resume ./checkpoints/pretrain/checkpoint_epoch1.pt --stage sft # 使用4张GPU训练 # torchrun --nproc_per_node=4 train_vlm.py --config configs/vlm_sft.yaml --resume ./checkpoints/pretrain/checkpoint_epoch1.pt --stage sft | tee sft.log # python train_vlm.py --config configs/vlm_sft.yaml --resume ./checkpoints/pretrain/checkpoint_epoch1.pt --stage sft | tee sft.log - Eval the model
python eval_vlm.py --checkpoint ./checkpoints/sft/checkpoint_epoch1.pt --config configs/vlm_sft.yaml --mode generate --image ./sample.jpg --question "描述这张图片" --max_new_tokens 50 - Test Result
- Test HardWare Environment <img width="1290" height="332" alt="76be5859-27b6-4cd6-941c-e1ef95b769cc" src="https://github.com/user-attachments/assets/50496cc7-417a-42f1-8f44-a6e555c09cca" />
Acknowledgments
This project was inspired by jingyaogong/minimind-v. We extend our thanks for its open-source contribution, which provided valuable inspiration and support for our development.
Related Skills
node-connect
385.5kDiagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
blender-python-addon
40.5kBlender Python add-on rules for operators, panels, properties, registration, testing, and API-safe scripting
flutter-development-guidelines-cursorrules-prompt-file
40.5kCursor rules for Flutter development with MVVM architecture, Riverpod state management, Material widgets, and Dart style guidelines.
commit-push-pr
140.7kCommit, push, and open a PR
