Skip to content
Merged
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
3 changes: 2 additions & 1 deletion src/transformers/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4022,7 +4022,8 @@ def save_pretrained(
model_to_save.config.dtype = str(dtype).split(".")[1]

# Attach architecture to the config
model_to_save.config.architectures = [model_to_save.__class__.__name__]
# When using FSDP2, unwrapping is a noop, so the model name doesn't change back to the original model name
model_to_save.config.architectures = [model_to_save.__class__.__name__.removeprefix("FSDP")]

# If we have a custom model, we copy the file defining it in the folder and set the attributes so it can be
# loaded from the Hub.
Expand Down