modelscope / modelscope/ms-swift

Exporting mxfp8 quantization with `use_cpu_initialization` enabled seemingly causes a VRAM leak

Open
#9,620 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
15.7k
Forks
1.7k
Avg merge
1d 16h
Merged PRs (30d)
136

Description

Checklist / 检查清单
  • I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。
Bug Description / Bug 描述

在我尝试使用megatron量化模型为mxfp8时, 显存被占满且产生驱动错误:
Image
这台设备的显存足以完成同一个模型的微调, 而且由显存占用曲线看, 似乎是存在泄露.

How to Reproduce / 如何复现

以下是启动参数和运行日志:

(swift_megatron) root@hypnoshv:~/maica_llm/esft# bash quant_fp8.sh 
BMC is:
/root/maica_llm/esft/megatron_output/Qwen3.5-397B-A17B/v42-20260622-143501/checkpoint-15-merged
run sh: `/root/swift_megatron/bin/python -m torch.distributed.run --nproc_per_node 10 /root/swift/swift/cli/_megatron/export.py --model /root/maica_llm/esft/megatron_output/Qwen3.5-397B-A17B/v42-20260622-143501/checkpoint-15-merged --quant_method fp8 --output_dir /root/maica_llm/esft/megatron_output/Qwen3.5-397B-A17B/v42-20260622-143501/checkpoint-15-merged-FP8 --to_hf true --fp8_recipe mxfp8 --fp8_format e4m3 --fp8_param_gather true --linear_decoupled_in_proj true --pipeline_model_parallel_size 10 --pipeline_model_parallel_layout Et*6,(|t*6)*8,|t*6L --device_map cpu --use_cpu_initialization true`

*****************************************
Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. 
*****************************************
/root/swift_megatron/lib/python3.11/site-packages/transformer_engine/jax/sharding.py:23: DeprecationWarning: jax.interpreters.pxla.thread_resources is deprecated as of JAX v0.8.2. Please switch to using `with jax.set_mesh(mesh)` instead of `with mesh:` and then use `jax.sharding.get_abstract_mesh()` to get the current mesh.
  _PXLA_THREAD_RESOURCES = pxla.thread_resources
/root/swift_megatron/lib/python3.11/site-packages/transformer_engine/jax/sharding.py:23: DeprecationWarning: jax.interpreters.pxla.thread_resources is deprecated as of JAX v0.8.2. Please switch to using `with jax.set_mesh(mesh)` instead of `with mesh:` and then use `jax.sharding.get_abstract_mesh()` to get the current mesh.
  _PXLA_THREAD_RESOURCES = pxla.thread_resources
/root/swift_megatron/lib/python3.11/site-packages/transformer_engine/jax/sharding.py:23: DeprecationWarning: jax.interpreters.pxla.thread_resources is deprecated as of JAX v0.8.2. Please switch to using `with jax.set_mesh(mesh)` instead of `with mesh:` and then use `jax.sharding.get_abstract_mesh()` to get the current mesh.
  _PXLA_THREAD_RESOURCES = pxla.thread_resources
/root/swift_megatron/lib/python3.11/site-packages/transformer_engine/jax/sharding.py:23: DeprecationWarning: jax.interpreters.pxla.thread_resources is deprecated as of JAX v0.8.2. Please switch to using `with jax.set_mesh(mesh)` instead of `with mesh:` and then use `jax.sharding.get_abstract_mesh()` to get the current mesh.
  _PXLA_THREAD_RESOURCES = pxla.thread_resources
/root/swift_megatron/lib/python3.11/site-packages/transformer_engine/jax/sharding.py:23: DeprecationWarning: jax.interpreters.pxla.thread_resources is deprecated as of JAX v0.8.2. Please switch to using `with jax.set_mesh(mesh)` instead of `with mesh:` and then use `jax.sharding.get_abstract_mesh()` to get the current mesh.
  _PXLA_THREAD_RESOURCES = pxla.thread_resources
/root/swift_megatron/lib/python3.11/site-packages/transformer_engine/jax/sharding.py:23: DeprecationWarning: jax.interpreters.pxla.thread_resources is deprecated as of JAX v0.8.2. Please switch to using `with jax.set_mesh(mesh)` instead of `with mesh:` and then use `jax.sharding.get_abstract_mesh()` to get the current mesh.
  _PXLA_THREAD_RESOURCES = pxla.thread_resources
/root/swift_megatron/lib/python3.11/site-packages/transformer_engine/jax/sharding.py:23: DeprecationWarning: jax.interpreters.pxla.thread_resources is deprecated as of JAX v0.8.2. Please switch to using `with jax.set_mesh(mesh)` instead of `with mesh:` and then use `jax.sharding.get_abstract_mesh()` to get the current mesh.
  _PXLA_THREAD_RESOURCES = pxla.thread_resources
/root/swift_megatron/lib/python3.11/site-packages/transformer_engine/jax/sharding.py:23: DeprecationWarning: jax.interpreters.pxla.thread_resources is deprecated as of JAX v0.8.2. Please switch to using `with jax.set_mesh(mesh)` instead of `with mesh:` and then use `jax.sharding.get_abstract_mesh()` to get the current mesh.
  _PXLA_THREAD_RESOURCES = pxla.thread_resources
/root/swift_megatron/lib/python3.11/site-packages/transformer_engine/jax/sharding.py:23: DeprecationWarning: jax.interpreters.pxla.thread_resources is deprecated as of JAX v0.8.2. Please switch to using `with jax.set_mesh(mesh)` instead of `with mesh:` and then use `jax.sharding.get_abstract_mesh()` to get the current mesh.
  _PXLA_THREAD_RESOURCES = pxla.thread_resources
/root/swift_megatron/lib/python3.11/site-packages/transformer_engine/jax/sharding.py:23: DeprecationWarning: jax.interpreters.pxla.thread_resources is deprecated as of JAX v0.8.2. Please switch to using `with jax.set_mesh(mesh)` instead of `with mesh:` and then use `jax.sharding.get_abstract_mesh()` to get the current mesh.
  _PXLA_THREAD_RESOURCES = pxla.thread_resources
[INFO:swift] mcore_bridge.__version__: 1.4.3
[INFO:swift] megatron.core.__version__: 0.16.1
[INFO:mcore_bridge] Setting USE_MCORE_GDN: True. You can adjust this hyperparameter through the environment variable: `USE_MCORE_GDN`.
[INFO:swift] Successfully registered `/root/swift/swift/dataset/data/dataset_info.json`.
[INFO:swift] Successfully loaded /root/maica_llm/esft/megatron_output/Qwen3.5-397B-A17B/v42-20260622-143501/checkpoint-15-merged/args.json.
[INFO:swift] rank: 0, local_rank: 0, world_size: 10, local_world_size: 10
[transformers] `torch_dtype` is deprecated! Use `dtype` instead!
[transformers] `torch_dtype` is deprecated! Use `dtype` instead!
[transformers] `torch_dtype` is deprecated! Use `dtype` instead!
[transformers] `torch_dtype` is deprecated! Use `dtype` instead!
[transformers] `torch_dtype` is deprecated! Use `dtype` instead!
[transformers] `torch_dtype` is deprecated! Use `dtype` instead!
[transformers] `torch_dtype` is deprecated! Use `dtype` instead!
[transformers] `torch_dtype` is deprecated! Use `dtype` instead!
[INFO:swift] Setting args.lazy_tokenize: True
[INFO:swift] args.output_dir: `/root/maica_llm/esft/megatron_output/Qwen3.5-397B-A17B/v42-20260622-143501/checkpoint-15-merged-FP8`
[transformers] `torch_dtype` is deprecated! Use `dtype` instead!
[transformers] `torch_dtype` is deprecated! Use `dtype` instead!
[INFO:swift] Setting torch_dtype: torch.bfloat16
[INFO:swift] TP: 1, PP: 10, VPP: None, CP: 1, EP: 1, ETP: 1
[INFO:swift] Setting random seeds to 42.
[INFO:swift] args: MegatronExportArguments(use_ray=False, ray_exp_name=None, device_groups=None, model='/root/maica_llm/esft/megatron_output/Qwen3.5-397B-A17B/v42-20260622-143501/checkpoint-15-merged', model_type='qwen3_5_moe', model_revision=None, task_type='causal_lm', torch_dtype=torch.bfloat16, attn_impl=None, experts_impl=None, new_special_tokens=[], num_labels=None, problem_type=None, rope_scaling=None, device_map='cpu', max_memory={}, max_model_len=None, local_repo_path=None, init_strategy=None, template='qwen3_5', system=None, max_length=262144, truncation_strategy='delete', max_pixels=None, agent_template=None, norm_bbox=None, use_chat_template=True, padding_side='right', padding_free=False, loss_scale='default+ignore_empty_think', sequence_parallel_size=1, is_binary_loss_scale=None, template_backend='swift', response_prefix=None, enable_thinking=None, preserve_thinking=None, add_non_thinking_prefix=True, disable_ignore_empty_think=False, dataset=[], val_dataset=[], cached_dataset=[], cached_val_dataset=[], split_dataset_ratio=0.0, data_seed=42, dataset_num_proc=1, load_from_cache_file=False, dataset_shuffle=True, 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, disable_auto_column_mapping=False, model_name=None, model_author=None, custom_dataset_info=[], quant_method='fp8', 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=0.9, top_k=-1, top_p=1.0, repetition_penalty=1.0, num_beams=1, stream=False, stop_words=[], logprobs=False, top_logprobs=None, structured_outputs_regex=None, tuner_backend='peft', tuner_type='lora', adapters=[], external_plugins=[], custom_register_path=[], seed=42, model_kwargs={}, enable_npu_model_patch=True, load_args=True, load_data_args=False, packing=False, packing_length=None, packing_num_proc=1, lazy_tokenize=True, use_hf=False, hub_token=None, ddp_timeout=18000000, ddp_backend='nccl', ignore_args_error=False, use_swift_lora=False, freeze_llm=False, freeze_vit=True, freeze_aligner=True, freeze_parameters=[], freeze_parameters_regex=None, freeze_parameters_ratio=0.0, trainable_parameters=[], trainable_parameters_regex=None, target_modules=['all-linear'], target_regex=None, modules_to_save=[], lora_rank=64, lora_alpha=128, lora_dropout=0.05, lora_bias='none', lora_dtype=None, use_rslora=False, rlhf_type=None, loss_type=None, mcore_ref_model=None, mcore_ref_adapter=None, beta=None, rpo_alpha=None, reference_free=False, label_smoothing=0.0, f_divergence_type='reverse_kl', desirable_weight=1.0, undesirable_weight=1.0, calculate_KL=None, center_rewards_coefficient=None, teacher_model=None, teacher_model_type=None, teacher_model_revision=None, teacher_model_server=None, gkd_logits_topk=None, lmbda=0.5, seq_kd=False, offload_teacher_model=False, sft_alpha=0.0, generation_batch_size=None, steps_per_generation=None, num_generations=8, num_generations_eval=None, max_completion_length=512, importance_sampling_level='token', tau_pos=1.0, tau_neg=1.05, real_tau=0.5, fipo_decay_rate=32.0, fipo_clip_range=0.2, fipo_clip_high_only=True, fipo_safety_threshold=4.0, epsilon=0.2, epsilon_high=None, delta=None, use_vllm=True, vllm_mode=None, vllm_enable_prefix_caching=True, vllm_gpu_memory_utilization=0.9, vllm_tensor_parallel_size=1, vllm_max_model_len=None, vllm_enforce_eager=False, vllm_limit_mm_per_prompt=None, vllm_disable_cascade_attn=False, vllm_max_num_seqs=None, vllm_mm_processor_cache_gb=None, vllm_engine_kwargs=None, vllm_enable_lora=False, sleep_level=0, offload_optimizer=False, offload_model=False, offload_bridge=False, vllm_server_base_url=None, vllm_server_host=None, vllm_server_port=[8000], vllm_server_timeout=240.0, vllm_server_group_port=None, reward_funcs=[], reward_weights=None, cosine_min_len_value_wrong=-0.5, cosine_max_len_value_wrong=0.0, cosine_min_len_value_correct=1.0, cosine_max_len_value_correct=0.5, cosine_max_len=None, repetition_n_grams=3, repetition_max_penalty=-1.0, soft_max_length=None, soft_cache_length=None, dynamic_sample=False, max_resample_times=3, overlong_filter=False, scale_rewards='group', advantage_estimator='grpo', kl_in_reward=False, wandb_log_unique_prompts=None, log_completions=False, rollout_importance_sampling_mode=None, rollout_importance_sampling_threshold=2.0, log_rollout_offpolicy_metrics=False, off_policy_sequence_mask_delta=None, log_entropy=False, top_entropy_quantile=1.0, router_replay_mode='disabled', reward_model=None, reward_model_plugin=None, sync_ref_model=False, ref_model_sync_steps=512, ref_model_mixup_alpha=0.6, async_generate=False, move_model_batches=None, multi_turn_scheduler=None, max_turns=None, completion_length_limit_scope='per_round', vllm_server_pass_dataset=False, use_gym_env=None, gym_env=None, num_iterations=1, micro_batch_size=1, global_batch_size=16, recompute_granularity=None, recompute_method=None, recompute_num_layers=None, recompute_modules=['core_attn'], train_iters=None, num_train_epochs=None, masked_softmax_fusion=True, bias_dropout_fusion=True, bias_activation_fusion=True, apply_rope_fusion=False, gradient_accumulation_fusion=True, cross_entropy_loss_fusion=True, cross_entropy_fusion_impl='native', calculate_per_token_loss=True, attention_backend=<AttnBackend.unfused: 3>, optimizer='adam', optimizer_cpu_offload=False, optimizer_offload_fraction=1.0, use_precision_aware_optimizer=False, main_grads_dtype=torch.float32, main_params_dtype=torch.float32, exp_avg_dtype=torch.float32, exp_avg_sq_dtype=torch.float32, manual_gc=False, manual_gc_steps=0, manual_gc_eval=True, train_dataloader_shuffle=True, dataloader_num_workers=4, dataloader_pin_memory=True, dataloader_persistent_workers=False, dataloader_prefetch_factor=2, data_sharding=False, group_by_length=False, te_rng_tracker=False, data_parallel_random_init=False, mlp_padding_free=False, lr_warmup_init=0.0, lr=0.0001, lr_decay_style='cosine', lr_decay_iters=None, lr_warmup_iters=0, lr_warmup_fraction=None, min_lr=0, lr_wsd_decay_style='exponential', lr_wsd_decay_iters=None, weight_decay=0.1, weight_decay_incr_style='constant', start_weight_decay=0.1, end_weight_decay=0.1, clip_grad=1.0, adam_beta1=0.9, adam_beta2=0.95, adam_eps=1e-08, sgd_momentum=0.9, muon_momentum=0.9, muon_split_qkv=True, muon_use_nesterov=False, muon_scale_mode='spectral', muon_fp32_matmul_prec='medium', muon_coefficient_type='quintic', muon_num_ns_steps=5, muon_tp_mode='blockwise', muon_extra_scale_factor=1.0, muon_scalar_optimizer='adam', output_dir='/root/maica_llm/esft/megatron_output/Qwen3.5-397B-A17B/v42-20260622-143501/checkpoint-15-merged-FP8', save_steps=500, no_save_optim=True, no_save_rng=True, mcore_model='/root/maica_llm/esft/megatron_weights/Qwen/Qwen3.5-397B-A17B-mcore', mcore_adapter=None, no_load_optim=True, no_load_rng=True, finetune=True, perform_initialization=False, use_cpu_initialization=True, async_save=False, save_total_limit=None, metric_for_best_model='loss', greater_is_better=False, use_persistent_ckpt_worker=False, dist_ckpt_save_pre_mcore_014=False, dist_ckpt_optim_fully_reshardable=False, distrib_optim_fully_reshardable_mem_efficient=False, local_rank=0, use_distributed_optimizer=True, tensor_model_parallel_size=1, pipeline_model_parallel_size=10, decoder_first_pipeline_num_layers=None, decoder_last_pipeline_num_layers=None, account_for_embedding_in_pipeline_split=False, account_for_loss_in_pipeline_split=False, overlap_p2p_comm=False, batch_p2p_comm=True, align_param_gather=False, sequence_parallel=False, context_parallel_size=1, tp_comm_overlap=False, overlap_grad_reduce=False, overlap_param_gather=False, overlap_param_gather_with_optimizer_step=False, align_grad_reduce=True, virtual_pipeline_model_parallel_size=None, microbatch_group_size_per_vp_stage=None, pipeline_model_parallel_layout='Et*6,(|t*6)*8,|t*6L', expert_model_parallel_size=1, expert_tensor_parallel_size=1, report_to=['tensorboard'], logging_steps=5, tensorboard_dir=None, tensorboard_queue_size=50, wandb_project='megatron-swift', wandb_exp_name=None, swanlab_project='megatron-swift', swanlab_exp_name=None, eval_iters=-1, eval_steps=500, fp8_format='e4m3', fp8_recipe='mxfp8', fp8_param_gather=True, fp8_amax_history_len=1024, fp8_amax_compute_algo='max', fp4_format=None, fp4_recipe='nvfp4', fp4_param_gather=False, fp16=False, bf16=True, apply_query_key_layer_scaling=False, attention_softmax_in_fp32=True, accumulate_allreduce_grads_in_fp32=True, moe_router_load_balancing_type=None, moe_router_dtype='fp32', moe_token_dispatcher_type='alltoall', moe_enable_deepep=False, moe_grouped_gemm=True, moe_permute_fusion=False, moe_aux_loss_coeff=None, moe_z_loss_coeff=None, moe_shared_expert_overlap=False, moe_layer_recompute=False, moe_expert_capacity_factor=None, moe_pad_expert_input_to_capacity=False, moe_token_drop_policy='probs', mtp_num_layers=None, mtp_loss_scaling_factor=0.1, mtp_decoder_input_detach=False, mtp_shared_weights=False, save_safetensors=True, ref_model=None, ref_adapters=[], merge_lora=True, max_shard_size='5GB', vit_gradient_checkpointing=False, vit_gradient_checkpointing_kwargs=None, vit_attn_impl=None, vit_lr=None, aligner_lr=None, dsa_indexer_loss_coeff=0.0, dsa_indexer_use_sparse_loss=False, csa_dense_mode=False, use_fused_mhc=False, mhc_recompute_layer_num=None, megatron_extra_kwargs=None, language_model_only=False, check_model=True, apply_wd_to_qk_layernorm=False, linear_decoupled_in_proj=True, enable_dft_loss=False, enable_channel_loss=False, mrl_dims=None, save_strategy='steps', callbacks=['print', 'default_flow', 'tensorboard'], skip_megatron_init=False, to_mcore=False, to_hf=True, test_convert_precision=False, test_convert_dtype=torch.float32, exist_ok=False)
[INFO:swift] Global seed set to 42
[INFO:swift] Start time of running main: 2026-06-23 11:44:45.830301
[INFO:swift] swift.__version__: 4.4.0.dev0
[INFO:swift] Setting torch_dtype: torch.bfloat16
[transformers] The fast path is not available because one of the required library is not installed. Falling back to torch implementation. To install follow https://github.com/fla-org/flash-linear-attention#installation and https://github.com/Dao-AILab/causal-conv1d
[transformers] The fast path is not available because one of the required library is not installed. Falling back to torch implementation. To install follow https://github.com/fla-org/flash-linear-attention#installation and https://github.com/Dao-AILab/causal-conv1d
[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`.
[transformers] The fast path is not available because one of the required library is not installed. Falling back to torch implementation. To install follow https://github.com/fla-org/flash-linear-attention#installation and https://github.com/Dao-AILab/causal-conv1d
[transformers] The fast path is not available because one of the required library is not installed. Falling back to torch implementation. To install follow https://github.com/fla-org/flash-linear-attention#installation and https://github.com/Dao-AILab/causal-conv1d
[INFO:swift] model_kwargs: {'device_map': 'cuda:0', 'dtype': torch.bfloat16}
[transformers] The fast path is not available because one of the required library is not installed. Falling back to torch implementation. To install follow https://github.com/fla-org/flash-linear-attention#installation and https://github.com/Dao-AILab/causal-conv1d
[transformers] The fast path is not available because one of the required library is not installed. Falling back to torch implementation. To install follow https://github.com/fla-org/flash-linear-attention#installation and https://github.com/Dao-AILab/causal-conv1d
[transformers] The fast path is not available because one of the required library is not installed. Falling back to torch implementation. To install follow https://github.com/fla-org/flash-linear-attention#installation and https://github.com/Dao-AILab/causal-conv1d
[transformers] The fast path is not available because one of the required library is not installed. Falling back to torch implementation. To install follow https://github.com/fla-org/flash-linear-attention#installation and https://github.com/Dao-AILab/causal-conv1d
[transformers] The fast path is not available because one of the required library is not installed. Falling back to torch implementation. To install follow https://github.com/fla-org/flash-linear-attention#installation and https://github.com/Dao-AILab/causal-conv1d
[transformers] The fast path is not available because one of the required library is not installed. Falling back to torch implementation. To install follow https://github.com/fla-org/flash-linear-attention#installation and https://github.com/Dao-AILab/causal-conv1d
/root/swift_megatron/lib/python3.11/site-packages/megatron/core/transformer/transformer_config.py:1705: UserWarning: full scope is deprecated. Use empty cuda_graph_scope to capture the whole layer.
  warnings.warn(
/root/swift_megatron/lib/python3.11/site-packages/megatron/core/transformer/transformer_config.py:1705: UserWarning: full scope is deprecated. Use empty cuda_graph_scope to capture the whole layer.
  warnings.warn(
/root/swift_megatron/lib/python3.11/site-packages/megatron/core/transformer/transformer_config.py:1705: UserWarning: full scope is deprecated. Use empty cuda_graph_scope to capture the whole layer.
  warnings.warn(
/root/swift_megatron/lib/python3.11/site-packages/megatron/core/transformer/transformer_config.py:1705: UserWarning: full scope is deprecated. Use empty cuda_graph_scope to capture the whole layer.
  warnings.warn(
/root/swift_megatron/lib/python3.11/site-packages/megatron/core/transformer/transformer_config.py:1705: UserWarning: full scope is deprecated. Use empty cuda_graph_scope to capture the whole layer.
  warnings.warn(
/root/swift_megatron/lib/python3.11/site-packages/megatron/core/transformer/transformer_config.py:1705: UserWarning: full scope is deprecated. Use empty cuda_graph_scope to capture the whole layer.
  warnings.warn(
[INFO:swift] default_system: None
[INFO:swift] max_length: 262144
[INFO:swift] response_prefix: None
[INFO:swift] agent_template: qwen3_5
[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`.
/root/swift_megatron/lib/python3.11/site-packages/megatron/core/transformer/transformer_config.py:1705: UserWarning: full scope is deprecated. Use empty cuda_graph_scope to capture the whole layer.
  warnings.warn(
/root/swift_megatron/lib/python3.11/site-packages/megatron/core/transformer/transformer_config.py:1705: UserWarning: full scope is deprecated. Use empty cuda_graph_scope to capture the whole layer.
  warnings.warn(
/root/swift_megatron/lib/python3.11/site-packages/megatron/core/transformer/transformer_config.py:1705: UserWarning: full scope is deprecated. Use empty cuda_graph_scope to capture the whole layer.
  warnings.warn(
/root/swift_megatron/lib/python3.11/site-packages/megatron/core/transformer/transformer_config.py:1705: UserWarning: full scope is deprecated. Use empty cuda_graph_scope to capture the whole layer.
  warnings.warn(

此时显存被占满, 且执行卡住. 尝试禁用/启用device_map没有效果. 尝试添加/去除mtp层没有效果.

Additional Information / 补充信息

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with swift/cli/_megatron/export.py and reproduce the command using --quant_method fp8, --fp8_recipe mxfp8, --device_map cpu, and --use_cpu_initialization true. Compare memory behavior with CPU initialization disabled and trace the export path until the VRAM growth is explained; done means the export completes without exhausting VRAM or triggering a driver error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.