Pre-Training Problem
See original GitHub issueWhen I try to run the code below I get this error at the pretrain function: Error
File "C:\Users\fabio\Desktop\wetransfer-08d028\Rope_ex_v1.5\RL_Training\behaviour_cloning.py", line 40, in <module>
model.pretrain(dataset, n_epochs=1000)
File "c:\users\fabio\desktop\virtual_env\env1\lib\site-packages\stable_baselines\common\base_class.py", line 346, in pretrain
expert_obs, expert_actions = dataset.get_next_batch('train')
File "c:\users\fabio\desktop\virtual_env\env1\lib\site-packages\stable_baselines\gail\dataset\dataset.py", line 152, in get_next_batch
dataloader.start_process()
File "c:\users\fabio\desktop\virtual_env\env1\lib\site-packages\stable_baselines\gail\dataset\dataset.py", line 231, in start_process
self.process.start()
File "C:\Python\Python37\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "C:\Python\Python37\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Python\Python37\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\Python\Python37\lib\multiprocessing\popen_spawn_win32.py", line 89, in __init__
reduction.dump(process_obj, to_child)
File "C:\Python\Python37\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
PicklingError: Can't pickle <function rebuild_pipe_connection at 0x0000024B185C2168>: it's not the same object as multiprocessing.connection.rebuild_pipe_connection
Code
import gym
from stable_baselines.gail import generate_expert_traj
env = gym.make("CartPole-v1")
def dummy_expert(_obs):
return env.action_space.sample()
generate_expert_traj(dummy_expert, 'expert_cartpole', env, n_episodes=10)
from stable_baselines import PPO2
from stable_baselines.gail import ExpertDataset
dataset = ExpertDataset(expert_path='expert_cartpole.npz',
traj_limitation=1, batch_size=128)
model = PPO2('MlpPolicy', 'CartPole-v1', verbose=1)
model.pretrain(dataset, n_epochs=1000)
model.learn(int(1e5))
env = model.get_env()
obs = env.reset()
reward_sum = 0.0
for _ in range(1000):
action, _ = model.predict(obs)
obs, reward, done, _ = env.step(action)
reward_sum += reward
env.render()
if done:
print(reward_sum)
reward_sum = 0.0
obs = env.reset()
env.close()
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
How to Use Greedy Layer-Wise Pretraining in Deep Learning ...
Generally, this problem prevented the training of very deep neural networks and was referred to as the vanishing gradient problem. An important ...
Read more >8.7.4 Pretraining - CEDAR
Greedy Supervised Pretraining. • Greedy Algorithm: 1. Break a problem into many components. 2. Solve for the optimal version of each component in...
Read more >The Negative Pretraining Effect in Sequential Deep Learning ...
Negative pretraining is a prominent sequential learning effect of neural networks where a pretrained model obtains a worse generalization performance than a ...
Read more >What is pre training a neural network? - Cross Validated
The usual way of training a network: You want to train a neural network to perform a task (e.g. classification) on a data...
Read more >Using Supervised Pretraining to Improve Generalization of ...
We propose a supervised pretraining technique that helps improve general- ization on binary classification problems. The experimental results on four UCI ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The full traceback of all processes tells the issue: It is trying to load file
expert_cartpole.npz
when creating ExpertDataset, but data is stored indummy_expert_cartpole.npz
. Fixing this fixes the issue.I tried but I get the same error as in the main question.