This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
# ms-swift>=3.11
|
||||
OMP_NUM_THREADS=14 \
|
||||
IMAGE_MAX_TOKEN_NUM=1024 \
|
||||
VIDEO_MAX_TOKEN_NUM=128 \
|
||||
FPS_MAX_FRAMES=16 \
|
||||
swift export \
|
||||
--model Qwen/Qwen3-VL-30B-A3B-Instruct \
|
||||
--dataset swift/RLAIF-V-Dataset \
|
||||
--split_dataset_ratio 0.01 \
|
||||
--dataset_num_proc 8 \
|
||||
--to_cached_dataset true \
|
||||
--template_mode rlhf \
|
||||
--output_dir ./qwen3_vl_cached_dataset
|
||||
|
||||
|
||||
# 16s/it; 8 * 65GiB
|
||||
PYTORCH_CUDA_ALLOC_CONF='expandable_segments:True' \
|
||||
NPROC_PER_NODE=8 \
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 \
|
||||
IMAGE_MAX_TOKEN_NUM=1024 \
|
||||
VIDEO_MAX_TOKEN_NUM=128 \
|
||||
FPS_MAX_FRAMES=16 \
|
||||
megatron rlhf \
|
||||
--rlhf_type dpo \
|
||||
--model Qwen/Qwen3-VL-30B-A3B-Instruct \
|
||||
--save_safetensors true \
|
||||
--cached_dataset qwen3_vl_cached_dataset/train \
|
||||
--cached_val_dataset qwen3_vl_cached_dataset/val \
|
||||
--load_from_cache_file true \
|
||||
--tuner_type full \
|
||||
--tensor_model_parallel_size 4 \
|
||||
--expert_tensor_parallel_size 1 \
|
||||
--pipeline_model_parallel_size 2 \
|
||||
--expert_model_parallel_size 4 \
|
||||
--moe_permute_fusion true \
|
||||
--moe_grouped_gemm true \
|
||||
--moe_shared_expert_overlap true \
|
||||
--moe_aux_loss_coeff 1e-6 \
|
||||
--micro_batch_size 1 \
|
||||
--global_batch_size 4 \
|
||||
--packing true \
|
||||
--recompute_granularity full \
|
||||
--recompute_method uniform \
|
||||
--recompute_num_layers 1 \
|
||||
--finetune true \
|
||||
--cross_entropy_loss_fusion true \
|
||||
--lr 1e-5 \
|
||||
--lr_warmup_fraction 0.05 \
|
||||
--min_lr 1e-6 \
|
||||
--output_dir megatron_output/Qwen3-VL-30B-A3B-Instruct \
|
||||
--eval_steps 500 \
|
||||
--save_steps 500 \
|
||||
--max_length 8192 \
|
||||
--num_train_epochs 1 \
|
||||
--dataloader_num_workers 8 \
|
||||
--dataset_num_proc 8 \
|
||||
--no_save_optim true \
|
||||
--no_save_rng true \
|
||||
--sequence_parallel true \
|
||||
--freeze_llm false \
|
||||
--freeze_vit true \
|
||||
--freeze_aligner true \
|
||||
--optimizer_cpu_offload true \
|
||||
--use_precision_aware_optimizer true \
|
||||
--optimizer_offload_fraction 0.4 \
|
||||
--attention_backend flash \
|
||||
--rpo_alpha 0.1 \
|
||||
--beta 0.1 \
|
||||
--loss_type sigmoid
|
||||
@@ -0,0 +1,60 @@
|
||||
# ms-swift>=3.11
|
||||
swift export \
|
||||
--model Qwen/Qwen3-30B-A3B-Base \
|
||||
--dataset 'swift/Chinese-Qwen3-235B-2507-Distill-data-110k-SFT' \
|
||||
--split_dataset_ratio 0.01 \
|
||||
--dataset_num_proc 64 \
|
||||
--to_cached_dataset true \
|
||||
--output_dir ./qwen3_cached_dataset
|
||||
|
||||
|
||||
# 4 * 48GiB; 17s/it
|
||||
PYTORCH_CUDA_ALLOC_CONF='expandable_segments:True' \
|
||||
NPROC_PER_NODE=4 \
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
megatron sft \
|
||||
--model Qwen/Qwen3-30B-A3B-Base \
|
||||
--save_safetensors true \
|
||||
--merge_lora false \
|
||||
--cached_dataset './qwen3_cached_dataset/train' \
|
||||
--cached_val_dataset './qwen3_cached_dataset/val' \
|
||||
--tuner_type lora \
|
||||
--lora_rank 32 \
|
||||
--lora_alpha 64 \
|
||||
--target_modules all-linear \
|
||||
--moe_permute_fusion true \
|
||||
--expert_model_parallel_size 4 \
|
||||
--moe_grouped_gemm true \
|
||||
--moe_shared_expert_overlap true \
|
||||
--moe_aux_loss_coeff 1e-6 \
|
||||
--micro_batch_size 1 \
|
||||
--global_batch_size 16 \
|
||||
--recompute_granularity full \
|
||||
--recompute_method uniform \
|
||||
--recompute_num_layers 1 \
|
||||
--num_train_epochs 3 \
|
||||
--finetune true \
|
||||
--cross_entropy_loss_fusion true \
|
||||
--lr 1e-4 \
|
||||
--lr_warmup_fraction 0.05 \
|
||||
--min_lr 1e-5 \
|
||||
--output_dir megatron_output/Qwen3-30B-A3B-Base \
|
||||
--eval_steps 200 \
|
||||
--save_steps 200 \
|
||||
--packing true \
|
||||
--max_length 8192 \
|
||||
--dataloader_num_workers 8 \
|
||||
--dataset_num_proc 8 \
|
||||
--no_save_optim true \
|
||||
--no_save_rng true \
|
||||
--sequence_parallel true \
|
||||
--attention_backend flash
|
||||
|
||||
|
||||
CUDA_VISIBLE_DEVICES=0 \
|
||||
swift infer \
|
||||
--adapters megatron_output/Qwen3-30B-A3B-Base/vx-xxx/checkpoint-xxx \
|
||||
--load_data_args true \
|
||||
--attn_impl flash_attn \
|
||||
--stream true \
|
||||
--max_new_tokens 512
|
||||
@@ -0,0 +1,42 @@
|
||||
# ms-swift>=3.11
|
||||
swift export \
|
||||
--model Qwen/Qwen2.5-7B \
|
||||
--dataset 'AI-ModelScope/ruozhiba:all' \
|
||||
--dataset_num_proc 64 \
|
||||
--to_cached_dataset true \
|
||||
--truncation_strategy split \
|
||||
--max_length 8192 \
|
||||
--split_dataset_ratio 0.01 \
|
||||
--use_chat_template false \
|
||||
--loss_scale all \
|
||||
--output_dir ./pretrain_cached_dataset
|
||||
|
||||
PYTORCH_CUDA_ALLOC_CONF='expandable_segments:True' \
|
||||
NPROC_PER_NODE=4 \
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
swift pt \
|
||||
--model Qwen/Qwen2.5-7B \
|
||||
--tuner_type full \
|
||||
--cached_dataset './pretrain_cached_dataset/train' \
|
||||
--cached_val_dataset './pretrain_cached_dataset/val' \
|
||||
--truncation_strategy split \
|
||||
--num_train_epochs 3 \
|
||||
--torch_dtype bfloat16 \
|
||||
--per_device_train_batch_size 1 \
|
||||
--per_device_eval_batch_size 1 \
|
||||
--learning_rate 1e-5 \
|
||||
--gradient_accumulation_steps 4 \
|
||||
--packing true \
|
||||
--eval_steps 200 \
|
||||
--save_steps 200 \
|
||||
--logging_steps 5 \
|
||||
--max_length 8192 \
|
||||
--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,41 @@
|
||||
# ms-swift>=3.12
|
||||
swift export \
|
||||
--model Qwen/Qwen3-Reranker-4B \
|
||||
--task_type generative_reranker \
|
||||
--dataset MTEB/scidocs-reranking \
|
||||
--dataset_num_proc 64 \
|
||||
--split_dataset_ratio 0.01 \
|
||||
--to_cached_dataset true \
|
||||
--output_dir ./qwen3_reranker_cached_dataset
|
||||
|
||||
# 4 * 24GiB
|
||||
PYTORCH_CUDA_ALLOC_CONF='expandable_segments:True' \
|
||||
NPROC_PER_NODE=4 \
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
swift sft \
|
||||
--model Qwen/Qwen3-Reranker-4B \
|
||||
--task_type generative_reranker \
|
||||
--loss_type pointwise_reranker \
|
||||
--tuner_type full \
|
||||
--cached_dataset './qwen3_reranker_cached_dataset/train' \
|
||||
--cached_val_dataset './qwen3_reranker_cached_dataset/val' \
|
||||
--num_train_epochs 1 \
|
||||
--torch_dtype bfloat16 \
|
||||
--per_device_train_batch_size 1 \
|
||||
--per_device_eval_batch_size 1 \
|
||||
--learning_rate 6e-6 \
|
||||
--gradient_accumulation_steps 8 \
|
||||
--packing true \
|
||||
--eval_steps 50 \
|
||||
--save_steps 200 \
|
||||
--logging_steps 5 \
|
||||
--max_length 8192 \
|
||||
--warmup_ratio 0.05 \
|
||||
--dataloader_num_workers 8 \
|
||||
--dataset_num_proc 8 \
|
||||
--save_total_limit 2 \
|
||||
--save_only_model true \
|
||||
--output_dir output/Qwen3-Reranker-4B \
|
||||
--deepspeed zero3 \
|
||||
--attn_impl flash_attn \
|
||||
--dataloader_drop_last true
|
||||
@@ -0,0 +1,60 @@
|
||||
# ms-swift>=3.12
|
||||
OMP_NUM_THREADS=14 \
|
||||
MAX_PIXELS=1003520 \
|
||||
swift export \
|
||||
--model Qwen/Qwen2.5-Omni-3B \
|
||||
--dataset 'tany0699/garbage265#20000' \
|
||||
--task_type seq_cls \
|
||||
--num_labels 265 \
|
||||
--problem_type single_label_classification \
|
||||
--split_dataset_ratio 0.01 \
|
||||
--dataset_num_proc 16 \
|
||||
--to_cached_dataset true \
|
||||
--output_dir ./seq_cls_cached_dataset
|
||||
|
||||
|
||||
# 18GiB
|
||||
CUDA_VISIBLE_DEVICES=0 \
|
||||
MAX_PIXELS=1003520 \
|
||||
swift sft \
|
||||
--model Qwen/Qwen2.5-Omni-3B \
|
||||
--tuner_type lora \
|
||||
--cached_dataset 'seq_cls_cached_dataset/train' \
|
||||
--cached_val_dataset 'seq_cls_cached_dataset/val' \
|
||||
--load_from_cache_file true \
|
||||
--torch_dtype bfloat16 \
|
||||
--num_train_epochs 1 \
|
||||
--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 2 \
|
||||
--packing true \
|
||||
--freeze_llm false \
|
||||
--freeze_vit true \
|
||||
--freeze_aligner true \
|
||||
--eval_steps 200 \
|
||||
--save_steps 200 \
|
||||
--logging_steps 5 \
|
||||
--max_length 4096 \
|
||||
--warmup_ratio 0.05 \
|
||||
--dataloader_num_workers 8 \
|
||||
--task_type seq_cls \
|
||||
--num_labels 265 \
|
||||
--problem_type single_label_classification \
|
||||
--use_chat_template true \
|
||||
--dataset_num_proc 8 \
|
||||
--save_total_limit 2 \
|
||||
--save_only_model true \
|
||||
--output_dir output/Qwen2.5-Omni-3B \
|
||||
--attn_impl flash_attn
|
||||
|
||||
# Use the validation set
|
||||
CUDA_VISIBLE_DEVICES=0 \
|
||||
MAX_PIXELS=1003520 \
|
||||
swift infer \
|
||||
--adapters output/Qwen2.5-Omni-3B/vx-xxx/checkpoint-xxx \
|
||||
--load_data_args true \
|
||||
--attn_impl flash_attn
|
||||
@@ -0,0 +1,38 @@
|
||||
# ms-swift>=3.11
|
||||
swift export \
|
||||
--model Qwen/Qwen2.5-7B \
|
||||
--dataset 'swift/Chinese-Qwen3-235B-2507-Distill-data-110k-SFT' \
|
||||
--dataset_num_proc 64 \
|
||||
--split_dataset_ratio 0.01 \
|
||||
--to_cached_dataset true \
|
||||
--output_dir ./qwen2_5_cached_dataset
|
||||
|
||||
# 4 * 44GiB; 15.5s/it
|
||||
PYTORCH_CUDA_ALLOC_CONF='expandable_segments:True' \
|
||||
NPROC_PER_NODE=4 \
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
swift sft \
|
||||
--model Qwen/Qwen2.5-7B \
|
||||
--tuner_type full \
|
||||
--cached_dataset './qwen2_5_cached_dataset/train' \
|
||||
--cached_val_dataset './qwen2_5_cached_dataset/val' \
|
||||
--num_train_epochs 3 \
|
||||
--torch_dtype bfloat16 \
|
||||
--per_device_train_batch_size 1 \
|
||||
--per_device_eval_batch_size 1 \
|
||||
--learning_rate 1e-5 \
|
||||
--gradient_accumulation_steps 4 \
|
||||
--packing true \
|
||||
--eval_steps 200 \
|
||||
--save_steps 200 \
|
||||
--logging_steps 5 \
|
||||
--max_length 8192 \
|
||||
--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,66 @@
|
||||
# ms-swift>=3.11
|
||||
OMP_NUM_THREADS=14 \
|
||||
MAX_PIXELS=1003520 \
|
||||
VIDEO_MAX_PIXELS=50176 \
|
||||
FPS_MAX_FRAMES=12 \
|
||||
swift export \
|
||||
--model Qwen/Qwen2.5-Omni-7B \
|
||||
--dataset 'AI-ModelScope/alpaca-gpt4-data-zh#10000' \
|
||||
'AI-ModelScope/LaTeX_OCR:human_handwrite#5000' \
|
||||
'speech_asr/speech_asr_aishell1_trainsets:validation#5000' \
|
||||
--split_dataset_ratio 0.01 \
|
||||
--dataset_num_proc 16 \
|
||||
--to_cached_dataset true \
|
||||
--output_dir ./qwen2_5_omni_cached_dataset
|
||||
|
||||
# 4 * 70GiB
|
||||
PYTORCH_CUDA_ALLOC_CONF='expandable_segments:True' \
|
||||
MAX_PIXELS=1003520 \
|
||||
VIDEO_MAX_PIXELS=50176 \
|
||||
FPS_MAX_FRAMES=12 \
|
||||
NPROC_PER_NODE=4 \
|
||||
ENABLE_AUDIO_OUTPUT=0 \
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
swift sft \
|
||||
--model Qwen/Qwen2.5-Omni-7B \
|
||||
--tuner_type full \
|
||||
--cached_dataset './qwen2_5_omni_cached_dataset/train' \
|
||||
--cached_val_dataset './qwen2_5_omni_cached_dataset/val' \
|
||||
--num_train_epochs 1 \
|
||||
--torch_dtype bfloat16 \
|
||||
--per_device_train_batch_size 1 \
|
||||
--per_device_eval_batch_size 1 \
|
||||
--learning_rate 1e-5 \
|
||||
--gradient_accumulation_steps 1 \
|
||||
--packing true \
|
||||
--freeze_llm false \
|
||||
--freeze_vit true \
|
||||
--freeze_aligner true \
|
||||
--eval_steps 200 \
|
||||
--save_steps 200 \
|
||||
--logging_steps 5 \
|
||||
--max_length 4096 \
|
||||
--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-Omni-7B \
|
||||
--deepspeed zero2 \
|
||||
--use_liger_kernel true \
|
||||
--attn_impl flash_attn
|
||||
|
||||
# Use the validation set
|
||||
CUDA_VISIBLE_DEVICES=0 \
|
||||
MAX_PIXELS=1003520 \
|
||||
VIDEO_MAX_PIXELS=50176 \
|
||||
FPS_MAX_FRAMES=12 \
|
||||
ENABLE_AUDIO_OUTPUT=0 \
|
||||
swift infer \
|
||||
--model output/Qwen2.5-Omni-7B/vx-xxx/checkpoint-xxx \
|
||||
--load_data_args true \
|
||||
--max_length 4096 \
|
||||
--attn_impl flash_attn \
|
||||
--stream true \
|
||||
--temperature 0 \
|
||||
--max_new_tokens 512
|
||||
Reference in New Issue
Block a user