Skip to content

[model] Support Intern-S1-mini - #8976

Merged
hiyouga merged 2 commits into
hiyouga:mainfrom
hhaAndroid:hha/interns1
Aug 20, 2025
Merged

hiyouga merged 2 commits into
hiyouga:mainfrom
hhaAndroid:hha/interns1

Conversation

@hhaAndroid

@hhaAndroid hhaAndroid commented Aug 20, 2025 •

Copy link
Copy Markdown
Contributor

Support Intern-s1-mini Model.

hf link: https://huggingface.co/internlm/Intern-S1-mini
modelscope link: https://modelscope.cn/models/Shanghai_AI_Laboratory/Intern-S1-mini/

lora sft

Create a new file examples/train_full/interns1_mini_lora_sft.yaml with the following content:

### model
model_name_or_path:  internlm/Intern-S1-mini
trust_remote_code: true

### method
stage: sft
do_train: true
finetuning_type: lora
freeze_vision_tower: true
freeze_multi_modal_projector: true
freeze_language_model: false
lora_rank: 8
lora_target: all

### dataset
dataset: mllm_demo,identity,alpaca_en_demo
template: intern_s1
cutoff_len: 2048
max_samples: 1000
overwrite_cache: true
preprocessing_num_workers: 16
dataloader_num_workers: 4

### output
output_dir: saves/interns1_mini/full/sft
logging_steps: 10
save_steps: 500
plot_loss: true
overwrite_output_dir: true
save_only_model: false
report_to: none  # choices: [none, wandb, tensorboard, swanlab, mlflow]

### train
per_device_train_batch_size: 1
gradient_accumulation_steps: 2
learning_rate: 1.0e-5
num_train_epochs: 3.0
lr_scheduler_type: cosine
warmup_ratio: 0.1
bf16: true
ddp_timeout: 180000000
resume_from_checkpoint: null

### eval
# val_size: 0.1
# per_device_eval_batch_size: 1
# eval_strategy: steps
# eval_steps: 500
# 1 gpu >=22g
CUDA_VISIBLE_DEVICES=0  DISABLE_VERSION_CHECK=1 lamafactory-cli train examples/train_full/interns1_lora_sft.yaml 

full sft

Create a new file examples/train_full/interns1_mini_full_sft.yaml with the following content:

### model
model_name_or_path: internlm/Intern-S1-mini
trust_remote_code: true

### method
stage: sft
do_train: true
finetuning_type: full
freeze_vision_tower: true
freeze_multi_modal_projector: true
freeze_language_model: false
deepspeed: examples/deepspeed/ds_z3_config.json

### dataset
dataset: mllm_demo,identity,alpaca_en_demo
template: intern_s1
cutoff_len: 2048
max_samples: 1000
overwrite_cache: true
preprocessing_num_workers: 16
dataloader_num_workers: 4

### output
output_dir: saves/interns1_mini/full/sft
logging_steps: 10
save_steps: 500
plot_loss: true
overwrite_output_dir: true
save_only_model: false
report_to: none  # choices: [none, wandb, tensorboard, swanlab, mlflow]

### train
per_device_train_batch_size: 1
gradient_accumulation_steps: 2
learning_rate: 1.0e-5
num_train_epochs: 3.0
lr_scheduler_type: cosine
warmup_ratio: 0.1
bf16: true
ddp_timeout: 180000000
resume_from_checkpoint: null

### eval
# val_size: 0.1
# per_device_eval_batch_size: 1
# eval_strategy: steps
# eval_steps: 500
DISABLE_VERSION_CHECK=1 llamafactory-cli train examples/train_full/interns1_mini_full_sft.yaml
# or 
DISABLE_VERSION_CHECK=1 FORCE_TORCHRUN=1 llamafactory-cli train examples/train_full/interns1_mini_full_sft.yaml

Note: pip install transformers>=4.55.2 torchvision and python >=3.12.0

@hhaAndroid hhaAndroid changed the title [model] support intern-s1-mini Aug 20, 2025
@hhaAndroid hhaAndroid changed the title [model] Support intern-s1-mini Aug 20, 2025

@hiyouga hiyouga left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM

@hiyouga
hiyouga merged commit d3791e8 into hiyouga:main Aug 20, 2025
15 of 16 checks passed
@hiyouga hiyouga added the solved This problem has been already solved label Aug 20, 2025
@BeihaiTianming

Copy link
Copy Markdown

Is it strictly required that transformers >= 4.55.2, torchvision, and Python >= 3.12.0 must be these specific versions?

@ZhouCunliang

Copy link
Copy Markdown

SFT开启packing,cutoff_len:4096时报错:RuntimeError: The size of tensor a (4360) must match the size of tensor b (4096) at non-singleton dimension 2

@ZhouCunliang

Copy link
Copy Markdown

SFT开启packing,cutoff_len:4096时报错:RuntimeError: The size of tensor a (4360) must match the size of tensor b (4096) at non-singleton dimension 2

配置:### model
model_name_or_path: /data/Intern-S1-mini
trust_remote_code: true

method

stage: sft
do_train: true
finetuning_type: full
freeze_vision_tower: true
freeze_multi_modal_projector: true
freeze_language_model: false
deepspeed: examples/deepspeed/ds_z3_config.json

dataset

dataset: alpaca_data_gpt4_chinese
template: intern_s1
cutoff_len: 4096
#max_samples: 1000
overwrite_cache: true
preprocessing_num_workers: 16
dataloader_num_workers: 4

output

output_dir: /data/zcl_train/interns1_mini/full/sft
logging_steps: 10
save_steps: 500
plot_loss: true
overwrite_output_dir: true
save_only_model: false
report_to: none # choices: [none, wandb, tensorboard, swanlab, mlflow]
packing: true

train

per_device_train_batch_size: 2
gradient_accumulation_steps: 2
learning_rate: 1.0e-5
num_train_epochs: 3.0
lr_scheduler_type: cosine
warmup_ratio: 0.1
bf16: true
1,9 Top

xuguodong1999 pushed a commit to xuguodong1999/LLaMA-Factory that referenced this pull request May 5, 2026

This branch was previously deployed

1 inactive deployment
docker — 433bb2e8 Deployed Aug 20, 2025 by hhaAndroid via build (npu) #276
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

solved This problem has been already solved

4 participants