rl
rl copied to clipboard
[BUG] csv logger can't take "/" in metric names
Describe the bug
If the metric one is trying to log with the csv logger has / in its name, you will get a No such file or directory error.
To Reproduce
Run the sac example in examples/sac/sac.py. In config.yaml, set logger/backend to csv.
You will get an error at line 44 of torchrl/record/loggers/csv.py:
if filepath not in self.files:
self.files[filepath] = open(filepath, "a")
Reason and Possible fixes
This is because the sac example logs train reward as "train/reward" where "train/" is taken by the logger as a path.
The csv logger can perhaps automatically set all / in metric names as "_" instead.