Unity3D Machine Learning Setup for ML-Agents on Wi

2020-07-29 02:16发布

问题:

I have been trying to get the Machine Learning Setup for ML-Agents for Unity 3D up and running for the past several hours, with no luck.

First I followed this video, which goes over the initial installations which are also outlined in this GitHub repository.

Next, I moved on to part 2 of the video series (here), however problems started at minute 4:48, where I realized that the tutorial was using v 0.2, while I had v 0.3.

V 0.3 has done away with the PPO.ipynb file shown in the video. Everything is done through learn.py file.

I then decided to try and follow the official Unity installation guide:

https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Getting-Started-with-Balance-Ball.md

and got to Training with PPO section which I have not managed to resolve.

the problem arises here: The documentation states:

To summarize, go to your command line, enter the ml-agents directory and type:

python3 python/learn.py <env_file_path> --run-id=<run-identifier> --train 

Note: If you're using Anaconda, don't forget to activate the ml-agents environment first.

I tried to run:

python learn.py ball --run-id=ballBalance --train

but I am greeted with a number of warnings as follows:

File "learn.py", line 9, in from unitytrainers.trainer_controller import TrainerController File "C:\Users****\Downloads\ml-agents-master\python\unitytrainers__init__.py", line 1, in from .buffer import *

I have been trying to solve this error message for quite some time now. It seems that the file learn.py is actually being found, but somehow not being interpreted correctly?

First 9 lines of learn.py:

# # Unity ML Agents
# ## ML-Agent Learning

import logging

import os
from docopt import docopt

from unitytrainers.trainer_controller import TrainerController

Any guidance on how I can solve this problem would be appreciated. Would gladly give more information where needed. The steps mentioned above should replicate the problem I am experiencing.

回答1:

I am not completely sure whether I solved the same problem. But somewhere under my errors it also told me about line 9 in learn.py.

Nevertheless, I found this https://github.com/tensorflow/tensorflow/issues/18503 So all I did was installing tensorflow version 1.5 by executing:

pip install --upgrade --ignore-installed tensorflow-gpu==1.5

Afterwards it did run through errorless and the training worked fine.