Search Unity

Question Can't train 3DBall (or anything else)

Discussion in 'ML-Agents' started by erikboh, Jan 21, 2022.

  1. erikboh

    erikboh

    Joined:
    Jan 19, 2022
    Posts:
    2
    Hi!

    I am new to the ML-Agents toolkit. However, the training worked fine yesterday but today when I was going to try to train my own agent, it didn't worked. Yesterday I successfully trained the 3DBall model. However, this doesn't work today as well...

    I have tried to reinstall torch and ml-agent with no success.
    I installed everything in a virtual environment. I folloed the steps in their installation guide https://github.com/Unity-Technologies/ml-agents/blob/main/docs/Installation.md

    Python: 3.9.10
    Torch: 1.7.1+cu110

    Is there anyone that have an idea of what's going on?


    (env) C:\Exjobb\ml-agents\ml-agents-main>mlagents-learn config/ppo/3DBall.yaml --run-id=fi
    Traceback (most recent call last):
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
    File "C:\Exjobb\unity\env\Scripts\mlagents-learn.exe\__main__.py", line 4, in <module>
    File "C:\Exjobb\unity\env\lib\site-packages\mlagents\trainers\learn.py", line 2, in <module>
    from mlagents import torch_utils
    File "C:\Exjobb\unity\env\lib\site-packages\mlagents\torch_utils\__init__.py", line 1, in <module>
    from mlagents.torch_utils.torch import torch as torch # noqa
    File "C:\Exjobb\unity\env\lib\site-packages\mlagents\torch_utils\torch.py", line 6, in <module>
    from mlagents.trainers.settings import TorchSettings
    File "C:\Exjobb\unity\env\lib\site-packages\mlagents\trainers\settings.py", line 644, in <module>
    class TrainerSettings(ExportableSettings):
    File "C:\Exjobb\unity\env\lib\site-packages\mlagents\trainers\settings.py", line 667, in TrainerSettings
    cattr.register_structure_hook(
    File "C:\Exjobb\unity\env\lib\site-packages\cattr\converters.py", line 207, in register_structure_hook
    self._structure_func.register_cls_list([(cl, func)])
    File "C:\Exjobb\unity\env\lib\site-packages\cattr\dispatch.py", line 55, in register_cls_list
    self._single_dispatch.register(cls, handler)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\functools.py", line 855, in register
    raise TypeError(
    TypeError: Invalid first argument to `register()`. typing.Dict[mlagents.trainers.settings.RewardSignalType, mlagents.trainers.settings.RewardSignalSettings] is not a class.
     
  2. erikboh

    erikboh

    Joined:
    Jan 19, 2022
    Posts:
    2
    I installed everything in my Ubuntu WSL, it worked! No idea why it doesn't work in my windows terminal. But no need for help anymore! :)
     
  3. ThisIsSomeRandomUsername

    ThisIsSomeRandomUsername

    Joined:
    Jan 22, 2022
    Posts:
    4
    Bumping this because I'm having this same issue and I can't find any other info about it. Maybe it's a recent bug?
     
  4. home_unity891

    home_unity891

    Joined:
    May 21, 2020
    Posts:
    3
    I had the same problem. I rolled by virtualenv back to python 3.9.9 and it worked. 3.9.10 came out this week and I must have upgraded to it somehow. 3.9.9 seems to work though.
     
  5. home_unity891

    home_unity891

    Joined:
    May 21, 2020
    Posts:
    3
  6. Boomboyag

    Boomboyag

    Joined:
    Oct 13, 2020
    Posts:
    33
    Hey, I ran into the same problem. How exactly do you downgrade the virtual environment?
     
  7. JPonzo

    JPonzo

    Joined:
    Sep 29, 2013
    Posts:
    5
    Hi ! Same issue with Python 3.10.4
     
  8. GamerLordMat

    GamerLordMat

    Joined:
    Oct 10, 2019
    Posts:
    185
    Hello,

    it is best to just stick thighly to their instructions:
    "
    Install Python 3.6.1 or Higher
    We recommend installing Python 3.6 or 3.7. If you are using Windows, please install the x86-64 version and not x86. If your Python environment doesn't include pip3, see these instructions on installing it.


    Best"