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

Fix deprecated usage of torch.nn.utils.weight_norm #2387

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

Conversation

SaeedForoutan
Copy link

@SaeedForoutan SaeedForoutan commented May 18, 2024

42ef14a: The previous implementation in darts.darts.models.forecasting.tcn_mode was using torch.nn.utils.weight_norm, which is deprecated in favor of torch.nn.utils.parametrizations.weight_norm. This commit replaces two occurrences of torch.nn.utils.weight_norm with the recommended torch.nn.utils.parametrizations.weight_norm to resolve the deprecation warning.

8cc12c8: The .pt string is yet existed in the checkpoint file .ckpt. I filtered it out.

Change Made:

  • Replaced torch.nn.utils.weight_norm with torch.nn.utils.parametrizations.weight_norm, and filtering out the .pt string.

Testing:

  • Tested the changes by using the TCN (Temporal Convolutional Network) model in darts.
  • Confirmed that the deprecation warning related to the usage of torch.nn.utils.weight_norm no longer appears when utilizing the TCN model.
  • Ran existing test suites to ensure that the functionality of the package is not affected by the changes.
  • Tested backward compatibility to verify that existing codebases relying on the TCN model continue to function as expected after the update.

The previous implementation in darts.darts.models.forecasting.tcn_mode was using `torch.nn.utils.weight_norm`, which is deprecated in favor of `torch.nn.utils.parametrizations.weight_norm`. This commit replaces two occurrences of `torch.nn.utils.weight_norm` with the recommended `torch.nn.utils.parametrizations.weight_norm` to resolve the deprecation warning.
Corrected file saving process for checkpoint files (ckpt) to filter out occurrences of the string '.pt' from the previous file path."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant