Skip to content

Optionally use Qwen VL driven REPA instead of DINO - #2831

Merged
bghira merged 2 commits into
mainfrom
feature/2247
Jul 16, 2026
Merged

Optionally use Qwen VL driven REPA instead of DINO#2831
bghira merged 2 commits into
mainfrom
feature/2247

Conversation

@bghira

@bghira bghira commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Closes #2247

This pull request adds support for using Qwen-VL vision-language models as feature encoders for CREPA regularization, in addition to the existing DINOv2 models. It introduces a new QwenVLVisionEncoder adapter, updates documentation in multiple languages to explain and reference Qwen-VL options, and improves alias handling and tooltips for model selection. Unit tests are extended with Qwen-VL stubs to facilitate testing.

CREPA Qwen-VL Vision Encoder Support:

  • Added the QwenVLVisionEncoder class to crepa.py, allowing CREPA to extract visual features from Qwen-VL models (including Qwen3 and Qwen2.5 variants) using the Hugging Face Transformers interface. This includes methods for loading, preprocessing, and feature extraction.
  • Updated the encoder loading logic in CREPA to instantiate QwenVLVisionEncoder when a Qwen-VL model alias or id is provided, and to handle dtype and preprocessing appropriately. [1] [2] [3]
  • Added Qwen-VL model aliases to the encoder name resolution logic to support user-friendly identifiers.

Documentation Updates (All Languages):

  • Updated the documentation in English, Spanish, Portuguese, Chinese, Hindi, and Japanese (OPTIONS.md and translations) to describe Qwen-VL as an alternative to DINOv2 for --crepa_model, including new options, rationale, and example usage. [1] [2] [3] [4] [5] [6]
  • Updated example config blocks in all docs to show Qwen-VL as a selectable model. [1] [2] [3] [4] [5] [6]

SDK/Field Registry UI Improvements:

  • Updated the help text and tooltip for the crepa_model field to reflect Qwen-VL support and clarify usage in the field registry.
  • Simplified the tooltip for crepa_encoder_frames_batch_size to be encoder-agnostic.

Testing Enhancements:

  • Added dummy Qwen-VL processor and model classes to the test suite for unit testing CREPA with Qwen-VL encoders.
  • Added necessary imports for mocking in tests.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds optional support for using Qwen-VL (via Hugging Face Transformers) as the feature encoder for CREPA/REPA regularization, alongside the existing DINOv2 torch.hub encoders, and updates the CLI/UI documentation to reflect the new options and aliases.

Changes:

  • Added a QwenVLVisionEncoder adapter and encoder selection logic to load Qwen-VL models when a Qwen-VL alias/model id is provided.
  • Updated preprocessing flow so encoders that self-preprocess (Qwen-VL) bypass the DINO-specific resize/normalize path.
  • Extended documentation (all languages) and added unit tests with Qwen-VL stubs/mocks.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
simpletuner/helpers/training/crepa.py Adds Qwen-VL adapter + aliasing, encoder loading switch, and preprocess gating for CREPA encoders.
tests/test_crepa.py Adds Qwen-VL unit tests using dummy processor/model and unittest.mock.patch.
simpletuner/simpletuner_sdk/server/services/field_registry/sections/loss.py Updates WebUI field help/tooltip text to reflect Qwen-VL support and encoder-agnostic batching.
documentation/OPTIONS.md Documents Qwen-VL as an alternative --crepa_model option and updates examples.
documentation/OPTIONS.es.md Spanish translation updates for Qwen-VL CREPA encoder options/examples.
documentation/OPTIONS.pt-BR.md Portuguese (Brazil) translation updates for Qwen-VL CREPA encoder options/examples.
documentation/OPTIONS.zh.md Chinese translation updates for Qwen-VL CREPA encoder options/examples.
documentation/OPTIONS.ja.md Japanese translation updates for Qwen-VL CREPA encoder options/examples.
documentation/OPTIONS.hi.md Hindi translation updates for Qwen-VL CREPA encoder options/examples.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread simpletuner/helpers/training/crepa.py
Comment thread simpletuner/helpers/training/crepa.py Outdated
@bghira
bghira merged commit 51d2865 into main Jul 16, 2026
3 checks passed
@bghira
bghira deleted the feature/2247 branch July 16, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants