rail-berkeley / rlkit

Collection of reinforcement learning algorithms
MIT License
2.43k stars 547 forks source link

Cannot reshape array in function dump_video (video.py) #131

Closed sandipan1 closed 3 years ago

sandipan1 commented 3 years ago

I am facing this error when I run python rlkit/examples/rig/pointmass/rig.py

Traceback (most recent call last):
File "examples/rig/pointmass/rig.py", line 91, in
run_experiment(
File "/scratch/sh6317/research/rlkit/rlkit/launchers/launcher_util.py", line 584, in run_experiment
return run_experiment_here( File "/scratch/sh6317/research/rlkit/rlkit/launchers/launcher_util.py", line 166, in run_experiment_here
return experiment_function(variant) File "/scratch/sh6317/research/rlkit/rlkit/launchers/rig_experiments.py", line 44, in grill_her_td3_full_experiment
grill_her_td3_experiment(variant['grill_variant']) File "/scratch/sh6317/research/rlkit/rlkit/launchers/rig_experiments.py", line 366, in grill_her_td3_experiment
algorithm.train() File "/scratch/sh6317/research/rlkit/rlkit/core/rl_algorithm.py", line 143, in train self.train_online(start_epoch=start_epoch) File "/scratch/sh6317/research/rlkit/rlkit/core/rl_algorithm.py", line 173, in train_online
self._end_epoch(epoch) File "/scratch/sh6317/research/rlkit/rlkit/core/rl_algorithm.py", line 325, in _end_epoch
post_epoch_func(self, epoch) File "/scratch/sh6317/research/rlkit/rlkit/launchers/rig_experiments.py", line 535, in save_video
temporary_mode( File "/scratch/sh6317/research/rlkit/rlkit/launchers/rig_experiments.py", line 561, in temporary_mode
return_val = func(*args, **kwargs) File "/scratch/sh6317/research/rlkit/rlkit/util/video.py", line 75, in dump_video frames = np.array(frames, dtype=np.uint8).reshape( ValueError: cannot reshape array of size 114307200 into shape (18,101,252,84,3)

python rlkit/examples/rig/pusher/rig.py

Traceback (most recent call last):
  File "examples/rig/pusher/rig.py", line 82, in <module>
    run_experiment(
  File "/scratch/sh6317/research/rlkit/rlkit/launchers/launcher_util.py", line 584, in run_experiment                                                        
    return run_experiment_here(
  File "/scratch/sh6317/research/rlkit/rlkit/launchers/launcher_util.py", line 166, in run_experiment_here                                                   
    return experiment_function(variant)
  File "/scratch/sh6317/research/rlkit/rlkit/launchers/rig_experiments.py", line 44, in grill_her_td3_full_experiment                                        
    grill_her_td3_experiment(variant['grill_variant'])
  File "/scratch/sh6317/research/rlkit/rlkit/launchers/rig_experiments.py", line 366, in grill_her_td3_experiment                                            
    algorithm.train()
  File "/scratch/sh6317/research/rlkit/rlkit/core/rl_algorithm.py", line 143, in train                                                                       
    self.train_online(start_epoch=start_epoch)
  File "/scratch/sh6317/research/rlkit/rlkit/core/rl_algorithm.py", line 173, in train_online                                                                
    self._end_epoch(epoch)
  File "/scratch/sh6317/research/rlkit/rlkit/core/rl_algorithm.py", line 325, in _end_epoch                                                                  
    post_epoch_func(self, epoch)
  File "/scratch/sh6317/research/rlkit/rlkit/launchers/rig_experiments.py", line 535, in save_video                                                          
    temporary_mode(
  File "/scratch/sh6317/research/rlkit/rlkit/launchers/rig_experiments.py", line 561, in temporary_mode                                                      
    return_val = func(*args, **kwargs)
  File "/scratch/sh6317/research/rlkit/rlkit/util/video.py", line 75, in dump_video                                                                          
    frames = np.array(frames, dtype=np.uint8).reshape(
ValueError: cannot reshape array of size 114307200 into shape (18,101,252,84,3)                            
vitchyr commented 3 years ago

Hi this commit should fix this error. Feel free to post here if you still have issues.