Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
awaelchli committed Mar 14, 2024
1 parent 92d4091 commit 5aaea87
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/lightning/fabric/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,11 @@ def _capture_compile_kwargs(compile_fn: Callable) -> Callable:

@wraps(compile_fn)
def _capture(*args: Any, **kwargs: Any) -> Any:
if not args:
# torch.compile is being applied as a decorator
if not args or not isinstance(args[0], nn.Module):
# either torch.compile is being applied as a decorator or we're compiling something else
return compile_fn(*args, **kwargs)

model = args[0]
if not isinstance(model, nn.Module):
# compiling something else
return compile_fn(*args, **kwargs)

compiled_model = compile_fn(model, **kwargs)
compiled_model._compile_kwargs = deepcopy(kwargs)
return compiled_model
Expand Down

0 comments on commit 5aaea87

Please sign in to comment.