Skip to content

Commit

Permalink
fix (stateful)(utilities): removing redundant assertion checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
YushaArif99 committed Sep 19, 2024
1 parent 1fa2c53 commit 08ea81a
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions ivy/stateful/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,19 +569,6 @@ def _compute_module_dict_tf(model, prefix=""):
"to install it and restart your interpreter to see the changes."
) from exc

try:
assert isinstance(
model_pt, torch.nn.Module
), "The original model must be an instance of `torch.nn.Module` (PyTorch)."
except AssertionError as e:
raise TypeError("PyTorch model is required as the first argument.") from e

try:
assert isinstance(
model_tf, (tf.keras.Model,tf.keras.layers.Layer)
), "The second model must be an instance of `tf.keras.Model` (TensorFlow)."
except AssertionError as e:
raise TypeError("The second model must be a TensorFlow model.") from e

if hasattr(model_tf, "named_parameters"):
_sync_models_torch_and_tf(model_pt, model_tf)
Expand Down Expand Up @@ -714,20 +701,6 @@ def _compute_module_dict_jax(model, prefix=""):
"to install it and restart your interpreter to see the changes."
) from exc

try:
assert isinstance(
model_pt, torch.nn.Module
), "The original model must be an instance of `torch.nn.Module` (PyTorch)."
except AssertionError as e:
raise TypeError("PyTorch model is required as the first argument.") from e

try:
assert isinstance(
model_jax, nnx.Module
), "The second model must be an instance of `nnx.Module`."
except AssertionError as e:
raise TypeError("The second model must be a Flax model.") from e

if hasattr(model_jax, "named_parameters"):
_sync_models_torch_and_jax(model_pt, model_jax)

Expand Down

0 comments on commit 08ea81a

Please sign in to comment.