ml-agentsを利用していく中,遭遇した現象(事故)について載っけていきます。見直しとか全くしていません。あくまで個人用のメモです。
エラー1:多分ml-agentsインストールできていない
絶対気のせいだが,pip install protobuf==3.20.3 && pip install numpy==1.23.5
(protpbufとnumpyのダウングレード)を実行してからmlagents-learn --help
ができない。勝手に消されたのかは分からない。(インストールしていなかった,ということはない)
エラー1
mlagents-learn --help
Traceback (most recent call last):
File "/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/bin/mlagents-learn", line 5, in <module>
from mlagents.trainers.learn import main
File "/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/mlagents/trainers/learn.py", line 2, in <module>
from mlagents import torch_utils
File "/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/mlagents/torch_utils/__init__.py", line 1, in <module>
from mlagents.torch_utils.torch import torch as torch # noqa
File "/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/mlagents/torch_utils/torch.py", line 6, in <module>
from mlagents.trainers.settings import TorchSettings
File "/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/mlagents/trainers/settings.py", line 25, in <module>
from mlagents.trainers.cli_utils import StoreConfigFile, DetectDefault, parser
File "/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/mlagents/trainers/cli_utils.py", line 5, in <module>
from mlagents_envs.environment import UnityEnvironment
File "/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/mlagents_envs/environment.py", line 12, in <module>
from mlagents_envs.side_channel.side_channel import SideChannel
File "/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/mlagents_envs/side_channel/__init__.py", line 5, in <module>
from mlagents_envs.side_channel.default_training_analytics_side_channel import ( # noqa
File "/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/mlagents_envs/side_channel/default_training_analytics_side_channel.py", line 7, in <module>
from mlagents_envs.communicator_objects.training_analytics_pb2 import (
File "/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/mlagents_envs/communicator_objects/training_analytics_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
File "/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 47, in <module>
from google.protobuf.pyext import _message
ImportError: dlopen(/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/google/protobuf/pyext/_message.cpython-310-darwin.so, 0x0002): Library not loaded: @rpath/libprotobuf.30.dylib
Referenced from: <7A1D0729-4282-3861-B440-3706ACE578B2> /Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/google/protobuf/pyext/_message.cpython-310-darwin.so
Reason: tried: '/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/libprotobuf.30.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/libprotobuf.30.dylib' (no such file), '/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/libprotobuf.30.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/libprotobuf.30.dylib' (no such file), '/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/google/protobuf/pyext/../../../../../libprotobuf.30.dylib' (no such file), '/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/libprotobuf.30.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/libprotobuf.30.dylib' (no such file), '/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/libprotobuf.30.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/libprotobuf.30.dylib' (no such file), '/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/lib/python3.10/site-packages/google/protobuf/pyext/../../../../../libprotobuf.30.dylib' (no such file), '/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/bin/../lib/libprotobuf.30.dylib' (no such file), '/Users/[USER_NAME]/opt/anaconda3/envs/ml-test/bin/../lib/libprotobuf.30.dylib' (no such file), '/usr/local/lib/libprotobuf.30.dylib' (no such file), '/usr/lib/libprotobuf.30.dylib' (no such file, not in dyld cache)
エラー2:UnityObservationException
以下のエラーの場合,理由はよくわからないが,unityのml-agentsパッケージを2.0から3.0へとアップデートしたら動いた。
package managerの,Add package from git URL
より,
git+https://github.com/Unity-Technologies/ml-agents.git?path=com.unity.ml-agents#release_21
を入力すれば,3.0のml-agentsパッケージを取得できる。
エラー2
mlagents_envs.exception.UnityObservationException: Decompressed observation did not have the expected shape - decompressed had (3, 84, 84) but expected [84, 84, 3]
参考:https://github.com/Unity-Technologies/ml-agents/issues/6041