Ruo-Ping Dong
4 年前
当前提交
9e08be87
共有 134 个文件被更改,包括 962 次插入 和 945 次删除
-
2.github/ISSUE_TEMPLATE/bug_report.md
-
3.yamato/gym-interface-test.yml
-
3.yamato/python-ll-api-test.yml
-
9.yamato/standalone-build-test.yml
-
10.yamato/training-int-tests.yml
-
159Dockerfile
-
22Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs
-
8README.md
-
4com.unity.ml-agents.extensions/Runtime/Sensors/GridSensor.cs
-
16com.unity.ml-agents/CHANGELOG.md
-
27com.unity.ml-agents/Runtime/Academy.cs
-
24com.unity.ml-agents/Runtime/Agent.cs
-
2com.unity.ml-agents/Runtime/Sensors/CameraSensor.cs
-
52com.unity.ml-agents/Runtime/Sensors/ObservationWriter.cs
-
2com.unity.ml-agents/Runtime/Sensors/RenderTextureSensor.cs
-
8com.unity.ml-agents/Runtime/Sensors/StackingSensor.cs
-
47com.unity.ml-agents/Runtime/Utilities.cs
-
56com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs
-
2com.unity.ml-agents/package.json
-
2docs/Background-Machine-Learning.md
-
10docs/Getting-Started.md
-
24docs/Installation.md
-
4docs/Learning-Environment-Create-New.md
-
2docs/Learning-Environment-Design-Agents.md
-
4docs/Learning-Environment-Executable.md
-
8docs/ML-Agents-Overview.md
-
2docs/Readme.md
-
2docs/Training-Configuration-File.md
-
35docs/Training-ML-Agents.md
-
2docs/Training-on-Amazon-Web-Service.md
-
5docs/Unity-Inference-Engine.md
-
4gym-unity/gym_unity/__init__.py
-
21gym-unity/gym_unity/envs/__init__.py
-
8gym-unity/gym_unity/tests/test_gym.py
-
4ml-agents-envs/mlagents_envs/__init__.py
-
154ml-agents-envs/mlagents_envs/base_env.py
-
35ml-agents-envs/mlagents_envs/environment.py
-
27ml-agents-envs/mlagents_envs/rpc_utils.py
-
15ml-agents-envs/mlagents_envs/tests/test_envs.py
-
30ml-agents-envs/mlagents_envs/tests/test_rpc_utils.py
-
60ml-agents-envs/mlagents_envs/tests/test_steps.py
-
1ml-agents/mlagents/tf_utils/__init__.py
-
63ml-agents/mlagents/tf_utils/tf.py
-
1ml-agents/mlagents/torch_utils/__init__.py
-
66ml-agents/mlagents/torch_utils/torch.py
-
4ml-agents/mlagents/trainers/__init__.py
-
11ml-agents/mlagents/trainers/cli_utils.py
-
13ml-agents/mlagents/trainers/demo_loader.py
-
6ml-agents/mlagents/trainers/learn.py
-
19ml-agents/mlagents/trainers/policy/policy.py
-
6ml-agents/mlagents/trainers/policy/tf_policy.py
-
18ml-agents/mlagents/trainers/policy/torch_policy.py
-
4ml-agents/mlagents/trainers/ppo/optimizer_torch.py
-
41ml-agents/mlagents/trainers/ppo/trainer.py
-
27ml-agents/mlagents/trainers/sac/optimizer_torch.py
-
61ml-agents/mlagents/trainers/sac/trainer.py
-
2ml-agents/mlagents/trainers/settings.py
-
86ml-agents/mlagents/trainers/stats.py
-
60ml-agents/mlagents/trainers/tests/mock_brain.py
-
15ml-agents/mlagents/trainers/tests/simple_test_envs.py
-
2ml-agents/mlagents/trainers/tests/tensorflow/test_ghost.py
-
5ml-agents/mlagents/trainers/tests/tensorflow/test_models.py
-
8ml-agents/mlagents/trainers/tests/tensorflow/test_nn_policy.py
-
12ml-agents/mlagents/trainers/tests/tensorflow/test_ppo.py
-
9ml-agents/mlagents/trainers/tests/tensorflow/test_sac.py
-
4ml-agents/mlagents/trainers/tests/tensorflow/test_saver.py
-
8ml-agents/mlagents/trainers/tests/tensorflow/test_simple_rl.py
-
25ml-agents/mlagents/trainers/tests/tensorflow/test_tf_policy.py
-
19ml-agents/mlagents/trainers/tests/test_agent_processor.py
-
6ml-agents/mlagents/trainers/tests/test_rl_trainer.py
-
20ml-agents/mlagents/trainers/tests/test_stats.py
-
4ml-agents/mlagents/trainers/tests/test_trajectory.py
-
2ml-agents/mlagents/trainers/tests/torch/test_ghost.py
-
41ml-agents/mlagents/trainers/tests/torch/test_networks.py
-
15ml-agents/mlagents/trainers/tests/torch/test_policy.py
-
8ml-agents/mlagents/trainers/tests/torch/test_ppo.py
-
32ml-agents/mlagents/trainers/tests/torch/test_reward_providers/test_curiosity.py
-
18ml-agents/mlagents/trainers/tests/torch/test_reward_providers/test_extrinsic.py
-
29ml-agents/mlagents/trainers/tests/torch/test_reward_providers/test_gail.py
-
25ml-agents/mlagents/trainers/tests/torch/test_reward_providers/test_rnd.py
-
8ml-agents/mlagents/trainers/tests/torch/test_reward_providers/utils.py
-
6ml-agents/mlagents/trainers/tests/torch/test_simple_rl.py
-
4ml-agents/mlagents/trainers/tests/torch/test_utils.py
-
2ml-agents/mlagents/trainers/tf/components/bc/model.py
-
4ml-agents/mlagents/trainers/tf/components/bc/module.py
-
2ml-agents/mlagents/trainers/tf/components/reward_signals/curiosity/model.py
-
2ml-agents/mlagents/trainers/tf/components/reward_signals/gail/model.py
-
4ml-agents/mlagents/trainers/tf/model_serialization.py
-
2ml-agents/mlagents/trainers/torch/components/bc/module.py
-
16ml-agents/mlagents/trainers/torch/components/reward_providers/curiosity_reward_provider.py
-
3ml-agents/mlagents/trainers/torch/components/reward_providers/gail_reward_provider.py
-
1ml-agents/mlagents/trainers/torch/components/reward_providers/rnd_reward_provider.py
-
5ml-agents/mlagents/trainers/torch/distributions.py
-
4ml-agents/mlagents/trainers/torch/model_serialization.py
-
42ml-agents/mlagents/trainers/torch/networks.py
-
18ml-agents/mlagents/trainers/torch/utils.py
-
34ml-agents/mlagents/trainers/trainer/rl_trainer.py
-
18ml-agents/mlagents/trainers/trainer/trainer_factory.py
-
10ml-agents/mlagents/trainers/trainer_controller.py
-
12ml-agents/mlagents/trainers/training_status.py
|
|||
# Based off of python:3.6-slim, except that we are using ubuntu instead of debian. |
|||
FROM ubuntu:16.04 |
|||
|
|||
|
|||
# ensure local python is preferred over distribution python |
|||
ENV PATH /usr/local/bin:$PATH |
|||
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04 |
|||
# http://bugs.python.org/issue19846 |
|||
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. |
|||
ENV LANG C.UTF-8 |
|||
RUN yes | unminimize |
|||
# runtime dependencies |
|||
RUN apt-get update && apt-get install -y --no-install-recommends \ |
|||
ca-certificates \ |
|||
libexpat1 \ |
|||
libffi6 \ |
|||
libgdbm3 \ |
|||
libreadline6 \ |
|||
libsqlite3-0 \ |
|||
libssl1.0.0 \ |
|||
&& rm -rf /var/lib/apt/lists/* |
|||
RUN echo "deb http://packages.cloud.google.com/apt cloud-sdk-xenial main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list |
|||
RUN wget https://packages.cloud.google.com/apt/doc/apt-key.gpg && apt-key add apt-key.gpg |
|||
RUN apt-get update && \ |
|||
apt-get install -y --no-install-recommends wget curl tmux vim git gdebi-core \ |
|||
build-essential python3-pip unzip google-cloud-sdk htop mesa-utils xorg-dev xorg \ |
|||
libglvnd-dev libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev && \ |
|||
wget http://security.ubuntu.com/ubuntu/pool/main/libx/libxfont/libxfont1_1.5.1-1ubuntu0.16.04.4_amd64.deb && \ |
|||
wget http://security.ubuntu.com/ubuntu/pool/universe/x/xorg-server/xvfb_1.18.4-0ubuntu0.10_amd64.deb && \ |
|||
yes | gdebi libxfont1_1.5.1-1ubuntu0.16.04.4_amd64.deb && \ |
|||
yes | gdebi xvfb_1.18.4-0ubuntu0.10_amd64.deb |
|||
RUN python3 -m pip install --upgrade pip |
|||
RUN pip install setuptools==41.0.0 |
|||
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D |
|||
ENV PYTHON_VERSION 3.6.4 |
|||
ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH |
|||
RUN set -ex \ |
|||
&& buildDeps=" \ |
|||
dpkg-dev \ |
|||
gcc \ |
|||
libbz2-dev \ |
|||
libc6-dev \ |
|||
libexpat1-dev \ |
|||
libffi-dev \ |
|||
libgdbm-dev \ |
|||
liblzma-dev \ |
|||
libncursesw5-dev \ |
|||
libreadline-dev \ |
|||
libsqlite3-dev \ |
|||
libssl-dev \ |
|||
make \ |
|||
tcl-dev \ |
|||
tk-dev \ |
|||
wget \ |
|||
xz-utils \ |
|||
zlib1g-dev \ |
|||
# as of Stretch, "gpg" is no longer included by default |
|||
$(command -v gpg > /dev/null || echo 'gnupg dirmngr') \ |
|||
" \ |
|||
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ |
|||
\ |
|||
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ |
|||
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ |
|||
&& export GNUPGHOME="$(mktemp -d)" \ |
|||
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ |
|||
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \ |
|||
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \ |
|||
&& mkdir -p /usr/src/python \ |
|||
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ |
|||
&& rm python.tar.xz \ |
|||
\ |
|||
&& cd /usr/src/python \ |
|||
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ |
|||
&& ./configure \ |
|||
--build="$gnuArch" \ |
|||
--enable-loadable-sqlite-extensions \ |
|||
--enable-shared \ |
|||
--with-system-expat \ |
|||
--with-system-ffi \ |
|||
--without-ensurepip \ |
|||
&& make -j "$(nproc)" \ |
|||
&& make install \ |
|||
&& ldconfig \ |
|||
\ |
|||
&& apt-get purge -y --auto-remove $buildDeps \ |
|||
\ |
|||
&& find /usr/local -depth \ |
|||
\( \ |
|||
\( -type d -a \( -name test -o -name tests \) \) \ |
|||
-o \ |
|||
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ |
|||
\) -exec rm -rf '{}' + \ |
|||
&& rm -rf /usr/src/python |
|||
|
|||
# make some useful symlinks that are expected to exist |
|||
RUN cd /usr/local/bin \ |
|||
&& ln -s idle3 idle \ |
|||
&& ln -s pydoc3 pydoc \ |
|||
&& ln -s python3 python \ |
|||
&& ln -s python3-config python-config |
|||
|
|||
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" |
|||
ENV PYTHON_PIP_VERSION 9.0.3 |
|||
|
|||
RUN set -ex; \ |
|||
\ |
|||
apt-get update; \ |
|||
apt-get install -y --no-install-recommends wget; \ |
|||
rm -rf /var/lib/apt/lists/*; \ |
|||
\ |
|||
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ |
|||
\ |
|||
apt-get purge -y --auto-remove wget; \ |
|||
\ |
|||
python get-pip.py \ |
|||
--disable-pip-version-check \ |
|||
--no-cache-dir \ |
|||
"pip==$PYTHON_PIP_VERSION" \ |
|||
; \ |
|||
pip --version; \ |
|||
\ |
|||
find /usr/local -depth \ |
|||
\( \ |
|||
\( -type d -a \( -name test -o -name tests \) \) \ |
|||
-o \ |
|||
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ |
|||
\) -exec rm -rf '{}' +; \ |
|||
rm -f get-pip.py |
|||
|
|||
|
|||
RUN apt-get update && apt-get -y upgrade |
|||
|
|||
# xvfb is used to do CPU based rendering of Unity |
|||
RUN apt-get install -y xvfb |
|||
|
|||
# Install ml-agents-envs package locally |
|||
COPY ml-agents-envs /ml-agents-envs |
|||
WORKDIR /ml-agents-envs |
|||
RUN pip install -e . |
|||
|
|||
# Install ml-agents package next |
|||
COPY ml-agents /ml-agents |
|||
#checkout ml-agents for SHA |
|||
RUN mkdir /ml-agents |
|||
RUN pip install -e . |
|||
|
|||
# Port 5004 is the port used in Editor training. |
|||
# Environments will start from port 5005, |
|||
# so allow enough ports for several environments. |
|||
EXPOSE 5004-5050 |
|||
|
|||
ENTRYPOINT ["xvfb-run", "--auto-servernum", "--server-args='-screen 0 640x480x24'", "mlagents-learn"] |
|||
ARG SHA |
|||
RUN git init |
|||
RUN git remote add origin https://github.com/Unity-Technologies/ml-agents.git |
|||
RUN git fetch --depth 1 origin $SHA |
|||
RUN git checkout FETCH_HEAD |
|||
RUN pip install -e /ml-agents/ml-agents-envs |
|||
RUN pip install -e /ml-agents/ml-agents |
|
|||
# Version of the library that will be used to upload to pypi |
|||
__version__ = "0.21.1" |
|||
__version__ = "0.22.0.dev0" |
|||
__release_tag__ = "release_9" |
|||
__release_tag__ = None |
|
|||
# Version of the library that will be used to upload to pypi |
|||
__version__ = "0.21.1" |
|||
__version__ = "0.22.0.dev0" |
|||
__release_tag__ = "release_9" |
|||
__release_tag__ = None |
|
|||
from mlagents.tf_utils.tf import tf as tf # noqa |
|||
from mlagents.tf_utils.tf import set_warnings_enabled # noqa |
|||
from mlagents.tf_utils.tf import generate_session_config # noqa |
|||
from mlagents.tf_utils.tf import is_available # noqa |
|
|||
from mlagents.torch_utils.torch import torch as torch # noqa |
|||
from mlagents.torch_utils.torch import nn # noqa |
|||
from mlagents.torch_utils.torch import is_available # noqa |
|||
from mlagents.torch_utils.torch import default_device # noqa |
|
|||
import os |
|||
|
|||
from distutils.version import LooseVersion |
|||
import pkg_resources |
|||
# Detect availability of torch package here. |
|||
# NOTE: this try/except is temporary until torch is required for ML-Agents. |
|||
try: |
|||
# This should be the only place that we import torch directly. |
|||
# Everywhere else is caught by the banned-modules setting for flake8 |
|||
import torch # noqa I201 |
|||
torch.set_num_threads(cpu_utils.get_num_threads_to_use()) |
|||
os.environ["KMP_BLOCKTIME"] = "0" |
|||
def assert_torch_installed(): |
|||
# Check that torch version 1.6.0 or later has been installed. If not, refer |
|||
# user to the PyTorch webpage for install instructions. |
|||
torch_pkg = None |
|||
try: |
|||
torch_pkg = pkg_resources.get_distribution("torch") |
|||
except pkg_resources.DistributionNotFound: |
|||
pass |
|||
assert torch_pkg is not None and LooseVersion(torch_pkg.version) >= LooseVersion( |
|||
"1.6.0" |
|||
), ( |
|||
"A compatible version of PyTorch was not installed. Please visit the PyTorch homepage " |
|||
+ "(https://pytorch.org/get-started/locally/) and follow the instructions to install. " |
|||
+ "Version 1.6.0 and later are supported." |
|||
) |
|||
# Known PyLint compatibility with PyTorch https://github.com/pytorch/pytorch/issues/701 |
|||
# pylint: disable=E1101 |
|||
if torch.cuda.is_available(): |
|||
torch.set_default_tensor_type(torch.cuda.FloatTensor) |
|||
device = torch.device("cuda") |
|||
else: |
|||
torch.set_default_tensor_type(torch.FloatTensor) |
|||
device = torch.device("cpu") |
|||
nn = torch.nn |
|||
# pylint: disable=E1101 |
|||
except ImportError: |
|||
torch = None |
|||
nn = None |
|||
device = None |
|||
|
|||
assert_torch_installed() |
|||
|
|||
# This should be the only place that we import torch directly. |
|||
# Everywhere else is caught by the banned-modules setting for flake8 |
|||
import torch # noqa I201 |
|||
|
|||
|
|||
torch.set_num_threads(cpu_utils.get_num_threads_to_use()) |
|||
os.environ["KMP_BLOCKTIME"] = "0" |
|||
|
|||
# Known PyLint compatibility with PyTorch https://github.com/pytorch/pytorch/issues/701 |
|||
# pylint: disable=E1101 |
|||
if torch.cuda.is_available(): |
|||
torch.set_default_tensor_type(torch.cuda.FloatTensor) |
|||
device = torch.device("cuda") |
|||
else: |
|||
torch.set_default_tensor_type(torch.FloatTensor) |
|||
device = torch.device("cpu") |
|||
nn = torch.nn |
|||
|
|||
|
|||
def is_available(): |
|||
""" |
|||
Returns whether Torch is available in this Python environment |
|||
""" |
|||
return torch is not None |
|
|||
# Version of the library that will be used to upload to pypi |
|||
__version__ = "0.21.1" |
|||
__version__ = "0.22.0.dev0" |
|||
__release_tag__ = "release_9" |
|||
__release_tag__ = None |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue