rl icon indicating copy to clipboard operation
rl copied to clipboard

[BUG]UserWarning: deterministic_sample wasn't found when queried in <class 'torch.distributions.categorical.Categorical'>. CompositeDistribution is falling back on mode instead. For better code quality and efficiency, make sure to either provide a distribution with a deterministic_sample attribute or to change the InteractionMode to the desired value.

Open Sui-Xing opened this issue 1 year ago • 0 comments

Describe the bug

When I proceeded further based on the issue https://github.com/pytorch/rl/issues/2402, I encountered this warning. I have pulled the GitHub projects torchrl and tensordict, and installed the latest libraries from both projects using python .\setup.py develop. I'm puzzled why it's not possible to perform deterministic_sample using Categorical within CompositeDistribution. Since CompositeDistribution can already compute log_prob, why can't it perform deterministic_sample?

To Reproduce

I have already used the code suggested in the answer of this issue: https://github.com/pytorch/rl/issues/2402

Expected behavior

I hope to eliminate this warning so that log_prob in CompositeDistribution can properly assist in performing deterministic_sample for discrete action spaces. Alternatively, could you tell me whether this warning has a negative impact on the convergence of my PPO model training process or the prediction process?

System info

win11 24h2 python 3.10.14

torch 2.4.0+cu118 torchaudio 2.4.0+cu118 torchrl 0.5.0+ca3a595 torchvision 0.19.0+cu118 tensordict 0.5.0+eba0769

Sui-Xing avatar Sep 27 '24 10:09 Sui-Xing