imitation icon indicating copy to clipboard operation
imitation copied to clipboard

`.npz`-formatted files saved with `.pkl` extension

Open dfilan opened this issue 2 years ago • 7 comments

Bug description

The save function in data/types.py saves sequences of trajectories in numpy's .npz format. That said, some scripts save these with the name final.pkl or similar, making it appear that the files are pickle-formatted. Fixing this basically seems to break a few other things (see my recent reverted commits in https://github.com/HumanCompatibleAI/imitation/pull/519), and patching things over would steal focus away from my main task right now.

Steps to reproduce

Run python -m imitation.scripts.train_rl with pendulum common.fast train.fast rl.fast fast common.log_dir=quickstart/rl/.

dfilan avatar Sep 09 '22 23:09 dfilan

I should say that 'my recent reverted commits' refer to commits b2bcb40 and 2bf4dee.

dfilan avatar Sep 09 '22 23:09 dfilan

Not immediately obvious to me why the other tests are failing, probably we're assuming pkl extension somewhere else in the code and will need to change it everywhere. This seems worthwhile but I agree doesn't belong in the CNN PR :)

AdamGleave avatar Sep 10 '22 00:09 AdamGleave

So, that causes some tests to fail. Once you fix that problem, then tests fail because they're expecting to see a .npz file somewhere but can't find it - I guess because it isn't being generated, or isn't part of some existing set of files?

dfilan avatar Sep 10 '22 00:09 dfilan

Kinda hard to say what's going on without seeing the stack trace. There are some files in tests/testdata that are still in .pkl format.

AdamGleave avatar Sep 10 '22 00:09 AdamGleave

I think that's probably what's going on.

dfilan avatar Sep 10 '22 00:09 dfilan

@Rocamonde do you mind taking a look at this sometime in the next few weeks? Not time sensitive, I don't think it's blocking anyone, more just causing confusion.

AdamGleave avatar Sep 10 '22 23:09 AdamGleave

Sure, will put it on my TODO list.

Rocamonde avatar Sep 11 '22 10:09 Rocamonde