Skip to content

Training checkpoint saved in fp32 (2x size vs pretrained), causes inference OOM #6

Description

@xpwindells

After fine-tuning SenseNova-Vision-7B-MoT on a custom panoptic segmentation dataset with FSDP HYBRID_SHARD (8 GPUs), the saved checkpoint weights (ema.safetensors / model.safetensors) are 54.4 GB (fp32), while the original pretrained checkpoint is only 27.2 GB (bf16). This 2x size increase causes OOM during single-GPU inference on an 80GB card.

Environment
Model: SenseNova-Vision-7B-MoT
Training: 8× A100 80GB, FSDP HYBRID_SHARD (num_shard=4, num_replicate=4)
Checkpoint: results/.../checkpoint/0002000/ema.safetensors
Inference: single GPU (A100 80GB), SenseNovaVisionModel from inference/sensenova_vision.py

Line 105-112: EMA model save

with FSDP.state_dict_type(
ema_model,
StateDictType.FULL_STATE_DICT,
FullStateDictConfig(rank0_only=True, offload_to_cpu=True),
):
ema_state_dict = ema_model.state_dict()
if dist.get_rank() == 0:
save_file(ema_state_dict, os.path.join(save_path, "ema.safetensors")) # ← fp32!

Line 114-121: Model save (same issue)

with FSDP.state_dict_type(
model,
StateDictType.FULL_STATE_DICT,
FullStateDictConfig(rank0_only=True, offload_to_cpu=True),
):
model_state_dict = model.state_dict()
if dist.get_rank() == 0:
save_file(model_state_dict, os.path.join(save_path, "model.safetensors")) # ← fp32!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions