Open CFSD opened 1 year ago
Hey!
Thanks for reporting.
I think I see the issue. I feel that the fix should include some check that we're not keeping any dim from the env batch size in the statistics (ie we can only normalize over feature dimensions, not batch dimensions). Alternatively, we could normalize over all the non-batch dimensions of the tensordict that is read by init_stats since by convention all of its dims are non-feature dimensions. I agree that there is some improvement that can be done for the saving and loading of stats in ObservationNorm. I'll propose a fix in the upcoming days and ping you with it!
Thank you for your quick and detailed response. I'm looking forward to seeing your proposed fix for this issue.
Describe the bug
When using the
ObservationNorm
method in theinit_stats
function of thetorchrl
library, anIndexError
occurs with the message "Dimension out of range (expected to be in range of [-4, 3], but got -5)". This seems to be associated with the reduction dimension tuple.To Reproduce
It's difficult to provide exact steps without additional information, but here's an approximation based on the provided traceback:
make_parallel_env
.ObservationNorm
usinginit_stats
function withfrom_pixels
set toTrue
.ppo.py
script.The relevant script sections are:
Expected behavior
The
ObservationNorm
should be initialized without any error. Theinit_stats
function should correctly calculate the statistics from the samples for normalization, irrespective of the input dimensions.Screenshots
N/A
System info
Additional context
The warnings from the Hydra library also suggest some outdated usage and configuration, including the absence of
_self_
in the defaults list, invalid overriding ofhydra/job_logging
, and changes in working directory behavior.Reason and Possible fixes
The issue seems to be stemming from this specific piece of code in
transforms.py
:The reduction dimension tuple appears to have a value that is out of the expected range. However, without knowing the exact dimensions of
t.parent.batch_size
, it's hard to propose a precise fix.Checklist