This folder contains the notebook and dependencies for fine-tuning Qwen2.5-VL-3B-Instruct on VRSBench.
The goal of this guide is to make setup on a new machine predictable:
- create the
uvenvironment - install the pinned dependencies
- download the model
- download the dataset
- extract the image archives into the expected folder layout
- run the notebook without path surprises
After setup, the important parts of training/ should look like this:
training/
pyproject.toml
uv.lock
README.md
VRS Finetune.ipynb
models/
qwen2.5-vl-3b/
config.json
model.safetensors.index.json
model-00001-of-00002.safetensors
model-00002-of-00002.safetensors
...
VRSBench/
VRSBench_train.json
VRSBench_EVAL_Cap.json
VRSBench_EVAL_vqa.json
VRSBench_EVAL_referring.json
Images_train/
00002_0000.png
...
Images_val/
05863_0000.png
...
From the training/ folder:
uv venv --python 3.12
uv syncIf you are starting from scratch on a new machine and uv has not created the project yet, this repo already includes pyproject.toml, so you do not need uv init.
If you ever do want to scaffold a fresh project manually, the usual pattern is:
uv init
uv venv --python 3.12
uv syncFor this repo, the normal command sequence is just:
cd training
uv venv --python 3.12
uv syncThese checks help catch the common setup issues early.
uv run python -c "import torch; print(torch.__version__); print(torch.cuda.is_available()); print(torch.version.cuda)"
uv run python -c "import bitsandbytes as bnb; print(getattr(bnb, '__version__', 'unknown'))"If CUDA is working, the first command should report:
- a CUDA build of PyTorch such as
2.11.0+cu130 Truefortorch.cuda.is_available()
The notebook looks for the model here by default:
training/models/qwen2.5-vl-3b/
Download the full model snapshot into that folder:
uv run hf download Qwen/Qwen2.5-VL-3B-Instruct --local-dir .\models\qwen2.5-vl-3bIf the folder already exists but is incomplete, remove it first and redownload:
Remove-Item -Recurse -Force .\models\qwen2.5-vl-3b
uv run hf download Qwen/Qwen2.5-VL-3B-Instruct --local-dir .\models\qwen2.5-vl-3bQuick check:
Get-ChildItem .\models\qwen2.5-vl-3b\model-*.safetensorsYou should see at least:
model-00001-of-00002.safetensorsmodel-00002-of-00002.safetensors
The notebook looks for the dataset here by default:
training/VRSBench/
Download the dataset repo into that folder:
uv run hf download xiang709/VRSBench --repo-type dataset --local-dir .\VRSBenchThat should give you files like:
VRSBench_train.jsonVRSBench_EVAL_Cap.jsonVRSBench_EVAL_vqa.jsonVRSBench_EVAL_referring.jsonImages_train.zipImages_val.zip
The notebook expects extracted image folders, not only the zip files.
Run:
Expand-Archive .\VRSBench\Images_train.zip .\VRSBench\Images_train
Expand-Archive .\VRSBench\Images_val.zip .\VRSBench\Images_valImportant:
- After extraction, the image files should sit directly inside
Images_train/andImages_val/. - If the zip creates a nested folder like
Images_train\Images_train\..., move the files one level up so the final layout is:
VRSBench/
Images_train/
00002_0000.png
Images_val/
05863_0000.png
Quick checks:
Get-ChildItem .\VRSBench\Images_train | Select-Object -First 5 Name
Get-ChildItem .\VRSBench\Images_val | Select-Object -First 5 NameFrom training/:
u
49DC
v run jupyter labThen open:
training/VRS Finetune.ipynb
Run the notebook from the top.
The notebook supports these environment variables:
QWEN_VL_MODEL_PATH: override model directory or use a Hugging Face model idVRS_DATASET_DIR: override the local VRSBench directoryVRS_OUTPUT_DIR: override checkpoint/adapter output directoryHF_HOME: override the Hugging Face cache directory
Example:
$env:VRS_DATASET_DIR="D:\\datasets\\VRSBench"
$env:QWEN_VL_MODEL_PATH="D:\\models\\qwen2.5-vl-3b"
uv run jupyter labFrom training/, the smooth setup path is:
uv venv --python 3.12
uv sync
uv run hf download Qwen/Qwen2.5-VL-3B-Instruct --local-dir .\models\qwen2.5-vl-3b
uv run hf download xiang709/VRSBench --repo-type dataset --local-dir .\VRSBench
Expand-Archive .\VRSBench\Images_train.zip .\VRSBench\Images_train
Expand-Archive .\VRSBench\Images_val.zip .\VRSBench\Images_val
uv run jupyter labBefore training, confirm:
- model shard files exist
VRSBench_train.jsonexistsImages_train/contains.pngfilesImages_val/contains.pngfilesuv run python -c "import torch; print(torch.cuda.is_available())"printsTrue
FileNotFoundError: model-00001-of-00002.safetensors
- The model download is incomplete.
- Redownload
Qwen/Qwen2.5-VL-3B-Instructintotraining/models/qwen2.5-vl-3b/.
FileNotFoundError: Could not locate image '....png'
- The image archives were not extracted, or they extracted into a nested folder.
- Flatten
Images_train/andImages_val/so the.pngfiles are directly inside them.
bitsandbytes compiled without GPU support
- Upgrade
bitsandbytesand re-runuv sync. - Verify that the environment includes the correct CUDA DLL for your PyTorch/CUDA build.
torch.cuda.is_available() is False
- The current Python environment is not using the CUDA-enabled PyTorch build.
- Re-run
uv syncin this folder and make sure the notebook kernel is usingtraining/.venv.