huawei-noah / SMARTS

Scalable Multi-Agent RL Training School for Autonomous Driving
MIT License
954 stars 190 forks source link

评估时无法找到保存的模型zip文件 #2148

Closed Ppig01 closed 7 months ago

Ppig01 commented 7 months ago

High Level Description

评估时模型zip文件已放在指定位置却显示无法找到

Version

SMARTS 2.0.1

Steps to reproduce the bug

(.venv) root@autodl-container-db9d4bbf57-95245be2:~/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/contrib_policy#
scl benchmark run driving_smarts_2023_3 examples.e11_platoon.inference:contrib-agent-v0

<-- Starting `Driving SMARTS 2023.3` benchmark -->

For context see:
    - https://smarts-project.github.io/competition/2023_driving_smarts/
    - https://codalab.lisn.upsaclay.fr/competitions/

Evaluating platoon-scenarios/sumo/vehicle_following/straight_2lane_sumo_agents_1...

Evaluating platoon-scenarios/sumo/vehicle_following/straight_2lane_sumo_t_agents_1...

Evaluating platoon-scenarios/sumo/vehicle_following/straight_3lanes_sumo_agents_1...

Evaluating platoon-scenarios/sumo/vehicle_following/straight_3lanes_sumo_t_agents_1...

Evaluating platoon-scenarios/sumo/vehicle_following/straight_3lanes_sumo_t_agents_2...

Evaluating platoon-scenarios/sumo/vehicle_following/merge_exit_sumo_agents_1...

Evaluating platoon-scenarios/sumo/vehicle_following/merge_exit_sumo_t_agents_1...

Evaluating platoon-scenarios/sumo/vehicle_following/merge_exit_sumo_t_agents_2...
Traceback (most recent call last):
  File "/root/autodl-tmp/SMARTS/.venv/bin/scl", line 8, in <module>
    sys.exit(scl())
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/root/autodl-tmp/SMARTS/cli/benchmark.py", line 72, in run
    run_benchmark(
  File "/root/autodl-tmp/SMARTS/smarts/benchmark/__init__.py", line 111, in run_benchmark
    entrypoint(
  File "/root/autodl-tmp/SMARTS/smarts/benchmark/entrypoints/benchmark_runner_v0.py", line 265, in benchmark_from_configs
    benchmark(
  File "/root/autodl-tmp/SMARTS/smarts/benchmark/entrypoints/benchmark_runner_v0.py", line 207, in benchmark
    for _, records in iterator(
  File "/root/autodl-tmp/SMARTS/smarts/benchmark/entrypoints/benchmark_runner_v0.py", line 147, in _parallel_task_iterator
    for name, records in ray.get(unfinished_refs):
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/ray/_private/client_mode_hook.py", line 105, in wrapper
    return func(*args, **kwargs)
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/ray/_private/worker.py", line 2309, in get
    raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(FileNotFoundError): ray::_eval_worker() (pid=39706, ip=172.17.0.6)
  File "/root/autodl-tmp/SMARTS/smarts/benchmark/entrypoints/benchmark_runner_v0.py", line 47, in _eval_worker
    return _eval_worker_local(name, env_config, episodes, agent_locator, error_tolerant)
  File "/root/autodl-tmp/SMARTS/smarts/benchmark/entrypoints/benchmark_runner_v0.py", line 61, in _eval_worker_local
    agents = {
  File "/root/autodl-tmp/SMARTS/smarts/benchmark/entrypoints/benchmark_runner_v0.py", line 62, in <dictcomp>
    agent_id: agent_registry.make_agent(locator=agent_locator)[0]
  File "/root/autodl-tmp/SMARTS/smarts/zoo/registry.py", line 97, in make_agent
    return agent_spec.build_agent(), agent_spec.interface
  File "/root/autodl-tmp/SMARTS/smarts/zoo/agent_spec.py", line 125, in build_agent
    return self.agent_builder(
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/contrib_policy/policy.py", line 25, in __init__
    self._model = self._get_model()
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/contrib_policy/policy.py", line 60, in _get_model
    return sb3lib.PPO.load(path=Path(__file__).resolve().parents[0] / "saved_model")
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/stable_baselines3/common/base_class.py", line 679, in load
    data, params, pytorch_variables = load_from_zip_file(
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/stable_baselines3/common/save_util.py", line 390, in load_from_zip_file
    load_path = open_path(load_path, "r", verbose=verbose, suffix="zip")
  File "/root/miniconda3/lib/python3.8/functools.py", line 875, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/stable_baselines3/common/save_util.py", line 286, in open_path_pathlib
    return open_path(path, mode, verbose, suffix)
  File "/root/miniconda3/lib/python3.8/functools.py", line 875, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/stable_baselines3/common/save_util.py", line 266, in open_path_pathlib
    raise error
  File "/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/stable_baselines3/common/save_util.py", line 258, in open_path_pathlib
    path = path.open("rb")
  File "/root/miniconda3/lib/python3.8/pathlib.py", line 1222, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "/root/miniconda3/lib/python3.8/pathlib.py", line 1078, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/root/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/contrib_policy/saved_model.zip'

(.venv) root@autodl-container-db9d4bbf57-95245be2:~/autodl-tmp/SMARTS/.venv/lib/python3.8/site-packages/contrib_policy#
ls
__init__.py  filter_obs.py     frame_stack.py  network.py  saved_model.zip
__pycache__  format_action.py  make_dict.py    policy.py

System info

No response

Error logs and screenshots

No response

Impact (If known)

No response

Ppig01 commented 7 months ago

是否是下载模型后再次上传导致了问题,尝试在云服务器的JupterLab上直接复制粘贴模型到指定目录下运行评估没有问题

Adaickalavan commented 7 months ago

Hi @Ppig01

Consider following the instructions given here to evaluate the trained model in the example.