Skip to content

Commit

Permalink
Checking model type in nncf.torch.wrap_model (#2651)
Browse files Browse the repository at this point in the history
### Changes

Added model type check in nncf.torch.wrap_model

### Reason for changes

Improve UX

### Related tickets

#2636 (comment)

### Tests

N/A
  • Loading branch information
alexsu52 authored Apr 24, 2024
1 parent 9c7a212 commit 057c4ce
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nncf/torch/model_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ def wrap_model(
:param trace_parameters: Whether to trace model parameters. Default is False.
:return: A model wrapped by NNCFNetwork.
"""
if not isinstance(model, torch.nn.Module):
raise TypeError(
f"The provided model type {type(model)} is incompatible. "
"Only models inheriting from torch.nn.Module are supported."
)

input_info = ExampleInputInfo.from_example_input(example_input)

Expand Down

0 comments on commit 057c4ce

Please sign in to comment.