Implementation:OpenGVLab InternVL Internvl Custom2hf
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Model_Deployment, Tooling |
| Last Updated | 2026-02-07 00:00 GMT |
Overview
Concrete tool for converting InternVL custom checkpoint format to HuggingFace format provided by the InternVL tools.
Description
The internvl_custom2hf.py script converts InternVL training checkpoint format to standard HuggingFace format by remapping weight keys and saving in the expected directory structure.
Usage
Run after training when the output checkpoint uses internal naming conventions that differ from HuggingFace format.
Code Reference
Source Location
- Repository: InternVL
- File: internvl_chat/tools/internvl_custom2hf.py
- Lines: L1-31
Signature
python internvl_chat/tools/internvl_custom2hf.py <input_path> <output_path>
Import
python internvl_chat/tools/internvl_custom2hf.py ./output/checkpoint ./output/hf_model
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| input_path | str | Yes | Path to InternVL custom format checkpoint |
| output_path | str | Yes | Path for HuggingFace format output |
Outputs
| Name | Type | Description |
|---|---|---|
| HF checkpoint | Directory | Standard HuggingFace model directory |
Usage Examples
Convert Checkpoint Format
python internvl_chat/tools/internvl_custom2hf.py \
./output/training_checkpoint \
./output/hf_compatible_model
# Verify conversion
python -c "
from internvl.model.internvl_chat import InternVLChatModel
model = InternVLChatModel.from_pretrained('./output/hf_compatible_model')
print('Model loaded successfully')
"
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment