Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:OpenGVLab InternVL Trainer Save Model

From Leeroopedia


Knowledge Sources
Domains Model_Deployment, Training
Last Updated 2026-02-07 00:00 GMT

Overview

HuggingFace Trainer's model saving method used to export trained InternVL models after training.

Description

The trainer.save_model() method serializes the trained InternVLChatModel and associated files to disk. This is a Wrapper Doc — the method comes from HuggingFace Transformers Trainer, configured for InternVL's multimodal model.

Usage

Called at the end of training in all InternVL training scripts. No additional configuration needed beyond output_dir in TrainingArguments.

Code Reference

Source Location

  • Repository: InternVL
  • File: internvl_chat/internvl/train/internvl_chat_finetune.py
  • Lines: L1057-1058

Signature

# Called after training completes:
trainer.save_model()
# Saves to training_args.output_dir

Import

from transformers import Trainer
# trainer.save_model() is a built-in method

External Reference

I/O Contract

Inputs

Name Type Required Description
training_args.output_dir str Yes Directory to save model files

Outputs

Name Type Description
Model directory Directory Contains config.json, model weights (safetensors), tokenizer files

Usage Examples

Save After Training

trainer = Trainer(model=model, args=training_args, ...)
trainer.train()
trainer.save_model()  # Saves to training_args.output_dir

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment