hcnoh / gail-pytorch

A simple implementation of Generative Adversarial Imitation Learning with PyTorch
MIT License
132 stars 27 forks source link

VALUE Error : expected sequence of length 24 at dim 1(got 0) #7

Closed chaennlee closed 8 months ago

chaennlee commented 1 year ago

I got this error(ubuntu 20.04 ver)

(base) codms@codms-T-Series:~/gail-pytorch$ python train.py --env_name=BipedalWalker-v3 /home/codms/gail-pytorch/models/nets.py:128: UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor. (Triggered internally at /croot/pytorch_1686931851744/work/torch/csrc/utils/tensor_new.cpp:245.) state = FloatTensor(state) Traceback (most recent call last): File "/home/codms/gail-pytorch/train.py", line 98, in main(**vars(args)) File "/home/codms/gail-pytorch/train.py", line 65, in main results = model.train(env, expert) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/codms/gail-pytorch/models/gail.py", line 80, in train act = expert.act(ob) ^^^^^^^^^^^^^^ File "/home/codms/gail-pytorch/models/nets.py", line 128, in act state = FloatTensor(state) ^^^^^^^^^^^^^^^^^^ ValueError: expected sequence of length 24 at dim 1 (got 0)

s3795574 commented 1 year ago

It was caused by the number of return values of reset() and step() functions. Change lines 77 and 137 from ob = env.reset() to ob,_ = env.reset() Change lines 88 and 150 from ob, rwd, done, info = env.step(act) to ob, rwd, done, info,_ = env.step(act)