Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion xtuner/v1/model/compose/qwen3_vl/modeling_vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ def fully_shard(
mp_policy = MixedPrecisionPolicy(
param_dtype=fsdp_config.param_dtype, reduce_dtype=fsdp_config.reduce_dtype
)
decoder_layer_mp_policy = MixedPrecisionPolicy(
param_dtype=fsdp_config.param_dtype, reduce_dtype=fsdp_config.reduce_dtype, cast_forward_inputs=False
)

# NOTE: 在 cpu_offload 模式下,mesh 应该是 cuda 的,在 meta fully_shard 后在调用 .to_empty(device=cpu)
self.fsdp_mesh = init_world_mesh()
Expand Down Expand Up @@ -350,7 +353,7 @@ def fully_shard(
fully_shard(
layer,
mesh=self.fsdp_mesh,
mp_policy=mp_policy,
mp_policy=decoder_layer_mp_policy,
reshard_after_forward=True,
offload_policy=CPUOffloadPolicy()
if fsdp_config.cpu_offload
Expand Down