Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete stub forward() method in LightningModule #19423

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Commits on Feb 6, 2024

  1. Delete stub forward() method in Module

    The current stub breaks TorchScript/`to_torchscript` with:
    
    ```
    otSupportedError: Compiled functions can't take variable number of arguments or use keyword-only arguments with defaults:
      File "/opt/conda/envs/image-gen/lib/python3.11/site-packages/pytorch_lightning/core/module.py", line 657
        def forward(self, *args: Any, **kwargs: Any) -> Any:
                                       ~~~~~~~ <--- HERE
            r"""Same as :meth:`torch.nn.Module.forward`.
    ```
    
    This becomes an issue when you use a module as container for other modules with bespoke methods and do not rely on the default forward call.
    BlackHC committed Feb 6, 2024
    Configuration menu
    Copy the full SHA
    8c6698e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    35a8b49 View commit details
    Browse the repository at this point in the history

Commits on Feb 11, 2024

  1. Only fix signature

    BlackHC committed Feb 11, 2024
    Configuration menu
    Copy the full SHA
    207cdb1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b1d75d0 View commit details
    Browse the repository at this point in the history