Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

MARLlibで動作するように調整 #76

Open
wants to merge 3 commits into
base: multi_agent_env
Choose a base branch
from

Conversation

yasuohayashibara
Copy link
Contributor

MARLlibで動作するように調整

@yasuohayashibara
Copy link
Contributor Author

yasuohayashibara commented Oct 12, 2023

環境構築の方法 #75 を参照

virtualenvを使用 (調整中)

virtualenv -p python3.8 env
source env/bin/activate
cd
git clone -b soccer https://github.com/citbrains/MARLlib
cd MARLlib
pip install -r requirements.txt
python setup.py install
pip install gymnasium control supersuit==3.9.0 pettingzoo==1.24.1

PPOを実行する場合

pip install stable_baselines3 tensorboard
pip install supersuit==3.9.0 pettingzoo==1.24.1 control

以下のファイルを編集

code env/lib/python3.8/site-packages/supersuit/vector/vector_constructors.py

vector_constructors.pyの64行目をコメントアウト

    #vec_env = MakeCPUAsyncConstructor(num_cpus)(*vec_env_args(vec_env, num_vec_envs))

@yasuohayashibara
Copy link
Contributor Author

yasuohayashibara commented Oct 12, 2023

RTX4090+Ubuntu2004の環境

virtualenv -p python3.8 env
source env/bin/activate
pip install marllib protobuf==3.20.0 gym==0.22.0
pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/cu111/torch_stable.html
pip install pandas tabulate requests dm_tree scipy

cd
git clone -b soccer https://github.com/citbrains/MARLlib
cd MARLlib
python setup.py install

pip install gymnasium control

@yasuohayashibara
Copy link
Contributor Author

yasuohayashibara commented Oct 14, 2023

エラーが出続けている

Only one instance of the Robot class should be created

おそらくは,webotsのrobotクラスを複数立ち上げようとしたことで発生したエラーと考えられる
複数の環境を作って学習させるときには,複数環境を作って並列で計算させるがそれかもしれない.

以下のfit関数をから,矢印のように呼び出されて,最終的にrayのactor.pyのworker.core_worker.create_actor()でエラーが発生している.
その先もあるが,pipでインストールした環境だと隠蔽されて分からない.

mappo.fit(env, model, stop={'episode_reward_mean': 2000, 'timesteps_total': 10000000}, local_mode=True, num_gpus=1,

→ marl/init.py
  def fit(self, env: Tuple[MultiAgentEnv, Dict], model: Tuple[Any, Dict], stop: Dict = None,
   return run_cc(self.config_dict, env_instance, model_class, stop=stop)

→ marl/algos/run_cc.py
  def run_cc(exp_info, env, model, stop=None):
   results = POlICY_REGISTRY[exp_info["algorithm"]](model, exp_info, run_config, env_info, stop_config, restore_config)
   POlICY_REGISTRY[exp_info["algorithm"]]の中身はmappo

→ marl/algos/scripts/mappo.py
  def run_mappo(model: Any, exp: Dict, run: Dict, env: Dict,
   results = tune.run(MAPPOTrainer,

→ ray/tune/tune.py
  def run(
   runner.step()

→ ray/tune/trial_runner.py
  def step(self):
   if self.trial_executor.start_trial(trial):

→ ray/tune/ray_trial_executor.py
  def start_trial(self,
    return self._start_trial(trial, checkpoint, train=train)

→ ray/tune/ray_trial_executor.py
  def _start_trial(self, trial, checkpoint=None, runner=None,
   runner = self._setup_remote_runner(trial)

→ ray/tune/ray_trial_executor.py
  def _setup_remote_runner(self, trial):
   return full_actor_class.remote(**kwargs)

→ ray/actor.py
  def _remote(self,
   actor_id = worker.core_worker.create_actor(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant