Skip to content

Fix VLM GRPO notebook for modern TRL (conversational prompts, reward functions, dependencies) - #377

Open
ahmedshahrukhali wants to merge 6 commits into
huggingface:mainfrom
ahmedshahrukhali:fix/vlm-grpo-conversational-prompts
Open

ahmedshahrukhali wants to merge 6 commits into
huggingface:mainfrom
ahmedshahrukhali:fix/vlm-grpo-conversational-prompts

Conversation

@ahmedshahrukhali

Copy link
Copy Markdown

What does this PR do?

Fixes the fine_tuning_vlm_grpo_trl notebook so it runs end-to-end on Google Colab with current TRL.

The root cause of #363 is that GRPOTrainer now requires raw conversational prompts (list[dict]) for multimodal training and applies the chat template internally. The notebook was calling processor.apply_chat_template() beforehand, which collapsed the structured messages into a plain string and triggered:

ValueError: Multimodal training requires conversational prompts.

Changes

  1. make_conversation — return the raw message list instead of a pre-formatted string; let the trainer handle templating.
  2. format_reward / accuracy_reward — extract the text content from the conversational completion (list[dict]) before passing it to re.match() / parse(), fixing a TypeError: expected string or bytes-like object, got 'list'.
  3. GRPOConfig — remove deprecated max_prompt_length (same fix as Remove max_prompt_length #345 for the LLM notebook).
  4. pip install — add torchao (Colab ships 0.10.0, TRL/PEFT need ≥0.16.0) and pin --extra-index-url to the CUDA 12.1 index to avoid an nvrtc compilation error.
  5. Broken link — update the TRL example link to the new path after the examples/ reorganization (same fix as Fix TRL GRPO VLM example link #367).
  6. Typo — "sse" → "see" in Cell 47.

Tested on Google Colab A100.

Fixes #363

Who can review?

@sergiopaniego @merveenoyan @stevhliu

ahmedshahrukhali and others added 6 commits September 23, 2026 14:50
)

- Update make_conversation to return raw conversational messages expected by modern TRL GRPOTrainer
- Update markdown explanation regarding native multimodal prompt handling
- Remove deprecated max_prompt_length parameter from GRPOConfig and markdown guide
- Fix broken link to TRL GRPO VLM visual math example
…tions (for current GRPOTrainer multimodal/VLM parameter support)
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Post training a VLM for reasoning with GRPO using TRL" Not Work

1 participant