Hello- applying a bandit from Pearl and I came across a torch.jit.save() issue for a bandit class in a python 3.10, torch 2.0.1 environment:
This is due to two issues:
- The more trivial one - the current type hints are not 3.10-compatible. We could very likely handle that by:
from __future__ import annotations
Optimizers are attributes of the policy learner (and the corresponding PyTorch type hints are not compatible).
Externalizing the optimizer from the policy_learner might make sense in any case.
self._optimizer: torch.optim.Optimizer = optim.AdamW(
self.model.parameters(), lr=learning_rate, amsgrad=True
)
I'm aware that this is quite a restricted environment and that the solve might be to pin Pearl at versions above that - but wanted to log the issue.
Hello- applying a bandit from Pearl and I came across a
torch.jit.save()issue for a bandit class in a python 3.10, torch 2.0.1 environment:This is due to two issues:
Optimizersare attributes of the policy learner (and the corresponding PyTorch type hints are not compatible).Externalizing the optimizer from the policy_learner might make sense in any case.
I'm aware that this is quite a restricted environment and that the solve might be to pin Pearl at versions above that - but wanted to log the issue.