Skip to content

Commit 6941586

Browse files
author
Your Name
committed
fixed minor bug
1 parent d5cf62a commit 6941586

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

modelopt/torch/opt/conversion.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,10 +579,17 @@ def restore(model: ModelLike, f: str | os.PathLike | BinaryIO, **kwargs) -> nn.M
579579
580580
Returns:
581581
The model with original weights and stored architecture.
582+
583+
.. note::
584+
Note that wrappers such as DistributedDataParallel are `not` supported during the restore
585+
process. Please wrap the model after the restore process.
582586
"""
583587
# initialize ModelLikeModule if needed.
584588
model = model if isinstance(model, nn.Module) else ModelLikeModule(model)
585589

590+
# check if the model is in a wrapper; we dont support restoring with wrappers
591+
model = unwrap_model(model, raise_error=True)
592+
586593
# load checkpoint
587594
kwargs.setdefault("map_location", "cpu")
588595
kwargs.setdefault("weights_only", False)

0 commit comments

Comments
 (0)