javyduck / ChatScene

[CVPR2024] ChatScene: Knowledge-Enabled Safety-Critical Scenario Generation for Autonomous Vehicles https://arxiv.org/abs/2405.14062
https://javyduck.github.io/chatscene/
MIT License
89 stars 5 forks source link

Error: NameError: name 'Vector' is not defined #26

Open caixxuan opened 5 days ago

caixxuan commented 5 days ago

When I use run_eval.py, parameters like this parser.add_argument('--mode', '-m', type=str, default='eval', choices=['train_agent', 'train_scenario', 'eval']) parser.add_argument('--agent_cfg', nargs='', type=str, default=['adv_scenic.yaml']) parser.add_argument('--scenario_cfg', nargs='', type=str, default=['eval_scenic.yaml'])

but got something error:

adv_scenic.yaml eval_scenic.yaml failed! Traceback (most recent call last): File "/home/oem/Downloads/ChatScene-main/scripts/run_eval.py", line 93, in runner.run(args.test_epoch) File "/home/oem/Downloads/ChatScene-main/safebench/scenic_runner.py", line 464, in run self._init_scenic(config) File "/home/oem/Downloads/ChatScene-main/safebench/scenic_runner.py", line 155, in _init_scenic self.scenic = ScenicSimulator(config.scenic_file, config.extra_params) File "/home/oem/Downloads/ChatScene-main/safebench/util/scenic_utils.py", line 127, in init self.scenario = errors.callBeginningScenicTrace( File "/home/oem/SafeCerebro/Scenic/src/scenic/core/errors.py", line 228, in callBeginningScenicTrace return func() File "/home/oem/Downloads/ChatScene-main/safebench/util/scenic_utils.py", line 128, in lambda: translator.scenarioFromFile(self.args.scenicFile, File "/home/oem/SafeCerebro/Scenic/src/scenic/syntax/translator.py", line 124, in scenarioFromFile return scenarioFromStream(stream, params=params, model=model, scenario=scenario, File "/home/oem/SafeCerebro/Scenic/src/scenic/syntax/translator.py", line 134, in scenarioFromStream compileStream(stream, namespace, params=params, model=model, filename=filename) File "/home/oem/SafeCerebro/Scenic/src/scenic/syntax/translator.py", line 289, in compileStream executeCodeIn(code, namespace) File "/home/oem/SafeCerebro/Scenic/src/scenic/syntax/translator.py", line 2256, in executeCodeIn exec(code, namespace) File "/home/oem/Downloads/ChatScene-main/safebench/scenario/scenario_data/scenic_data/scenario_1/behavior_1_opt.scenic", line 29, in AdvAgent = Pedestrian right of IntSpawnPt by globalParameters.OPT_GEO_X_DISTANCE, File "/home/oem/SafeCerebro/Scenic/src/scenic/simulators/carla/model.scenic", line 124, in init super().init(*args, kwargs) File "/home/oem/SafeCerebro/Scenic/src/scenic/syntax/veneer.py", line 212, in callWithStarArgs return _func_to_call(*args, *kwargs) File "/home/oem/anaconda3/envs/safebench/lib/python3.8/site-packages/decorator.py", line 232, in fun return caller(func, (extras + args), kw) File "/home/oem/SafeCerebro/Scenic/src/scenic/core/distributions.py", line 401, in helper return wrapped(*args, *kwargs) File "/home/oem/SafeCerebro/Scenic/src/scenic/core/object_types.py", line 511, in init super().init(args, **kwargs) File "/home/oem/SafeCerebro/Scenic/src/scenic/core/object_types.py", line 84, in init self._applySpecifiers(specifiers) File "/home/oem/SafeCerebro/Scenic/src/scenic/core/object_types.py", line 168, in _applySpecifiers spec.applyTo(self, optionalsForSpec[spec]) # calls _specify File "/home/oem/SafeCerebro/Scenic/src/scenic/core/specifiers.py", line 30, in applyTo val = valueInContext(self.value, obj) File "/home/oem/SafeCerebro/Scenic/src/scenic/core/lazy_eval.py", line 173, in valueInContext return value.evaluateIn(context) File "/home/oem/SafeCerebro/Scenic/src/scenic/core/lazy_eval.py", line 49, in evaluateIn value = self.evaluateInner(context) File "/home/oem/SafeCerebro/Scenic/src/scenic/core/lazy_eval.py", line 111, in evaluateInner return self.value(context) File "/home/oem/SafeCerebro/Scenic/src/scenic/syntax/veneer.py", line 1077, in val = lambda self: pos.relativize(makeOffset(self, dx, dy)) File "/home/oem/SafeCerebro/Scenic/src/scenic/core/object_types.py", line 441, in relativize pos = self.relativePosition(vec) File "/home/oem/SafeCerebro/Scenic/src/scenic/core/object_types.py", line 445, in relativePosition return self.position.offsetRotated(self.heading, vec) File "/home/oem/SafeCerebro/Scenic/src/scenic/core/distributions.py", line 547, in call retTy = typing.get_type_hints(func).get('return') File "/home/oem/anaconda3/envs/safebench/lib/python3.8/typing.py", line 1257, in get_type_hints value = _eval_type(value, globalns, localns) File "/home/oem/anaconda3/envs/safebench/lib/python3.8/typing.py", line 270, in _eval_type return t._evaluate(globalns, localns) File "/home/oem/anaconda3/envs/safebench/lib/python3.8/typing.py", line 518, in _evaluate eval(self.__forward_code__, globalns, localns), File "", line 1, in NameError: name 'Vector' is not defined

AndyBestaa commented 1 day ago

I've encountered the same situation. The problem was solved after I upgraded my Python version from 3.8.0 to 3.8.16.

javyduck commented 13 hours ago

Hi, yeah, exactly, it is due to the python version, you should use 3.8.16, i will also add the version requirement to repo later.