Traceback (most recent call last):
File “C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0Librunpy.py”, line 198, in _run_module_as_main
return _run_code(code, main_globals, None,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0Librunpy.py”, line 88, in run_code
exec(code, run_globals)
File “c:Usersuser.vscodeextensionsms-python.debugpy-2024.8.0-win32-x64bundledlibsdebugpyadapter/../..debugpylauncher/../..debugpy_main.py”, line 39, in
cli.main()
File “c:Usersuser.vscodeextensionsms-python.debugpy-2024.8.0-win32-x64bundledlibsdebugpyadapter/../..debugpylauncher/../..debugpy/..debugpyservercli.py”, line 430, in main
run()
File “c:Usersuser.vscodeextensionsms-python.debugpy-2024.8.0-win32-x64bundledlibsdebugpyadapter/../..debugpylauncher/../..debugpy/..debugpyservercli.py”, line 284, in run_file
runpy.run_path(target, run_name=”main“)
File “c:Usersuser.vscodeextensionsms-python.debugpy-2024.8.0-win32-x64bundledlibsdebugpy_vendoredpydevd_pydevd_bundlepydevd_runpy.py”, line 321, in run_path
return _run_module_code(code, init_globals, run_name,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “c:Usersuser.vscodeextensionsms-python.debugpy-2024.8.0-win32-x64bundledlibsdebugpy_vendoredpydevd_pydevd_bundlepydevd_runpy.py”, line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File “c:Usersuser.vscodeextensionsms-python.debugpy-2024.8.0-win32-x64bundledlibsdebugpy_vendoredpydevd_pydevd_bundlepydevd_runpy.py”, line 124, in _run_code
exec(code, run_globals)
File “C:UsersuserDocumentsWorkspaceFinancialonline_trader.py”, line 752, in
model.load(f”C:UsersuserDocumentsWorkspaceFinancialMODELSdqn2DQN_model_189″,env=vec_env)
File “C:UsersuserAppDataLocalPackagesPythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0LocalCachelocal-packagesPython311site-packagesstable_baselines3commonbase_class.py”, line 741, in load
model.set_parameters(params, exact_match=True, device=device)
File “C:UsersuserAppDataLocalPackagesPythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0LocalCachelocal-packagesPython311site-packagesstable_baselines3commonbase_class.py”, line 629, in set_parameters
attr.load_state_dict(params[name], strict=exact_match)
^^^^^^^^^^^^^^^^^^^^
AttributeError: ‘NoneType’ object has no attribute ‘load_state_dict’
I try to load a saved SAC model but the model load have a problem like this.
Model generation;
model = SAC(‘MultiInputPolicy’, vec_env, gamma=best_params[‘gamma’], learning_rate=best_params[‘learning_rate’], buffer_size=best_params[‘buffer_size’], batch_size=best_params[‘batch_size’], ent_coef=”auto_0.1″, policy_kwargs=policy_kwargs, verbose=1, tensorboard_log=tensorboard_log_dir+”TRY_2_”)
model.save(location)
model.load(location)
Furkan Çelik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.