unsloth/studio
Daniel Han 48a3a78703
Studio: fail fast on an invalid first training batch (base VLM empty chat template) (#6358)
* Studio: fail fast on an invalid first training batch

Training a base vision-language model (e.g. Qwen/Qwen2-VL-7B or
unsloth/Qwen2-VL-7B) on a conversational image dataset crashed on the first
step with 'Expected ... Long, Int; but got torch.cuda.FloatTensor (embedding)'.
Root cause: the base model's chat template is a flat, media-only template that
renders to an empty string for role-based messages, so UnslothVisionDataCollator
hands the processor empty text, the processor returns empty input_ids, torch
defaults the empty tensor to float32, and the embedding lookup rejects it.

Add a preflight that runs one real batch through the trainer's own tokenization
and collation right before train(), and stops the run with an actionable message
when input_ids is empty or non-integer (pointing to the instruction-tuned variant
for the base-model case). Faithful across text, vision and audio-VLM paths, and
never blocks a run whose first batch is valid.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Trim comments in the training preflight

* Stub unsloth/trl in preflight test so backend CI collection passes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-06-18 06:36:33 -07:00
..
backend Studio: fail fast on an invalid first training batch (base VLM empty chat template) (#6358) 2026-06-18 06:36:33 -07:00
frontend Studio: scale export GGUF size estimates from the real model size (#6418) 2026-06-18 05:44:17 -07:00
src-tauri feat(studio): Hub + Download Manager (#5916) 2026-06-09 04:11:24 -07:00
__init__.py Final cleanup 2026-03-12 18:28:04 +00:00
install_llama_prebuilt.py Studio: reach the published source asset when a mix build's commit 404s (#6314) 2026-06-18 05:59:42 -07:00
install_python_stack.py studio: select torchao version from the installed torch (#6400) 2026-06-17 04:09:40 -07:00
LICENSE.AGPL-3.0 Add AGPL-3.0 license to studio folder 2026-03-09 19:36:25 +00:00
package-lock.json ci: advisory lockfile supply-chain audit (no install-script changes) (#5604) 2026-05-19 05:56:56 -07:00
package.json ci: advisory lockfile supply-chain audit (no install-script changes) (#5604) 2026-05-19 05:56:56 -07:00
setup.bat Final cleanup 2026-03-12 18:28:04 +00:00
setup.ps1 Make the Studio installers (sh + ps1) resilient to transient uv download failures (#6281) 2026-06-16 03:48:01 -07:00
setup.sh Make the Studio installers (sh + ps1) resilient to transient uv download failures (#6281) 2026-06-16 03:48:01 -07:00
Unsloth_Studio_Colab.ipynb Fix/studio colab proxy and iframe - Unsloth Studio not loading in Colab (iframe "refused to connect" and wrong URL) (#5844) 2026-05-28 23:54:48 -07:00