This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# 4 * 50GiB; 2h
|
||||
PYTORCH_CUDA_ALLOC_CONF='expandable_segments:True' \
|
||||
NPROC_PER_NODE=4 \
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
swift rlhf \
|
||||
--rlhf_type dpo \
|
||||
--model Qwen/Qwen2.5-7B-Instruct \
|
||||
--tuner_type full \
|
||||
--dataset AI-ModelScope/orpo-dpo-mix-40k \
|
||||
--load_from_cache_file true \
|
||||
--split_dataset_ratio 0.01 \
|
||||
--torch_dtype bfloat16 \
|
||||
--num_train_epochs 1 \
|
||||
--per_device_train_batch_size 1 \
|
||||
--per_device_eval_batch_size 1 \
|
||||
--learning_rate 1e-5 \
|
||||
--gradient_accumulation_steps 1 \
|
||||
--eval_steps 200 \
|
||||
--save_steps 200 \
|
||||
--save_total_limit 2 \
|
||||
--logging_steps 5 \
|
||||
--max_length 8192 \
|
||||
--output_dir output \
|
||||
--warmup_ratio 0.05 \
|
||||
--save_only_model true \
|
||||
--dataloader_num_workers 4 \
|
||||
--dataset_num_proc 4 \
|
||||
--deepspeed zero3 \
|
||||
--attn_impl flash_attn \
|
||||
--rpo_alpha 0.1 \
|
||||
--packing true
|
||||
@@ -0,0 +1,34 @@
|
||||
# 50GiB; 6h
|
||||
PYTORCH_CUDA_ALLOC_CONF='expandable_segments:True' \
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
NPROC_PER_NODE=4 \
|
||||
MAX_PIXELS=1003520 \
|
||||
swift rlhf \
|
||||
--rlhf_type dpo \
|
||||
--model Qwen/Qwen2.5-VL-7B-Instruct \
|
||||
--dataset 'swift/RLAIF-V-Dataset' \
|
||||
--load_from_cache_file true \
|
||||
--split_dataset_ratio 0.01 \
|
||||
--tuner_type full \
|
||||
--torch_dtype bfloat16 \
|
||||
--num_train_epochs 1 \
|
||||
--per_device_train_batch_size 1 \
|
||||
--per_device_eval_batch_size 1 \
|
||||
--learning_rate 1e-5 \
|
||||
--freeze_vit true \
|
||||
--freeze_aligner true \
|
||||
--gradient_accumulation_steps 1 \
|
||||
--eval_steps 200 \
|
||||
--save_steps 200 \
|
||||
--save_total_limit 2 \
|
||||
--deepspeed zero3 \
|
||||
--logging_steps 5 \
|
||||
--max_length 8192 \
|
||||
--output_dir output \
|
||||
--warmup_ratio 0.05 \
|
||||
--dataloader_num_workers 4 \
|
||||
--dataset_num_proc 64 \
|
||||
--attn_impl flash_attn \
|
||||
--save_only_model true \
|
||||
--rpo_alpha 0.1 \
|
||||
--packing true
|
||||
@@ -0,0 +1,31 @@
|
||||
# Env: 4 * A100
|
||||
# https://github.com/modelscope/ms-swift/blob/main/examples/megatron/long_text.sh
|
||||
# Max Length: 16K
|
||||
# GPU Memory: 4 * 42GB, Training Speed 10s/it
|
||||
NPROC_PER_NODE=4 \
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
swift sft \
|
||||
--model Qwen/Qwen2.5-7B \
|
||||
--tuner_type full \
|
||||
--dataset 'AI-ModelScope/LongAlpaca-12k' \
|
||||
--load_from_cache_file true \
|
||||
--split_dataset_ratio 0.01 \
|
||||
--torch_dtype bfloat16 \
|
||||
--per_device_train_batch_size 1 \
|
||||
--per_device_eval_batch_size 1 \
|
||||
--learning_rate 1e-5 \
|
||||
--gradient_accumulation_steps 2 \
|
||||
--packing true \
|
||||
--eval_steps 200 \
|
||||
--save_steps 200 \
|
||||
--logging_steps 5 \
|
||||
--max_length 16384 \
|
||||
--warmup_ratio 0.05 \
|
||||
--dataloader_num_workers 8 \
|
||||
--dataset_num_proc 8 \
|
||||
--save_total_limit 2 \
|
||||
--save_only_model true \
|
||||
--output_dir output/Qwen2.5-7B \
|
||||
--deepspeed zero3 \
|
||||
--use_liger_kernel true \
|
||||
--attn_impl flash_attn
|
||||
@@ -0,0 +1,32 @@
|
||||
# 22GB
|
||||
CUDA_VISIBLE_DEVICES=0 \
|
||||
swift sft \
|
||||
--model Qwen/Qwen2.5-7B-Instruct \
|
||||
--tuner_type lora \
|
||||
--packing true \
|
||||
--dataset 'AI-ModelScope/alpaca-gpt4-data-zh#500' \
|
||||
'AI-ModelScope/alpaca-gpt4-data-en#500' \
|
||||
'swift/self-cognition#500' \
|
||||
--split_dataset_ratio 0.01 \
|
||||
--torch_dtype bfloat16 \
|
||||
--num_train_epochs 3 \
|
||||
--attn_impl flash_attn \
|
||||
--per_device_train_batch_size 1 \
|
||||
--per_device_eval_batch_size 1 \
|
||||
--learning_rate 1e-4 \
|
||||
--lora_rank 8 \
|
||||
--lora_alpha 32 \
|
||||
--target_modules all-linear \
|
||||
--gradient_accumulation_steps 4 \
|
||||
--eval_steps 50 \
|
||||
--save_steps 50 \
|
||||
--save_total_limit 2 \
|
||||
--logging_steps 5 \
|
||||
--max_length 2048 \
|
||||
--output_dir output \
|
||||
--system 'You are a helpful assistant.' \
|
||||
--warmup_ratio 0.05 \
|
||||
--dataloader_num_workers 4 \
|
||||
--dataset_num_proc 4 \
|
||||
--model_author swift \
|
||||
--model_name swift-robot
|
||||
@@ -0,0 +1,40 @@
|
||||
# 4 * 32GB
|
||||
# A demo for four modalities that can be run directly
|
||||
# For local datasets, it is recommended to use streaming: `--streaming true` (save memory)
|
||||
NPROC_PER_NODE=4 \
|
||||
ENABLE_AUDIO_OUTPUT=1 \
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
VIDEO_MAX_PIXELS=50176 \
|
||||
FPS_MAX_FRAMES=12 \
|
||||
MAX_PIXELS=1003520 \
|
||||
swift sft \
|
||||
--model Qwen/Qwen2.5-Omni-7B \
|
||||
--dataset 'AI-ModelScope/alpaca-gpt4-data-zh#10000' \
|
||||
'AI-ModelScope/LaTeX_OCR#2000' \
|
||||
'speech_asr/speech_asr_aishell1_trainsets:validation#2000' \
|
||||
--load_from_cache_file true \
|
||||
--split_dataset_ratio 0.01 \
|
||||
--tuner_type lora \
|
||||
--torch_dtype bfloat16 \
|
||||
--attn_impl flash_attn \
|
||||
--packing true \
|
||||
--num_train_epochs 3 \
|
||||
--per_device_train_batch_size 1 \
|
||||
--per_device_eval_batch_size 1 \
|
||||
--learning_rate 1e-4 \
|
||||
--lora_rank 8 \
|
||||
--lora_alpha 32 \
|
||||
--target_modules all-linear \
|
||||
--freeze_vit true \
|
||||
--freeze_aligner true \
|
||||
--gradient_accumulation_steps 1 \
|
||||
--eval_steps 50 \
|
||||
--save_steps 50 \
|
||||
--save_total_limit 2 \
|
||||
--logging_steps 5 \
|
||||
--max_length 4096 \
|
||||
--output_dir output \
|
||||
--warmup_ratio 0.05 \
|
||||
--dataloader_num_workers 4 \
|
||||
--dataset_num_proc 8 \
|
||||
--deepspeed zero2
|
||||
@@ -0,0 +1,35 @@
|
||||
# 4 * 36GB
|
||||
# Efficiency: With packing: 10 minutes; Without packing: >=1 hour
|
||||
# For local datasets, it is recommended to use streaming: `--streaming true` (save memory)
|
||||
# You can also use padding_free to avoid the space/time cost caused by multi-modal packing:
|
||||
# https://github.com/modelscope/ms-swift/blob/main/examples/train/padding_free/sft.sh
|
||||
NPROC_PER_NODE=4 \
|
||||
MAX_PIXELS=1003520 \
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
swift sft \
|
||||
--model Qwen/Qwen2.5-VL-7B-Instruct \
|
||||
--tuner_type lora \
|
||||
--dataset 'AI-ModelScope/LaTeX_OCR#20000' \
|
||||
--load_from_cache_file true \
|
||||
--split_dataset_ratio 0.01 \
|
||||
--torch_dtype bfloat16 \
|
||||
--attn_impl flash_attn \
|
||||
--packing true \
|
||||
--num_train_epochs 3 \
|
||||
--per_device_train_batch_size 1 \
|
||||
--per_device_eval_batch_size 1 \
|
||||
--learning_rate 1e-4 \
|
||||
--lora_rank 8 \
|
||||
--lora_alpha 32 \
|
||||
--target_modules all-linear \
|
||||
--gradient_accumulation_steps 1 \
|
||||
--eval_steps 100 \
|
||||
--save_steps 100 \
|
||||
--save_total_limit 2 \
|
||||
--logging_steps 5 \
|
||||
--max_length 8192 \
|
||||
--output_dir output \
|
||||
--warmup_ratio 0.05 \
|
||||
--dataloader_num_workers 4 \
|
||||
--dataset_num_proc 8 \
|
||||
--deepspeed zero2
|
||||
@@ -0,0 +1,34 @@
|
||||
# 4 * 36GB
|
||||
# A demo using the Hugging Face dataset
|
||||
# The first model weights will be saved around step 70.
|
||||
NPROC_PER_NODE=4 \
|
||||
MAX_PIXELS=1003520 \
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
HF_ENDPOINT=https://hf-mirror.com \
|
||||
swift sft \
|
||||
--model Qwen/Qwen2.5-VL-7B-Instruct \
|
||||
--tuner_type lora \
|
||||
--dataset 'HF::linxy/LaTeX_OCR:full#20000' \
|
||||
--torch_dtype bfloat16 \
|
||||
--attn_impl flash_attn \
|
||||
--streaming true \
|
||||
--shuffle_buffer_size 1000 \
|
||||
--packing true \
|
||||
--save_strategy epoch \
|
||||
--max_steps 1000 \
|
||||
--max_epochs 5 \
|
||||
--per_device_train_batch_size 1 \
|
||||
--per_device_eval_batch_size 1 \
|
||||
--learning_rate 1e-4 \
|
||||
--lora_rank 8 \
|
||||
--lora_alpha 32 \
|
||||
--target_modules all-linear \
|
||||
--gradient_accumulation_steps 1 \
|
||||
--save_total_limit 2 \
|
||||
--logging_steps 5 \
|
||||
--max_length 8192 \
|
||||
--output_dir output \
|
||||
--warmup_ratio 0.05 \
|
||||
--dataloader_num_workers 1 \
|
||||
--dataset_num_proc 8 \
|
||||
--deepspeed zero2
|
||||
Reference in New Issue
Block a user