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 an issue where policies built with LRSchedulerFactoryLinear were not picklable #992

Merged
merged 4 commits into from
Nov 14, 2023

Conversation

opcode81
Copy link
Collaborator

  • I have marked all applicable categories:
    • exception-raising fix
    • algorithm implementation fix
    • documentation modification
    • new feature
  • I have reformatted the code using make format (required)
  • I have checked the code using make commit-checks (required)
  • If applicable, I have mentioned the relevant/related issue(s)
  • If applicable, I have listed every items in this Pull Request below

The cause was the use of a lambda function in the state of a generated object.

@opcode81 opcode81 requested a review from MischaPanch November 14, 2023 16:39
@opcode81 opcode81 added the bug Something isn't working label Nov 14, 2023
@opcode81 opcode81 marked this pull request as ready for review November 14, 2023 16:40
return LambdaLR(optim, lr_lambda=lambda epoch: 1 - epoch / max_update_num)
return LambdaLR(optim, lr_lambda=self._LRLambda(self.sampling_config).compute)

class _LRLambda:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo you can define a function instead of creating a temporary class

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class is there to cache the second parameter of the function (max_update_num).

Trinkle23897
Trinkle23897 previously approved these changes Nov 14, 2023
@Trinkle23897 Trinkle23897 merged commit 6d6c85e into thu-ml:master Nov 14, 2023
5 checks passed
@Trinkle23897 Trinkle23897 deleted the feat/high-level-api branch November 14, 2023 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants