araffin / learning-to-drive-in-5-minutes

Implementation of reinforcement learning approach to make a car learn to drive smoothly in minutes
https://towardsdatascience.com/learning-to-drive-smoothly-in-minutes-450a7cdb35f4
MIT License
287 stars 85 forks source link

PermissionError: [WinError 5] 拒绝访问。 #20

Closed SCKnife closed 4 years ago

SCKnife commented 4 years ago

Yesterday,it works correctly! but today,when I run the train.py.it reports as follows: pygame 1.9.6 Hello from the pygame community. https://www.pygame.org/contribute.html ========== DonkeyVae-v0-level-0 sac ========== Loading VAE ... WARNING:tensorflow:From C:\Users\Administrator\Desktop\learning\vae\model.py:66: conv2d (from tensorflow.python.layers.convolutional) is deprecated and will be removed in a future version. Instructions for updating: Use keras.layers.conv2d instead. WARNING:tensorflow:From C:\ProgramData\Anaconda3\envs\Learning\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. WARNING:tensorflow:From C:\Users\Administrator\Desktop\learning\vae\model.py:74: dense (from tensorflow.python.layers.core) is deprecated and will be removed in a future version. Instructions for updating: Use keras.layers.dense instead. WARNING:tensorflow:From C:\Users\Administrator\Desktop\learning\vae\model.py:88: conv2d_transpose (from tensorflow.python.layers.convolutional) is deprecated and will be removed in a future version. Instructions for updating: Use keras.layers.conv2d_transpose instead. 2020-01-12 10:35:19.513799: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 2020-01-12 10:35:19.519399: I tensorflow/core/common_runtime/process_util.cc:71] Creating new thread pool with default inter op setting: 8. Tune using inter_op_parallelism_threads for best performance. Dim VAE = 32 train.py:66: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. hyperparams = yaml.load(f)[BASE_ENV] OrderedDict([('batch_size', 64), ('buffer_size', 30000), ('ent_coef', 'auto_0.1'), ('gamma', 0.99), ('gradient_steps', 600), ('learning_rate', 0.0003), ('learning_starts', 300), ('n_timesteps', 5000.0), ('policy', 'CustomSACPolicy'), ('train_freq', 3000), ('vae_path', 'C:\Users\Administrator\PycharmProjects\learning\learning\PKL\vae-level-0-dim-32.pkl'), ('z_size', 32), ('MIN_THROTTLE', 0.4), ('MAX_THROTTLE', 0.6), ('FRAME_SKIP', 1), ('MAX_CTE_ERROR', 2.0), ('N_COMMAND_HISTORY', 20), ('MAX_STEERING_DIFF', 0.15)]) Starting DonkeyGym env Traceback (most recent call last): File "train.py", line 117, in env = DummyVecEnv([make_env(args.seed, vae=vae, teleop=args.teleop)]) File "C:\ProgramData\Anaconda3\envs\Learning\lib\site-packages\stable_baselines\common\vec_env\dummy_vec_env.py", line 20, in init self.envs = [fn() for fn in env_fns] File "C:\ProgramData\Anaconda3\envs\Learning\lib\site-packages\stable_baselines\common\vec_env\dummy_vec_env.py", line 20, in self.envs = [fn() for fn in env_fns] File "C:\Users\Administrator\Desktop\learning\utils\utils.py", line 121, in _init n_stack=n_stack) File "C:\Users\Administrator\Desktop\learning\donkey_gym\envs\vae_env.py", line 74, in init self.unity_process.start(exe_path, headless=headless, port=port) File "C:\Users\Administrator\Desktop\learning\donkey_gym\core\donkey_proc.py", line 32, in start [sim_path] + port_args) File "C:\ProgramData\Anaconda3\envs\Learning\lib\subprocess.py", line 800, in init restore_signals, start_new_session) File "C:\ProgramData\Anaconda3\envs\Learning\lib\subprocess.py", line 1207, in _execute_child startupinfo) PermissionError: [WinError 5] 拒绝访问。

I want to know how to slove the problem. please help!😊

SCKnife commented 4 years ago

The above problem has been solved.But I meet a new problem: when I train the VAE by run"python -m vae.train --n-epochs 50 --verbose 0 --z-size 64 -f C:\Users\Administrator\Desktop\learning\record‘。it reports as follows: raceback (most recent call last): File "", line 1, in Traceback (most recent call last): File "C:\ProgramData\Anaconda3\envs\learning\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\ProgramData\Anaconda3\envs\learning\lib\runpy.py", line 85, in _run_code File "C:\ProgramData\Anaconda3\envs\learning\lib\multiprocessing\spawn.py", line 105, in spawn_main exec(code, run_globals) File "C:\Users\Administrator\Desktop\learning\vae\train.py", line 63, in exitcode = _main(fd) File "C:\ProgramData\Anaconda3\envs\learning\lib\multiprocessing\spawn.py", line 114, in _main data_loader = DataLoader(minibatchlist, images, n_workers=2, folder=args.folder) File "C:\Users\Administrator\Desktop\learning\vae\data_loader.py", line 129, in init prepare(preparation_data) File "C:\ProgramData\Anaconda3\envs\learning\lib\multiprocessing\spawn.py", line 223, in prepare self.start_process() File "C:\Users\Administrator\Desktop\learning\vae\data_loader.py", line 154, in start_process _fixup_main_from_name(data['init_main_from_name']) File "C:\ProgramData\Anaconda3\envs\learning\lib\multiprocessing\spawn.py", line 249, in _fixup_main_from_name self.process.start() File "C:\ProgramData\Anaconda3\envs\learning\lib\multiprocessing\process.py", line 112, in start alter_sys=True) File "C:\ProgramData\Anaconda3\envs\learning\lib\runpy.py", line 205, in run_module self._popen = self._Popen(self) File "C:\ProgramData\Anaconda3\envs\learning\lib\multiprocessing\context.py", line 223, in _Popen return _run_module_code(code, init_globals, run_name, mod_spec) File "C:\ProgramData\Anaconda3\envs\learning\lib\runpy.py", line 96, in _run_module_code return _default_context.get_context().Process._Popen(process_obj) File "C:\ProgramData\Anaconda3\envs\learning\lib\multiprocessing\context.py", line 322, in _Popen mod_name, mod_spec, pkg_name, script_name) File "C:\ProgramData\Anaconda3\envs\learning\lib\runpy.py", line 85, in _run_code exec(code, run_globals) return Popen(process_obj) File "C:\Users\Administrator\Desktop\learning\vae\train.py", line 70, in File "C:\ProgramData\Anaconda3\envs\learning\lib\multiprocessing\popen_spawn_win32.py", line 89, in init for obs in data_loader: reduction.dump(process_obj, to_child) NameError: name 'data_loader' is not defined File "C:\ProgramData\Anaconda3\envs\learning\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) BrokenPipeError: [Errno 32] Broken pipe Exception ignored in: <function DataLoader.del at 0x000002B103C82048> Traceback (most recent call last): File "C:\Users\Administrator\Desktop\learning\vae\data_loader.py", line 229, in del File "C:\ProgramData\Anaconda3\envs\learning\lib\multiprocessing\process.py", line 124, in terminate AttributeError: 'NoneType' object has no attribute 'terminate' 0%| my environments are windows10, anaconda, python3.7.6. please help me!

SCKnife commented 4 years ago

Oh,finally。I found the key to the problem。The Process object can only be created under“if name == 'main'”。so I try to write the "vae\data_loader.py(Data_loader(start_process))"as follows:

def start_process(self):
    print("loading....")
if __name__=='__main__':
    start_process()
    """Start preprocessing process"""
    self.process = Process(target=self._run)
    # Make it a deamon, so it will be deleted at the same time
    # of the main process
    self.process.daemon = True
    self.process.start()

No errors occurs.But it seems not work corrrectly!Processing is always at 0% So what can I to make it correct? I'm desperate for help!