inoryy / reaver

Reaver: Modular Deep Reinforcement Learning Framework. Focused on StarCraft II. Supports Gym, Atari, and MuJoCo.
MIT License
554 stars 90 forks source link

error with Function xx is currently not available #40

Open pbl357 opened 3 years ago

pbl357 commented 3 years ago

Hi, thank you for great reaver, I test the run.py with --env MoveToBeacon --agent ppo --n_envs 1 in macOS without GPU, but get follow error

Traceback (most recent call last): File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, self._kwargs) File "/Users/xx/sc2/venv/lib/python3.8/site-packages/reaver/envs/base/shm_multiproc.py", line 48, in _run obs, rew, done = self._env.step(data) File "/Users/xx/sc2/venv/lib/python3.8/site-packages/reaver/envs/sc2.py", line 87, in step obs, reward, done = self.obs_wrapper(self._env.step(self.act_wrapper(action))) File "/Users/xx/sc2/venv/lib/python3.8/site-packages/pysc2/lib/stopwatch.py", line 212, in _stopwatch return func(*args, *kwargs) File "/Users/xx/sc2/venv/lib/python3.8/site-packages/pysc2/env/sc2_env.py", line 537, in step actions = [[f.transform_action(o.observation, a, skip_available=skip) File "/Users/xx/sc2/venv/lib/python3.8/site-packages/pysc2/env/sc2_env.py", line 537, in actions = [[f.transform_action(o.observation, a, skip_available=skip) File "/Users/xx/sc2/venv/lib/python3.8/site-packages/pysc2/env/sc2_env.py", line 537, in actions = [[f.transform_action(o.observation, a, skip_available=skip) File "/Users/xx/sc2/venv/lib/python3.8/site-packages/pysc2/lib/stopwatch.py", line 212, in _stopwatch return func(args, kwargs) File "/Users/xx/sc2/venv/lib/python3.8/site-packages/pysc2/lib/features.py", line 1608, in transform_action raise ValueError("Function %s/%s is currently not available" % ( ValueError: Function 331/Move_screen is currently not available

the error about action id is not same every time. then I run the command python3 -m pysc2.bin.agent --map MoveToBeacon, the result:

I1023 10:11:01.933034 4632368576 sc2_env.py:506] Starting episode 1: [terran] on MoveToBeacon 0/no_op () 1/move_camera (1/minimap [64, 64]) 2/select_point (6/select_point_act [4]; 0/screen [84, 84]) 3/select_rect (7/select_add [2]; 0/screen [84, 84]; 2/screen2 [84, 84]) 4/select_control_group (4/control_group_act [5]; 5/control_group_id [10]) 7/select_army (7/select_add [2]) 453/Stop_quick (3/queued [2]) 451/Smart_screen (3/queued [2]; 0/screen [84, 84]) 452/Smart_minimap (3/queued [2]; 1/minimap [64, 64]) 331/Move_screen (3/queued [2]; 0/screen [84, 84]) 332/Move_minimap (3/queued [2]; 1/minimap [64, 64]) 333/Patrol_screen (3/queued [2]; 0/screen [84, 84]) 334/Patrol_minimap (3/queued [2]; 1/minimap [64, 64]) 12/Attack_screen (3/queued [2]; 0/screen [84, 84]) 13/Attack_minimap (3/queued [2]; 1/minimap [64, 64]) 274/HoldPosition_quick (3/queued [2])

my pysc2 version is 3.0.0 , reaver version is 2.1.9
I had set the ensure_available_actions=False and it works,but I dont think it`s good idea