ms-swift icon indicating copy to clipboard operation
ms-swift copied to clipboard

Qwen3VL-235B 转换到mcore过程失败, 产出目录下只有/runs文件夹, 没有模型文件

Open aub123 opened this issue 1 year ago • 4 comments

8*A800, ms-swift/megatron-swift 3.9.3官方镜像

转换Qwen3-VL-235B-A22B-Instruct到mcore格式失败, 产出目录下只有/runs文件夹, 没有模型文件

转换脚本如下:

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 \
swift export \
--model /xxxx/Qwen3-VL-235B-A22B-Instruct
--to_mcore true \
--torch_dtype bfloat16 \
--output_dir /xxxx/Qwen3-VL-235B-A22B-Instruct-mcore

运行log: /usr/local/lib/python3.11/site-packages/torch/cuda/init.py:63: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you. import pynvml # type: ignore[import] run sh: /usr/local/bin/python /gemini/space/mayilin/zc/Training/ms-swift_3.9/ms-swift-3.9.3/swift/cli/export.py --model /gemini/space/models/Qwen/Qwen3-VL-235B-A22B-Instruct --to_mcore true --torch_dtype bfloat16 --output_dir /gemini/space/mayilin/outputs/20251121/megatron_swift/Qwen3-VL-235B-A22B-Instruct-mcore_tp4pp4ep8 /usr/local/lib/python3.11/site-packages/torch/cuda/init.py:63: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you. import pynvml # type: ignore[import] [INFO:swift] Successfully registered /gemini/space/mayilin/zc/Training/ms-swift_3.9/ms-swift-3.9.3/swift/llm/dataset/data/dataset_info.json. [INFO:swift] rank: 0, local_rank: 0, world_size: 1, local_world_size: 1 torch_dtype is deprecated! Use dtype instead! [INFO:swift] Setting args.lazy_tokenize: True [INFO:swift] args.output_dir: /gemini/space/mayilin/outputs/20251121/megatron_swift/Qwen3-VL-235B-A22B-Instruct-mcore_tp4pp4ep8 [INFO:swift] Global seed set to 42 [INFO:swift] args: ExportArguments(model='/gemini/space/models/Qwen/Qwen3-VL-235B-A22B-Instruct', model_type='qwen3_moe_vl', model_revision=None, task_type='causal_lm', torch_dtype=torch.bfloat16, attn_impl=None, new_special_tokens=[], num_labels=None, problem_type=None, rope_scaling=None, device_map=None, max_memory={}, max_model_len=None, local_repo_path=None, init_strategy=None, template='qwen3_vl', system=None, max_length=2048, truncation_strategy='delete', max_pixels=None, agent_template=None, norm_bbox=None, use_chat_template=True, padding_free=False, padding_side='right', loss_scale='default', sequence_parallel_size=1, response_prefix=None, template_backend='swift', dataset=[], val_dataset=[], split_dataset_ratio=0.0, data_seed=42, dataset_num_proc=1, load_from_cache_file=False, dataset_shuffle=False, val_dataset_shuffle=False, streaming=False, interleave_prob=None, stopping_strategy='first_exhausted', shuffle_buffer_size=1000, download_mode='reuse_dataset_if_exists', columns={}, strict=False, remove_unused_columns=True, model_name=None, model_author=None, custom_dataset_info=[], quant_method=None, quant_bits=None, hqq_axis=None, bnb_4bit_compute_dtype=torch.bfloat16, bnb_4bit_quant_type='nf4', bnb_4bit_use_double_quant=True, bnb_4bit_quant_storage=None, max_new_tokens=None, temperature=None, top_k=None, top_p=None, repetition_penalty=None, num_beams=1, stream=False, stop_words=[], logprobs=False, top_logprobs=None, ckpt_dir=None, lora_modules=[], tuner_backend='peft', train_type='lora', adapters=[], external_plugins=[], seed=42, model_kwargs={}, load_args=True, load_data_args=False, packing=False, packing_length=None, lazy_tokenize=True, cached_dataset=[], custom_register_path=[], use_hf=False, hub_token=None, ddp_timeout=18000000, ddp_backend=None, ignore_args_error=False, use_swift_lora=False, merge_lora=False, safe_serialization=True, max_shard_size='5GB', output_dir='/gemini/space/mayilin/outputs/20251121/megatron_swift/Qwen3-VL-235B-A22B-Instruct-mcore_tp4pp4ep8', quant_n_samples=256, quant_batch_size=1, group_size=128, to_cached_dataset=False, to_ollama=False, to_mcore=True, to_hf=False, mcore_model=None, mcore_adapters=[], thread_count=None, test_convert_precision=False, test_convert_dtype=torch.float32, push_to_hub=False, hub_model_id=None, hub_private_repo=False, commit_message='update files', to_peft_format=False, exist_ok=False) [INFO:swift] Start time of running main: 2025-11-21 11:10:29.450105 [INFO:swift] swift.version: 3.9.3 /usr/local/lib/python3.11/site-packages/torch/distributed/distributed_c10d.py:4807: UserWarning: No device id is provided via init_process_group or barrier . Using the current device set by the user. warnings.warn( # warn only once [rank0]:[W1121 11:10:29.648023391 ProcessGroupNCCL.cpp:5023] [PG ID 0 PG GUID 0 Rank 0] using GPU 0 as device used by this process is currently unknown. This can potentially cause a hang if this rank to GPU mapping is incorrect. You can specify device_id in init_process_group() to force use of a particular device. [INFO:swift] Patch apply_rotary_pos_emb successfully applied. [INFO:swift] Patch _SplitAlongDim successfully applied. [INFO:swift] Patch FileSystemReader successfully applied. [INFO:swift] Patch peft successfully applied. [INFO:swift] megatron.core.version: 0.13.2 [INFO:swift] Patch tp_plan. [INFO:swift] model_kwargs: {'device_map': 'auto', 'dtype': torch.bfloat16} Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 96/96 [03:01<00:00, 1.89s/it] [INFO:swift] Setting max_ratio: 200. You can adjust this hyperparameter through the environment variable: MAX_RATIO. [INFO:swift] Setting frame_factor: 2. You can adjust this hyperparameter through the environment variable: FRAME_FACTOR. [INFO:swift] Setting fps: 2.0. You can adjust this hyperparameter through the environment variable: FPS. [INFO:swift] Setting fps_min_frames: 4. You can adjust this hyperparameter through the environment variable: FPS_MIN_FRAMES. [INFO:swift] Setting fps_max_frames: 768. You can adjust this hyperparameter through the environment variable: FPS_MAX_FRAMES. [INFO:swift] Setting image_max_token_num: 16384. You can adjust this hyperparameter through the environment variable: IMAGE_MAX_TOKEN_NUM. [INFO:swift] Setting image_min_token_num: 4. You can adjust this hyperparameter through the environment variable: IMAGE_MIN_TOKEN_NUM. [INFO:swift] Setting spatial_merge_size: 2. You can adjust this hyperparameter through the environment variable: SPATIAL_MERGE_SIZE. [INFO:swift] Setting video_max_token_num: 768. You can adjust this hyperparameter through the environment variable: VIDEO_MAX_TOKEN_NUM. [INFO:swift] Setting video_min_token_num: 128. You can adjust this hyperparameter through the environment variable: VIDEO_MIN_TOKEN_NUM. [INFO:swift] default_system: None [INFO:swift] max_length: 2048 [INFO:swift] response_prefix: '' [INFO:swift] agent_template: hermes [INFO:swift] norm_bbox: norm1000 [INFO:swift] Setting ROOT_IMAGE_DIR: None. You can adjust this hyperparameter through the environment variable: ROOT_IMAGE_DIR. [INFO:swift] Setting QWENVL_BBOX_FORMAT: legacy. You can adjust this hyperparameter through the environment variable: QWENVL_BBOX_FORMAT. [INFO:swift] megatron_config: {'hidden_size': 4096, 'untie_embeddings_and_output_weights': True, 'architectures': 'Qwen3VLMoeForConditionalGeneration', 'num_layers': 94, 'num_attention_heads': 64, 'num_query_groups': 4, 'max_position_embeddings': 262144, 'norm_epsilon': 1e-06, 'rotary_base': 5000000, 'padded_vocab_size': 151936, 'attention_dropout': 0.0, 'swiglu': True, 'add_qkv_bias': False, 'kv_channels': 128, 'moe_ffn_hidden_size': 1536, 'moe_router_topk': 8, 'num_experts': 128, 'moe_router_pre_softmax': False, 'rope_scaling': {'mrope_interleaved': True, 'mrope_section': [24, 20, 20], 'rope_type': 'default'}, 'qk_layernorm': True, 'position_embedding_type': 'mrope', 'mrope_section': [24, 20, 20], 'mrope_interleaved': True} [INFO:swift] Setting args.no_rope_fusion: False. using world size: 1, data-parallel size: 1, context-parallel size: 1, hierarchical context-parallel sizes: None, tensor-model-parallel size: 1, encoder-tensor-model-parallel size: 0, pipeline-model-parallel size: 1, encoder-pipeline-model-parallel size: 0 Number of virtual stages per pipeline stage: None accumulate and all-reduce gradients in fp32 for bfloat16 data type. using torch.bfloat16 for parameters ... ------------------------ arguments ------------------------ account_for_embedding_in_pipeline_split ......... False account_for_loss_in_pipeline_split .............. False accumulate_allreduce_grads_in_fp32 .............. True adam_beta1 ...................................... 0.9 adam_beta2 ...................................... 0.95 adam_eps ........................................ 1e-08 adapter_load .................................... None add_bias_linear ................................. False add_position_embedding .......................... True add_qkv_bias .................................... False adlr_autoresume ................................. False adlr_autoresume_interval ........................ 1000 align_grad_reduce ............................... True align_param_gather .............................. False app_tag_run_name ................................ None app_tag_run_version ............................. 0.0.0 apply_layernorm_1p .............................. False apply_query_key_layer_scaling ................... False apply_residual_connection_post_layernorm ........ False apply_rope_fusion ............................... False architectures ................................... Qwen3VLMoeForConditionalGeneration async_save ...................................... None async_tensor_model_parallel_allreduce ........... True attention_backend ............................... AttnBackend.unfused attention_dropout ............................... 0.0 attention_softmax_in_fp32 ....................... True auto_detect_ckpt_format ......................... True barrier_with_L1_time ............................ True bert_binary_head ................................ True bert_embedder_type .............................. megatron bert_load ....................................... None beta ............................................ 0.1 bf16 ............................................ True bias_dropout_fusion ............................. True bias_gelu_fusion ................................ False bias_swiglu_fusion .............................. True biencoder_projection_dim ........................ 0 biencoder_shared_query_context_model ............ False block_data_path ................................. None calc_ft_timeouts ................................ False calculate_KL .................................... None calculate_per_token_loss ........................ True center_rewards_coefficient ...................... None check_for_large_grads ........................... False check_for_nan_in_loss_and_grad .................. True check_for_spiky_loss ............................ False check_weight_hash_across_dp_replicas_interval ... None ckpt_assume_constant_structure .................. False ckpt_convert_format ............................. None ckpt_convert_save ............................... None ckpt_convert_update_legacy_dist_opt_format ...... False ckpt_format ..................................... torch_dist ckpt_fully_parallel_load ........................ False ckpt_fully_parallel_save ........................ True ckpt_fully_parallel_save_deprecated ............. False ckpt_step ....................................... None classes_fraction ................................ 1.0 clip_grad ....................................... 1.0 clone_scatter_output_in_embedding ............... True config_logger_dir ............................... consumed_train_samples .......................... 0 consumed_valid_samples .......................... 0 context_parallel_size ........................... 1 cp_comm_type .................................... ['p2p'] create_attention_mask_in_dataloader ............. True cross_entropy_fusion_impl ....................... native cross_entropy_loss_fusion ....................... False cuda_graph_scope ................................ full cuda_graph_warmup_steps ......................... 3 data_args_path .................................. None data_cache_path ................................. None data_parallel_random_init ....................... False data_parallel_sharding_strategy ................. no_shard data_parallel_size .............................. 1 data_path ....................................... None data_per_class_fraction ......................... 1.0 data_sharding ................................... True dataloader_persistent_workers ................... True dataloader_prefetch_factor ...................... 10 dataloader_type ................................. cyclic ddp_average_in_collective ....................... False ddp_bucket_size ................................. None ddp_num_buckets ................................. None ddp_pad_buckets_for_high_nccl_busbw ............. False decoder_first_pipeline_num_layers ............... None decoder_last_pipeline_num_layers ................ None decoder_num_layers .............................. None decoder_seq_length .............................. None decoupled_lr .................................... None decoupled_min_lr ................................ None decrease_batch_size_if_needed ................... False defer_embedding_wgrad_compute ................... False delay_wgrad_compute ............................. False deprecated_use_mcore_models ..................... False desirable_weight ................................ 1.0 deterministic_mode .............................. False dino_bottleneck_size ............................ 256 dino_freeze_last_layer .......................... 1 dino_head_hidden_size ........................... 2048 dino_local_crops_number ......................... 10 dino_local_img_size ............................. 96 dino_norm_last_layer ............................ False dino_teacher_temp ............................... 0.07 dino_warmup_teacher_temp ........................ 0.04 dino_warmup_teacher_temp_epochs ................. 30 disable_bf16_reduced_precision_matmul ........... False disable_mamba_mem_eff_path ...................... False disable_straggler_on_startup .................... False dist_ckpt_format_deprecated ..................... None dist_ckpt_strictness ............................ assume_ok_unexpected distribute_saved_activations .................... False distributed_backend ............................. nccl distributed_timeout_minutes ..................... 300000 embedding_path .................................. None empty_unused_memory_level ....................... 0 enable_channel_loss ............................. False enable_cuda_graph ............................... False enable_dft_loss ................................. False enable_experimental ............................. False enable_ft_package ............................... False enable_gloo_process_groups ...................... True enable_msc ...................................... True enable_one_logger ............................... True encoder_num_layers .............................. 94 encoder_pipeline_model_parallel_size ............ 0 encoder_seq_length .............................. 262144 encoder_tensor_model_parallel_size .............. 0 end_weight_decay ................................ 0.1 eod_mask_loss ................................... False error_injection_rate ............................ 0 error_injection_type ............................ transient_error eval_interval ................................... 500 eval_iters ...................................... -1 evidence_data_path .............................. None exit_duration_in_mins ........................... None exit_interval ................................... None exit_on_missing_checkpoint ...................... True exit_signal_handler ............................. False exp_avg_dtype ................................... torch.float32 exp_avg_sq_dtype ................................ torch.float32 expert_model_parallel_size ...................... 1 expert_tensor_parallel_size ..................... 1 external_cuda_graph ............................. False f_divergence_type ............................... reverse_kl ffn_hidden_size ................................. 10880 finetune ........................................ True first_last_layers_bf16 .......................... False flash_decode .................................... False fp16 ............................................ False fp16_lm_cross_entropy ........................... False fp32_residual_connection ........................ False fp8 ............................................. None fp8_amax_compute_algo ........................... max fp8_amax_history_len ............................ 1024 fp8_interval .................................... 1 fp8_margin ...................................... 0 fp8_param_gather ................................ False fp8_recipe ...................................... delayed fp8_wgrad ....................................... True freeze_aligner .................................. True freeze_llm ...................................... False freeze_parameters ............................... [] freeze_parameters_ratio ......................... 0.0 freeze_parameters_regex ......................... None freeze_vit ...................................... True fsdp_double_buffer .............................. False global_batch_size ............................... 16 grad_reduce_in_bf16 ............................. False gradient_accumulation_fusion .................... True gradient_checkpointing_kwargs ................... None gradient_reduce_div_fusion ...................... True group_query_attention ........................... True head_lr_mult .................................... 1.0 heterogeneous_layers_config_encoded_json ........ None heterogeneous_layers_config_path ................ None hidden_dropout .................................. 0.0 hidden_size ..................................... 4096 hierarchical_context_parallel_sizes ............. None high_priority_stream_groups ..................... [] hybrid_attention_ratio .......................... 0.0 hybrid_mlp_ratio ................................ 0.0 hybrid_override_pattern ......................... None hysteresis ...................................... 2 ict_head_size ................................... None ict_load ........................................ None img_h ........................................... 224 img_w ........................................... 224 indexer_batch_size .............................. 128 indexer_log_interval ............................ 1000 inference_batch_times_seqlen_threshold .......... -1 inference_dynamic_batching ...................... False inference_dynamic_batching_buffer_guaranteed_fraction 0.2 inference_dynamic_batching_buffer_overflow_factor None inference_dynamic_batching_buffer_size_gb ....... 40.0 inference_dynamic_batching_chunk_size ........... 256 inference_dynamic_batching_max_requests_override None inference_dynamic_batching_max_tokens_override .. None inference_max_batch_size ........................ 8 inference_max_seq_length ........................ 2560 inference_rng_tracker ........................... False init_method_std ................................. 0.02 init_method_xavier_uniform ...................... False init_model_with_meta_device ..................... False initial_loss_scale .............................. 4294967296 initialize_embedding ............................ False inprocess_active_world_size ..................... 1 inprocess_barrier_timeout ....................... 120 inprocess_completion_timeout .................... 120 inprocess_empty_cuda_cache ...................... False inprocess_granularity ........................... node inprocess_hard_timeout .......................... 90 inprocess_heartbeat_interval .................... 30 inprocess_heartbeat_timeout ..................... 60 inprocess_last_call_wait ........................ 1 inprocess_max_iterations ........................ None inprocess_monitor_process_interval .............. 1.0 inprocess_monitor_thread_interval ............... 1.0 inprocess_progress_watchdog_interval ............ 1.0 inprocess_restart ............................... False inprocess_soft_timeout .......................... 60 inprocess_termination_grace_time ................ 1 is_hybrid_model ................................. False iter_per_epoch .................................. 1250 iterations_to_skip .............................. [] keep_fp8_transpose_cache_when_using_custom_fsdp . False kitchen_config_file ............................. None kitchen_recipe_number ........................... None kv_channels ..................................... 128 kv_lora_rank .................................... 32 label_smoothing ................................. 0.0 layer_types ..................................... None lazy_mpu_init ................................... None linear_conv_kernel_dim .......................... None linear_key_head_dim ............................. None linear_num_key_heads ............................ None linear_num_value_heads .......................... None linear_value_head_dim ........................... None llm_architectures ............................... None load ............................................ None load_model_opt_format ........................... False local_rank ...................................... 0 log_energy ...................................... False log_interval .................................... 5 log_loss_scale_to_tensorboard ................... True log_memory_to_tensorboard ....................... True log_num_zeros_in_grad ........................... False log_params_norm ................................. False log_progress .................................... False log_straggler ................................... False log_throughput .................................. False log_timers_to_tensorboard ....................... True log_validation_ppl_to_tensorboard ............... True log_world_size_to_tensorboard ................... False logging_level ................................... None lora_alpha ...................................... 32 lora_bias ....................................... none lora_dropout .................................... 0.05 lora_dtype ...................................... None lora_rank ....................................... 8 loss_scale ...................................... None loss_scale_window ............................... 1000 loss_type ....................................... None lr .............................................. 1e-05 lr_decay_iters .................................. None lr_decay_samples ................................ None lr_decay_style .................................. cosine lr_warmup_fraction .............................. None lr_warmup_init .................................. 0.0 lr_warmup_iters ................................. 0 lr_warmup_samples ............................... 0 lr_wsd_decay_iters .............................. None lr_wsd_decay_samples ............................ None lr_wsd_decay_style .............................. exponential main_grads_dtype ................................ torch.float32 main_params_dtype ............................... torch.float32 make_vocab_size_divisible_by .................... 128 mamba_head_dim .................................. 64 mamba_num_groups ................................ 8 mamba_num_heads ................................. None mamba_state_dim ................................. 128 manual_gc ....................................... False manual_gc_eval .................................. True manual_gc_interval .............................. 0 mask_factor ..................................... 1.0 mask_prob ....................................... 0.15 mask_type ....................................... random masked_softmax_fusion ........................... True max_epochs ...................................... None max_position_embeddings ......................... 262144 max_tokens_to_oom ............................... 12000 megatron_model_meta ............................. MMGPTMegatronModelMeta(megatron_model_type='qwen3_vl', model_types=['qwen3_vl', 'qwen3_moe_vl'], convert_mcore2hf=<function convert_mcore2hf_qwen3_vl at 0x7fc7cc767100>, convert_hf2mcore=<function convert_hf2mcore_qwen3_vl at 0x7fc7cc766980>, model_cls=<class 'swift.megatron.model.mm_gpt.qwen3_vl.Qwen3VLGPTModel'>, convert_hf_config=<function convert_gpt_hf_config at 0x7fc7cc907a60>, get_transformer_layer_spec=None, model_provider=<function model_provider at 0x7fc7cc9065c0>, visual_cls=<class 'swift.megatron.model.mm_gpt.qwen3_vl.Qwen3VL_Vit'>, extra_args_provider=None) memory_snapshot_path ............................ snapshot.pickle merge_file ...................................... None micro_batch_size ................................ 1 microbatch_group_size_per_vp_stage .............. None mid_level_dataset_surplus ....................... 0.005 min_loss_scale .................................. 1.0 min_lr .......................................... 0.0 mlp_chunks_for_prefill .......................... 1 mlp_padding_free ................................ False mmap_bin_files .................................. True mock_data ....................................... False model_info ...................................... ModelInfo(model_type='qwen3_moe_vl', model_dir='/gemini/space/models/Qwen/Qwen3-VL-235B-A22B-Instruct', torch_dtype=torch.bfloat16, max_model_len=262144, quant_method=None, quant_bits=None, rope_scaling={'mrope_interleaved': True, 'mrope_section': [24, 20, 20], 'rope_type': 'default'}, is_moe_model=True, config=None, task_type='causal_lm', num_labels=None) model_meta ...................................... ModelMeta(model_type='qwen3_moe_vl', model_groups=[ModelGroup(models=[Model(ms_model_id='Qwen/Qwen3-VL-30B-A3B-Instruct', hf_model_id='Qwen/Qwen3-VL-30B-A3B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen3-VL-30B-A3B-Thinking', hf_model_id='Qwen/Qwen3-VL-30B-A3B-Thinking', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen3-VL-30B-A3B-Instruct-FP8', hf_model_id='Qwen/Qwen3-VL-30B-A3B-Instruct-FP8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen3-VL-30B-A3B-Thinking-FP8', hf_model_id='Qwen/Qwen3-VL-30B-A3B-Thinking-FP8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen3-VL-235B-A22B-Instruct', hf_model_id='Qwen/Qwen3-VL-235B-A22B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen3-VL-235B-A22B-Thinking', hf_model_id='Qwen/Qwen3-VL-235B-A22B-Thinking', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen3-VL-235B-A22B-Instruct-FP8', hf_model_id='Qwen/Qwen3-VL-235B-A22B-Instruct-FP8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen3-VL-235B-A22B-Thinking-FP8', hf_model_id='Qwen/Qwen3-VL-235B-A22B-Thinking-FP8', model_path=None, ms_revision=None, hf_revision=None)], ignore_patterns=None, requires=None, tags=[])], template='qwen3_vl', get_function=<function get_model_tokenizer_qwen3_moe_vl at 0x7fc8dd11bd80>, model_arch=MultiModelKeys(arch_name='qwen3_vl', embedding=None, module_list=None, lm_head=None, q_proj=None, k_proj=None, v_proj=None, o_proj=None, attention=None, mlp=None, down_proj=None, qkv_proj=None, qk_proj=None, qa_proj=None, qb_proj=None, kv_proj=None, kva_proj=None, kvb_proj=None, language_model=['model.language_model'], aligner=['model.visual.merger', 'model.visual.deepstack_merger_list'], vision_tower=['model.visual'], generator=[]), architectures=['Qwen3VLMoeForConditionalGeneration'], additional_saved_files=[], torch_dtype=None, is_multimodal=True, is_reward=False, task_type=None, ignore_patterns=None, requires=['transformers>=4.57', 'qwen_vl_utils>=0.0.14', 'decord'], tags=['vision', 'video']) modules_to_save ................................. [] moe_apply_probs_on_input ........................ False moe_aux_loss_coeff .............................. 0.0 moe_deepep_num_sms .............................. 20 moe_enable_deepep ............................... False moe_expert_capacity_factor ...................... None moe_extended_tp ................................. False moe_ffn_hidden_size ............................. 1536 moe_grouped_gemm ................................ True moe_input_jitter_eps ............................ None moe_layer_freq .................................. 1 moe_layer_recompute ............................. False moe_pad_expert_input_to_capacity ................ False moe_per_layer_logging ........................... False moe_permute_fusion .............................. False moe_router_bias_update_rate ..................... 0.001 moe_router_dtype ................................ fp32 moe_router_enable_expert_bias ................... False moe_router_force_load_balancing ................. False moe_router_group_topk ........................... None moe_router_load_balancing_type .................. aux_loss moe_router_num_groups ........................... None moe_router_padding_for_fp8 ...................... False moe_router_pre_softmax .......................... False moe_router_score_function ....................... softmax moe_router_topk ................................. 8 moe_router_topk_scaling_factor .................. None moe_shared_expert_intermediate_size ............. None moe_shared_expert_overlap ....................... False moe_token_dispatcher_type ....................... alltoall moe_token_drop_policy ........................... probs moe_upcycling_granularity ....................... 1 moe_use_legacy_grouped_gemm ..................... False moe_use_upcycling ............................... False moe_z_loss_coeff ................................ None mrope_interleaved ............................... True mrope_section ................................... [24, 20, 20] mscale .......................................... 1.0 mscale_all_dim .................................. 1.0 mtp_loss_scaling_factor ......................... 0.1 mtp_num_layers .................................. None multi_latent_attention .......................... False nccl_all_reduce_for_prefill ..................... False nccl_communicator_config_path ................... None nccl_ub ......................................... False no_load_optim ................................... True no_load_rng ..................................... True no_persist_layer_norm ........................... False no_rope_freq .................................... None no_save_optim ................................... True no_save_rng ..................................... True non_persistent_ckpt_type ........................ None non_persistent_global_ckpt_dir .................. None non_persistent_local_ckpt_algo .................. fully_parallel non_persistent_local_ckpt_dir ................... None non_persistent_save_interval .................... None norm_epsilon .................................... 1e-06 normalization ................................... RMSNorm num_attention_heads ............................. 64 num_channels .................................... 3 num_classes ..................................... 1000 num_dataset_builder_threads ..................... 1 num_distributed_optimizer_instances ............. 1 num_experts ..................................... 128 num_labels ...................................... None num_layers ...................................... 94 num_layers_at_end_in_bf16 ....................... 1 num_layers_at_start_in_bf16 ..................... 1 num_layers_per_virtual_pipeline_stage ........... None num_query_groups ................................ 4 num_virtual_stages_per_pipeline_rank ............ None num_workers ..................................... 4 object_storage_cache_path ....................... None one_logger_async ................................ False one_logger_project .............................. megatron-lm one_logger_run_name ............................. None onnx_safe ....................................... None openai_gelu ..................................... False optimizer ....................................... adam optimizer_cpu_offload ........................... False optimizer_offload_fraction ...................... 1.0 original_max_position_embeddings ................ None output_bert_embeddings .......................... False overlap_cpu_optimizer_d2h_h2d ................... False overlap_grad_reduce ............................. False overlap_p2p_comm ................................ False overlap_p2p_comm_warmup_flush ................... False overlap_param_gather ............................ False overlap_param_gather_with_optimizer_step ........ False override_opt_param_scheduler .................... False padded_vocab_size ............................... 151936 padding_free .................................... True params_dtype .................................... torch.bfloat16 partial_rotary_factor ........................... None patch_dim ....................................... 16 per_split_data_args_path ........................ None perform_initialization .......................... False pin_cpu_grads ................................... True pin_cpu_params .................................. True pipeline_model_parallel_comm_backend ............ None pipeline_model_parallel_layout .................. None pipeline_model_parallel_size .................... 1 pipeline_model_parallel_split_rank .............. None position_embedding_type ......................... mrope pretrained_checkpoint ........................... None problem_type .................................... None profile ......................................... False profile_ranks ................................... [0] profile_step_end ................................ 12 profile_step_start .............................. 10 q_lora_rank ..................................... None qk_head_dim ..................................... 128 qk_l2_norm ...................................... False qk_layernorm .................................... True qk_pos_emb_head_dim ............................. 64 query_in_block_prob ............................. 0.1 rampup_batch_size ............................... None rank ............................................ 0 recompute_granularity ........................... selective recompute_method ................................ None recompute_modules ............................... ['core_attn'] recompute_num_layers ............................ None record_memory_history ........................... False ref_adapter_load ................................ None ref_load ........................................ None reference_free .................................. False relative_attention_max_distance ................. 128 relative_attention_num_buckets .................. 32 replication ..................................... False replication_factor .............................. 2 replication_jump ................................ None rerun_mode ...................................... disabled reset_attention_mask ............................ False reset_position_ids .............................. False result_rejected_tracker_filename ................ None retriever_report_topk_accuracies ................ [] retriever_score_scaling ......................... False retriever_seq_length ............................ 256 retro_add_retriever ............................. False retro_attention_gate ............................ 1 retro_cyclic_train_iters ........................ None retro_encoder_attention_dropout ................. 0.1 retro_encoder_hidden_dropout .................... 0.1 retro_encoder_layers ............................ 2 retro_num_neighbors ............................. 2 retro_num_retrieved_chunks ...................... 2 retro_project_dir ............................... None retro_verify_neighbor_count ..................... True reuse_grad_buf_for_mxfp8_param_ag ............... False rlhf_type ....................................... None rope_scaling .................................... {'mrope_interleaved': True, 'mrope_section': [24, 20, 20], 'rope_type': 'default'} rope_scaling_factor ............................. 8.0 rotary_base ..................................... 5000000 rotary_interleaved .............................. False rotary_percent .................................. 1.0 rotary_scaling_factor ........................... 1.0 rotary_seq_len_interpolation_factor ............. None rpo_alpha ....................................... None run_workload_inspector_server ................... False sample_rate ..................................... 1.0 save ............................................ /gemini/space/mayilin/outputs/20251121/megatron_swift/Qwen3-VL-235B-A22B-Instruct-mcore_tp4pp4ep8 save_interval ................................... 500 scatter_gather_tensors_in_pipeline .............. True seed ............................................ 42 seq_length ...................................... 262144 sequence_parallel ............................... False sft ............................................. False sft_tokenizer_prompt_format ..................... nemotron-h-aligned sgd_momentum .................................... 0.9 short_seq_prob .................................. 0.1 skip_train ...................................... False skipped_train_samples ........................... 0 spec ............................................ None split ........................................... None squared_relu .................................... False start_weight_decay .............................. 0.1 straggler_ctrlr_port ............................ 65535 straggler_minmax_count .......................... 1 suggested_communication_unit_size ............... None swiglu .......................................... True swin_backbone_type .............................. tiny symmetric_ar_type ............................... None target_modules .................................. ['all-linear'] target_regex .................................... None task_type ....................................... causal_lm te_rng_tracker .................................. False tensor_model_parallel_size ...................... 1 tensorboard_dir ................................. /gemini/space/mayilin/outputs/20251121/megatron_swift/Qwen3-VL-235B-A22B-Instruct-mcore_tp4pp4ep8/runs tensorboard_log_interval ........................ 1 tensorboard_queue_size .......................... 50 test_data_path .................................. None test_mode ....................................... False tiktoken_num_special_tokens ..................... 1000 tiktoken_pattern ................................ None tiktoken_special_tokens ......................... None timing_log_level ................................ 0 timing_log_option ............................... minmax titles_data_path ................................ None tokenizer_model ................................. None tokenizer_type .................................. None torch_dtype ..................................... torch.bfloat16 torch_fsdp2_reshard_after_forward ............... True tp_comm_bootstrap_backend ....................... nccl tp_comm_bulk_dgrad .............................. True tp_comm_bulk_wgrad .............................. True tp_comm_overlap ................................. False tp_comm_overlap_ag .............................. True tp_comm_overlap_cfg ............................. None tp_comm_overlap_rs .............................. True tp_comm_overlap_rs_dgrad ........................ False tp_comm_split_ag ................................ True tp_comm_split_rs ................................ True train_data_path ................................. None train_iters ..................................... None train_samples ................................... None train_sync_interval ............................. None train_type ...................................... full trainable_parameters ............................ [] trainable_parameters_regex ...................... None transformer_impl ................................ transformer_engine transformer_pipeline_model_parallel_size ........ 1 undesirable_weight .............................. 1.0 untie_embeddings_and_output_weights ............. True use_checkpoint_args ............................. False use_checkpoint_opt_param_scheduler .............. False use_cpu_initialization .......................... True use_custom_fsdp ................................. False use_dist_ckpt ................................... True use_dist_ckpt_deprecated ........................ False use_distributed_optimizer ....................... True use_flash_attn .................................. False use_legacy_models ............................... False use_mp_args_from_checkpoint_args ................ False use_one_sent_docs ............................... False use_persistent_ckpt_worker ...................... False use_precision_aware_optimizer ................... False use_pytorch_profiler ............................ False use_ring_exchange_p2p ........................... False use_rope_scaling ................................ False use_rotary_position_embeddings .................. False use_rslora ...................................... False use_shared_expert_gate .......................... False use_sharp ....................................... False use_tokenizer_model_from_checkpoint_args ........ True use_torch_fsdp2 ................................. False use_torch_optimizer_for_cpu_offload ............. False use_tp_pp_dp_mapping ............................ False v_head_dim ...................................... 128 valid_data_path ................................. None variable_seq_lengths ............................ False virtual_pipeline_model_parallel_size ............ None vision_backbone_type ............................ vit vision_pretraining .............................. False vision_pretraining_type ......................... classify vit_gradient_checkpointing ...................... True vocab_extra_ids ................................. 0 vocab_file ...................................... None vocab_size ...................................... None wandb_exp_name .................................. wandb_project ................................... wandb_save_dir .................................. weight_decay .................................... 0.1 weight_decay_incr_style ......................... constant wgrad_deferral_limit ............................ 0 world_size ...................................... 1 yaml_cfg ........................................ None -------------------- end of arguments ---------------------

setting tensorboard ... WARNING: one_logger package is required to enable e2e metrics tracking. please go to https://confluence.nvidia.com/display/MLWFO/Package+Repositories for details to install it WARNING:megatron.core.rerun_state_machine:RerunStateMachine initialized in mode RerunMode.DISABLED torch distributed is already initialized, skipping initialization ... [Gloo] Rank 0 is connected to 0 peer ranks. Expected number of connected peer ranks is : 0 [Gloo] Rank 0 is connected to 0 peer ranks. Expected number of connected peer ranks is : 0 [Gloo] Rank 0 is connected to 0 peer ranks. Expected number of connected peer ranks is : 0 initialized tensor model parallel with size 1 initialized pipeline model parallel with size 1 setting random seeds to 42 ... compiling dataset index builder ... make: 进入目录“/root/.cache/modelscope/_github/Megatron-LM/megatron/core/datasets” make: 对“default”无需做任何事。 make: 离开目录“/root/.cache/modelscope/_github/Megatron-LM/megatron/core/datasets”

done with dataset index builder. Compilation time: 0.373 seconds WARNING: constraints for invoking optimized fused softmax kernel are not met. We default back to unfused kernel invocations. compiling and loading fused kernels ... /usr/local/lib/python3.11/site-packages/torch/distributed/distributed_c10d.py:4807: UserWarning: No device id is provided via init_process_group or barrier . Using the current device set by the user. warnings.warn( # warn only once done with compiling and loading fused kernels. Compilation time: 0.070 seconds building GPT model ... /root/.cache/modelscope/_github/Megatron-LM/megatron/core/transformer/transformer_config.py:837: UserWarning: If you are using transformer_engine as the transformer implementation, the core_attn is from transformer_engine and may be the fused version. For fused attention, you have no need to set 'core_attn' to recompute. Please check that the core_attn recompute is really needed. warnings.warn( /usr/local/lib/python3.11/site-packages/transformer_engine/pytorch/cpu_offload.py:695: DeprecationWarning: Offloading weights is deprecated. Using offload_weights=True does not have any effect. warnings.warn( [INFO:swift] Patch tp_plan. [INFO:swift] model_kwargs: {'device_map': 'auto', 'dtype': torch.bfloat16} [INFO:swift] Megatron model created successfully.

aub123 avatar Nov 21 '25 03:11 aub123

看看是不是内存不足,中途退出了,如果成功会有成功转换的 日志提示

Jintao-Huang avatar Nov 21 '25 03:11 Jintao-Huang

看看是不是内存不足,中途退出了,如果成功会有成功转换的 日志提示

加到 1T 之后可以转换了,但是训练加载还是有点问题

aub123 avatar Nov 21 '25 13:11 aub123

請問加載 Qwen3-VL mcore 模型時有遇到 KeyError: 'model' 錯誤嗎?

swift export --model Qwen/Qwen3-VL-8B-Instruct  \
--to_mcore true --torch_dtype bfloat16          \
--output_dir ./Qwen3-VL-8B-Instruct-mcore

錯誤:

[rank0]: Traceback (most recent call last):                 
[rank0]:   File "Megatron-LM-dev/pretrain_vlm.py", line 442, in <module>
[rank0]:     pretrain(
[rank0]:   File "Megatron-LM-dev/megatron/training/training.py", line 715, in pretrain
[rank0]:     model, optimizer, opt_param_scheduler = setup_model_and_optimizer(
[rank0]:                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File "Megatron-LM-dev/megatron/training/training.py", line 1317, in setup_model_and_optimizer
[rank0]:     args.iteration, args.num_floating_point_operations_so_far = load_checkpoint(
[rank0]:                                                                 ^^^^^^^^^^^^^^^^
[rank0]:   File "Megatron-LM/megatron/training/checkpointing.py", line 1703, in load_checkpoint
[rank0]:     load_model_state_dict(ddp_model[0], state_dict['model'], strict)
[rank0]:                                         ~~~~~~~~~~^^^^^^^^^                      
[rank0]: KeyError: 'model'  

hychiang-git avatar Jan 19 '26 21:01 hychiang-git

看看是不是内存不足,中途退出了,如果成功会有成功转换的 日志提示

加到 1T 之后可以转换了,但是训练加载还是有点问题

训练加载我也出现了问题,根本加载不进去,是为什么呀 @aub123 @Jintao-Huang

robotsp avatar Feb 03 '26 07:02 robotsp