-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: add internvl3_5 #3141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: add internvl3_5 #3141
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
17dc671
feat: add internvl3_5
NanoCode012 b5c06b9
fix: add timm instructions
NanoCode012 1c12197
chore: add kimi-linear to cce doc
NanoCode012 1143360
feat: update internvl example
NanoCode012 1850417
chore: pin revision
NanoCode012 592a187
chore: remove from multipack
NanoCode012 01e8f33
fix: add to multimodal array
NanoCode012 68f1b55
fix: internvl use hf version
NanoCode012 2c93089
feat: update cce
NanoCode012 84ad9bb
chore: lint
NanoCode012 83b54b3
fix: list for image_size
NanoCode012 d47bb92
chore: add docs vram usage
NanoCode012 168ecb1
feat: enable cce
NanoCode012 cbb9889
fix: no need trust remote code
NanoCode012 d36fc7f
fix: inconsistent timm version
NanoCode012 3755ad7
Merge branch 'main' into feat/internvl
NanoCode012 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Finetune OpenGV's InternVL with Axolotl | ||
|
|
||
| [InternVL 3.5](https://huggingface.co/OpenGVLab/InternVL3_5-8B-HF) is a family of powerful vision-language models supporting dynamic resolution and multi-image understanding by OpenGV. It features a ViT-style vision encoder and strong language model backbone for tasks like visual question answering, OCR, and scene text understanding. | ||
|
|
||
| This guide shows how to fine-tune it with Axolotl. | ||
|
|
||
| ## Getting started | ||
|
|
||
| 1. Install Axolotl following the [installation guide](https://docs.axolotl.ai/docs/installation.html). | ||
|
|
||
| 2. Install `timm` for vision model support: | ||
|
|
||
| ```bash | ||
| pip install timm==1.0.19 | ||
| ``` | ||
|
|
||
| 3. Install [Cut Cross Entropy](https://docs.axolotl.ai/docs/custom_integrations.html#cut-cross-entropy) to reduce training VRAM usage. | ||
|
|
||
| 4. Run the finetuning example: | ||
|
|
||
| ```bash | ||
| axolotl train examples/internvl3_5/internvl3_5-8b-qlora.yml | ||
| ``` | ||
|
|
||
| This config uses about 8.21 GiB VRAM. Let us know how it goes. Happy finetuning! 🚀 | ||
|
|
||
| ### Tips | ||
|
|
||
| - You can run a full finetuning by removing the `adapter: qlora` and `load_in_4bit: true` from the config. | ||
| - Read more on how to load your own dataset at [docs](https://docs.axolotl.ai/docs/dataset_loading.html). | ||
| - The dataset format follows the multi-modal format as seen [here](https://docs.axolotl.ai/docs/multimodal.html#dataset-format). | ||
|
|
||
| ## Optimization Guides | ||
|
|
||
| Please check the [Optimizations doc](https://docs.axolotl.ai/docs/optimizations.html). | ||
|
|
||
| ## Related Resources | ||
|
|
||
| - [InternVL Paper](https://huggingface.co/papers/2508.18265) | ||
| - [Axolotl Docs](https://docs.axolotl.ai) | ||
| - [Axolotl Website](https://axolotl.ai) | ||
| - [Axolotl GitHub](https://github.com/axolotl-ai-cloud/axolotl) | ||
| - [Axolotl Discord](https://discord.gg/7m9sfhzaf3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| base_model: OpenGVLab/InternVL3_5-8B-HF | ||
| processor_type: AutoProcessor | ||
|
|
||
| plugins: | ||
| - axolotl.integrations.cut_cross_entropy.CutCrossEntropyPlugin | ||
|
|
||
| load_in_4bit: true | ||
|
|
||
| # these 3 lines are needed for now to handle vision chat templates w images | ||
| skip_prepare_dataset: true | ||
| remove_unused_columns: false | ||
| sample_packing: false | ||
|
|
||
| datasets: | ||
| - path: HuggingFaceH4/llava-instruct-mix-vsft | ||
| type: chat_template | ||
| split: train[:1%] | ||
| field_messages: messages | ||
|
|
||
| dataset_prepared_path: last_run_prepared | ||
| val_set_size: 0.01 | ||
| output_dir: ./outputs/out | ||
|
|
||
| adapter: qlora | ||
| lora_model_dir: | ||
|
|
||
| sequence_len: 2048 | ||
|
|
||
| lora_r: 32 | ||
| lora_alpha: 16 | ||
| lora_dropout: 0.05 | ||
| lora_target_modules: 'model.language_model.layers.[\d]+.(mlp|cross_attn|self_attn).(up|down|gate|q|k|v|o)_proj' | ||
|
|
||
| wandb_project: | ||
| wandb_entity: | ||
| wandb_watch: | ||
| wandb_name: | ||
| wandb_log_model: | ||
|
|
||
| gradient_accumulation_steps: 4 | ||
| micro_batch_size: 2 | ||
| num_epochs: 1 | ||
| optimizer: adamw_bnb_8bit | ||
| lr_scheduler: cosine | ||
| learning_rate: 0.0002 | ||
|
|
||
| bf16: true | ||
| fp16: | ||
| tf32: true | ||
|
|
||
| gradient_checkpointing: true | ||
| logging_steps: 1 | ||
| flash_attention: true | ||
| eager_attention: | ||
|
|
||
| warmup_ratio: 0.1 | ||
| evals_per_epoch: 1 | ||
| saves_per_epoch: 1 | ||
| weight_decay: 0.0 | ||
|
|
||
| # save_first_step: true # uncomment this to validate checkpoint saving works with your config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent
timmversion between documentation files.This documentation specifies
timm==1.0.19, butexamples/internvl3_5/README.mdat line 14 specifiestimm==1.0.17. Please align these versions to avoid user confusion.🤖 Prompt for AI Agents