浏览代码

move (first pass)

/tag-0.12.1.dev0
Chris Elion 5 年前
当前提交
fdc810ff
共有 61 个文件被更改,包括 137 次插入137 次删除
  1. 2
      docs/Learning-Environment-Executable.md
  2. 2
      docs/Migrating.md
  3. 10
      docs/Python-API.md
  4. 2
      docs/Training-on-Amazon-Web-Service.md
  5. 2
      docs/Training-on-Microsoft-Azure.md
  6. 2
      gym-unity/gym_unity/envs/__init__.py
  7. 2
      gym-unity/gym_unity/tests/test_gym.py
  8. 2
      ml-agents-envs/setup.py
  9. 8
      ml-agents/mlagents/trainers/brain.py
  10. 4
      ml-agents/mlagents/trainers/brain_conversion_utils.py
  11. 2
      ml-agents/mlagents/trainers/buffer.py
  12. 8
      ml-agents/mlagents/trainers/demo_loader.py
  13. 10
      ml-agents/mlagents/trainers/learn.py
  14. 2
      ml-agents/mlagents/trainers/ppo/multi_gpu_policy.py
  15. 2
      ml-agents/mlagents/trainers/ppo/policy.py
  16. 2
      ml-agents/mlagents/trainers/sac/policy.py
  17. 2
      ml-agents/mlagents/trainers/sac/trainer.py
  18. 6
      ml-agents/mlagents/trainers/simple_env_manager.py
  19. 14
      ml-agents/mlagents/trainers/subprocess_env_manager.py
  20. 4
      ml-agents/mlagents/trainers/tests/test_ppo.py
  21. 4
      ml-agents/mlagents/trainers/tests/test_simple_rl.py
  22. 4
      ml-agents/mlagents/trainers/tests/test_subprocess_env_manager.py
  23. 2
      ml-agents/mlagents/trainers/tf_policy.py
  24. 4
      ml-agents/mlagents/trainers/trainer.py
  25. 4
      ml-agents/mlagents/trainers/trainer_controller.py
  26. 4
      notebooks/getting-started.ipynb
  27. 4
      ml-agents-envs/mlagents_envs/communicator.py
  28. 24
      ml-agents-envs/mlagents_envs/environment.py
  29. 16
      ml-agents-envs/mlagents_envs/mock_communicator.py
  30. 8
      ml-agents-envs/mlagents_envs/rpc_communicator.py
  31. 8
      ml-agents-envs/mlagents_envs/rpc_utils.py
  32. 8
      ml-agents-envs/mlagents_envs/tests/test_envs.py
  33. 4
      ml-agents-envs/mlagents_envs/tests/test_rpc_communicator.py
  34. 10
      ml-agents-envs/mlagents_envs/tests/test_rpc_utils.py
  35. 8
      ml-agents-envs/mlagents_envs/tests/test_side_channel.py
  36. 2
      ml-agents-envs/mlagents_envs/tests/test_timers.py
  37. 4
      ml-agents-envs/mlagents_envs/side_channel/engine_configuration_channel.py
  38. 2
      ml-agents-envs/mlagents_envs/side_channel/float_properties_channel.py
  39. 2
      ml-agents-envs/mlagents_envs/side_channel/raw_bytes_channel.py
  40. 4
      ml-agents-envs/mlagents_envs/communicator_objects/agent_info_action_pair_pb2.py
  41. 4
      ml-agents-envs/mlagents_envs/communicator_objects/agent_info_action_pair_pb2.pyi
  42. 2
      ml-agents-envs/mlagents_envs/communicator_objects/agent_info_pb2.py
  43. 2
      ml-agents-envs/mlagents_envs/communicator_objects/agent_info_pb2.pyi
  44. 2
      ml-agents-envs/mlagents_envs/communicator_objects/brain_parameters_pb2.py
  45. 2
      ml-agents-envs/mlagents_envs/communicator_objects/brain_parameters_pb2.pyi
  46. 4
      ml-agents-envs/mlagents_envs/communicator_objects/unity_input_pb2.py
  47. 4
      ml-agents-envs/mlagents_envs/communicator_objects/unity_input_pb2.pyi
  48. 6
      ml-agents-envs/mlagents_envs/communicator_objects/unity_message_pb2.py
  49. 6
      ml-agents-envs/mlagents_envs/communicator_objects/unity_message_pb2.pyi
  50. 4
      ml-agents-envs/mlagents_envs/communicator_objects/unity_output_pb2.py
  51. 4
      ml-agents-envs/mlagents_envs/communicator_objects/unity_output_pb2.pyi
  52. 2
      ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_initialization_output_pb2.py
  53. 2
      ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_initialization_output_pb2.pyi
  54. 4
      ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_input_pb2.py
  55. 4
      ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_input_pb2.pyi
  56. 2
      ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_output_pb2.py
  57. 2
      ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_output_pb2.pyi
  58. 2
      ml-agents-envs/mlagents_envs/communicator_objects/unity_to_external_pb2.py
  59. 2
      ml-agents-envs/mlagents_envs/communicator_objects/unity_to_external_pb2_grpc.py
  60. 0
      /ml-agents-envs/mlagents_envs

2
docs/Learning-Environment-Executable.md


'file_name' of the `UnityEnvironment`. For instance:
```python
from mlagents.envs.environment import UnityEnvironment
from mlagents_envs.environment import UnityEnvironment
env = UnityEnvironment(file_name=<env_name>)
```

2
docs/Migrating.md


* `UnitySDK/Assets/ML-Agents/Scripts/Communicator.cs` and its class `Communicator` have been renamed to `UnitySDK/Assets/ML-Agents/Scripts/ICommunicator.cs` and `ICommunicator` respectively.
* The `SpaceType` Enums `discrete`, and `continuous` have been renamed to `Discrete` and `Continuous`.
* We have removed the `Done` call as well as the capacity to set `Max Steps` on the Academy. Therefore an AcademyReset will never be triggered from C# (only from Python). If you want to reset the simulation after a fixed number of steps, or when an event in the simulation occurs, we recommend looking at our multi-agent example environments (such as BananaCollector). In our examples, groups of Agents can be reset through an "Area" that can reset groups of Agents.
* The import for `mlagents.envs.UnityEnvironment` was removed. If you are using the Python API, change `from mlagents.envs import UnityEnvironment` to `from mlagents.envs.environment import UnityEnvironment`.
* The import for `mlagents.envs.UnityEnvironment` was removed. If you are using the Python API, change `from mlagents_envs import UnityEnvironment` to `from mlagents_envs.environment import UnityEnvironment`.
## Migrating from ML-Agents toolkit v0.8 to v0.9

10
docs/Python-API.md


of your Unity environment is 3DBall.app, in python, run:
```python
from mlagents.envs.environment import UnityEnvironment
from mlagents_envs.environment import UnityEnvironment
env = UnityEnvironment(file_name="3DBall", base_port=5005, seed=1, side_channels=[])
```

For example :
```python
from mlagents.envs.environment import UnityEnvironment
from mlagents.envs.side_channel.engine_configuration_channel import EngineConfigurationChannel
from mlagents_envs.environment import UnityEnvironment
from mlagents_envs.side_channel.engine_configuration_channel import EngineConfigurationChannel
channel = EngineConfigurationChannel()

* `list_properties` Returns a list of all the string identifiers of the properties
```python
from mlagents.envs.environment import UnityEnvironment
from mlagents.envs.side_channel.float_properties_channel import FloatPropertiesChannel
from mlagents_envs.environment import UnityEnvironment
from mlagents_envs.side_channel.float_properties_channel import FloatPropertiesChannel
channel = FloatPropertiesChannel()

2
docs/Training-on-Amazon-Web-Service.md


9. Test the instance setup from Python using:
```python
from mlagents.envs.environment import UnityEnvironment
from mlagents_envs.environment import UnityEnvironment
env = UnityEnvironment(<your_env>)
```

2
docs/Training-on-Microsoft-Azure.md


7. Test the instance setup from Python using:
```python
from mlagents.envs.environment import UnityEnvironment
from mlagents_envs.environment import UnityEnvironment
env = UnityEnvironment(<your_env>)
```

2
gym-unity/gym_unity/envs/__init__.py


import itertools
import gym
import numpy as np
from mlagents.envs.environment import UnityEnvironment
from mlagents_envs.environment import UnityEnvironment
from gym import error, spaces

2
gym-unity/gym_unity/tests/test_gym.py


from gym import spaces
from gym_unity.envs import UnityEnv, UnityGymException
from mlagents.envs.base_env import AgentGroupSpec, ActionType, BatchedStepResult
from mlagents_envs.base_env import AgentGroupSpec, ActionType, BatchedStepResult
@mock.patch("gym_unity.envs.UnityEnvironment")

2
ml-agents-envs/setup.py


import sys
from setuptools import setup
from setuptools.command.install import install
import mlagents.envs
import mlagents_envs
VERSION = mlagents.envs.__version__

8
ml-agents/mlagents/trainers/brain.py


import numpy as np
import io
from mlagents.envs.communicator_objects.agent_info_pb2 import AgentInfoProto
from mlagents.envs.communicator_objects.brain_parameters_pb2 import BrainParametersProto
from mlagents.envs.communicator_objects.observation_pb2 import ObservationProto
from mlagents.envs.timers import hierarchical_timer, timed
from mlagents_envs.communicator_objects.agent_info_pb2 import AgentInfoProto
from mlagents_envs.communicator_objects.brain_parameters_pb2 import BrainParametersProto
from mlagents_envs.communicator_objects.observation_pb2 import ObservationProto
from mlagents_envs.timers import hierarchical_timer, timed
from typing import Dict, List, NamedTuple, Collection
from PIL import Image

4
ml-agents/mlagents/trainers/brain_conversion_utils.py


from mlagents.trainers.brain import BrainInfo, BrainParameters, CameraResolution
from mlagents.envs.base_env import BatchedStepResult, AgentGroupSpec
from mlagents.envs.exception import UnityEnvironmentException
from mlagents_envs.base_env import BatchedStepResult, AgentGroupSpec
from mlagents_envs.exception import UnityEnvironmentException
import numpy as np
from typing import List

2
ml-agents/mlagents/trainers/buffer.py


import h5py
from typing import List, BinaryIO
from mlagents.envs.exception import UnityException
from mlagents_envs.exception import UnityException
class BufferException(UnityException):

8
ml-agents/mlagents/trainers/demo_loader.py


from mlagents.trainers.buffer import AgentBuffer
from mlagents.trainers.agent_processor import ProcessingBuffer
from mlagents.trainers.brain import BrainParameters, BrainInfo
from mlagents.envs.communicator_objects.agent_info_action_pair_pb2 import (
from mlagents_envs.communicator_objects.agent_info_action_pair_pb2 import (
from mlagents.envs.communicator_objects.brain_parameters_pb2 import BrainParametersProto
from mlagents.envs.communicator_objects.demonstration_meta_pb2 import (
from mlagents_envs.communicator_objects.brain_parameters_pb2 import BrainParametersProto
from mlagents_envs.communicator_objects.demonstration_meta_pb2 import (
from mlagents.envs.timers import timed, hierarchical_timer
from mlagents_envs.timers import timed, hierarchical_timer
from google.protobuf.internal.decoder import _DecodeVarint32 # type: ignore

10
ml-agents/mlagents/trainers/learn.py


from typing import Any, Callable, Optional, List, NamedTuple
import mlagents.trainers
import mlagents.envs
import mlagents_envs
from mlagents.envs.environment import UnityEnvironment
from mlagents_envs.environment import UnityEnvironment
from mlagents.envs.base_env import BaseEnv
from mlagents_envs.base_env import BaseEnv
from mlagents.envs.side_channel.side_channel import SideChannel
from mlagents.envs.side_channel.engine_configuration_channel import EngineConfig
from mlagents_envs.side_channel.side_channel import SideChannel
from mlagents_envs.side_channel.engine_configuration_channel import EngineConfig
class CommandLineOptions(NamedTuple):

2
ml-agents/mlagents/trainers/ppo/multi_gpu_policy.py


from tensorflow.python.client import device_lib
from mlagents.trainers.brain import BrainParameters
from mlagents.envs.timers import timed
from mlagents_envs.timers import timed
from mlagents.trainers.models import EncoderType, LearningRateSchedule
from mlagents.trainers.ppo.policy import PPOPolicy
from mlagents.trainers.ppo.models import PPOModel

2
ml-agents/mlagents/trainers/ppo/policy.py


from mlagents.tf_utils import tf
from mlagents.envs.timers import timed
from mlagents_envs.timers import timed
from mlagents.trainers.brain import BrainInfo, BrainParameters
from mlagents.trainers.models import EncoderType, LearningRateSchedule
from mlagents.trainers.ppo.models import PPOModel

2
ml-agents/mlagents/trainers/sac/policy.py


import numpy as np
from mlagents.tf_utils import tf
from mlagents.envs.timers import timed
from mlagents_envs.timers import timed
from mlagents.trainers.brain import BrainInfo, BrainParameters
from mlagents.trainers.models import EncoderType, LearningRateSchedule
from mlagents.trainers.sac.models import SACModel

2
ml-agents/mlagents/trainers/sac/trainer.py


from mlagents.trainers.brain import BrainInfo
from mlagents.trainers.action_info import ActionInfoOutputs
from mlagents.envs.timers import timed
from mlagents_envs.timers import timed
from mlagents.trainers.sac.policy import SACPolicy
from mlagents.trainers.rl_trainer import RLTrainer, AllRewardsOutput

6
ml-agents/mlagents/trainers/simple_env_manager.py


from typing import Dict, List
from mlagents.envs.base_env import BaseEnv
from mlagents_envs.base_env import BaseEnv
from mlagents.envs.timers import timed
from mlagents_envs.timers import timed
from mlagents.envs.side_channel.float_properties_channel import FloatPropertiesChannel
from mlagents_envs.side_channel.float_properties_channel import FloatPropertiesChannel
from mlagents.trainers.brain_conversion_utils import (
step_result_to_brain_info,
group_spec_to_brain_parameters,

14
ml-agents/mlagents/trainers/subprocess_env_manager.py


from typing import Dict, NamedTuple, List, Any, Optional, Callable, Set
import cloudpickle
from mlagents.envs.environment import UnityEnvironment
from mlagents.envs.exception import UnityCommunicationException, UnityTimeOutException
from mlagents_envs.environment import UnityEnvironment
from mlagents_envs.exception import UnityCommunicationException, UnityTimeOutException
from mlagents.envs.base_env import BaseEnv
from mlagents_envs.base_env import BaseEnv
from mlagents.envs.timers import (
from mlagents_envs.timers import (
TimerNode,
timed,
hierarchical_timer,

from mlagents.trainers.brain import AllBrainInfo, BrainParameters
from mlagents.trainers.action_info import ActionInfo
from mlagents.envs.side_channel.float_properties_channel import FloatPropertiesChannel
from mlagents.envs.side_channel.engine_configuration_channel import (
from mlagents_envs.side_channel.float_properties_channel import FloatPropertiesChannel
from mlagents_envs.side_channel.engine_configuration_channel import (
from mlagents.envs.side_channel.side_channel import SideChannel
from mlagents_envs.side_channel.side_channel import SideChannel
from mlagents.trainers.brain_conversion_utils import (
step_result_to_brain_info,
group_spec_to_brain_parameters,

4
ml-agents/mlagents/trainers/tests/test_ppo.py


from mlagents.trainers.rl_trainer import AllRewardsOutput
from mlagents.trainers.components.reward_signals import RewardSignalResult
from mlagents.trainers.brain import BrainParameters
from mlagents.envs.environment import UnityEnvironment
from mlagents.envs.mock_communicator import MockCommunicator
from mlagents_envs.environment import UnityEnvironment
from mlagents_envs.mock_communicator import MockCommunicator
from mlagents.trainers.tests import mock_brain as mb
from mlagents.trainers.tests.mock_brain import make_brain_parameters
from mlagents.trainers.brain_conversion_utils import (

4
ml-agents/mlagents/trainers/tests/test_simple_rl.py


from mlagents.trainers.trainer_controller import TrainerController
from mlagents.trainers.trainer_util import TrainerFactory
from mlagents.envs.base_env import (
from mlagents_envs.base_env import (
BaseEnv,
AgentGroupSpec,
BatchedStepResult,

from mlagents.trainers.simple_env_manager import SimpleEnvManager
from mlagents.trainers.sampler_class import SamplerManager
from mlagents.envs.side_channel.float_properties_channel import FloatPropertiesChannel
from mlagents_envs.side_channel.float_properties_channel import FloatPropertiesChannel
BRAIN_NAME = __name__
OBS_SIZE = 1

4
ml-agents/mlagents/trainers/tests/test_subprocess_env_manager.py


EnvironmentResponse,
StepResponse,
)
from mlagents.envs.base_env import BaseEnv
from mlagents.envs.side_channel.engine_configuration_channel import EngineConfig
from mlagents_envs.base_env import BaseEnv
from mlagents_envs.side_channel.engine_configuration_channel import EngineConfig
def mock_env_factory(worker_id):

2
ml-agents/mlagents/trainers/tf_policy.py


import numpy as np
from mlagents.tf_utils import tf
from mlagents.envs.exception import UnityException
from mlagents_envs.exception import UnityException
from mlagents.trainers.policy import Policy
from mlagents.trainers.action_info import ActionInfo
from tensorflow.python.platform import gfile

4
ml-agents/mlagents/trainers/trainer.py


from collections import deque, defaultdict
from mlagents.trainers.action_info import ActionInfoOutputs
from mlagents.envs.exception import UnityException
from mlagents.envs.timers import set_gauge
from mlagents_envs.exception import UnityException
from mlagents_envs.timers import set_gauge
from mlagents.trainers.trainer_metrics import TrainerMetrics
from mlagents.trainers.tf_policy import TFPolicy
from mlagents.trainers.brain import BrainParameters, BrainInfo

4
ml-agents/mlagents/trainers/trainer_controller.py


from time import time
from mlagents.trainers.env_manager import EnvManager, EnvironmentStep
from mlagents.envs.exception import (
from mlagents_envs.exception import (
from mlagents.envs.timers import hierarchical_timer, get_timer_tree, timed
from mlagents_envs.timers import hierarchical_timer, get_timer_tree, timed
from mlagents.trainers.trainer import Trainer, TrainerMetrics
from mlagents.trainers.meta_curriculum import MetaCurriculum
from mlagents.trainers.trainer_util import TrainerFactory

4
notebooks/getting-started.ipynb


"import numpy as np\n",
"import sys\n",
"\n",
"from mlagents.envs.environment import UnityEnvironment\n",
"from mlagents.envs.side_channel.engine_configuration_channel import EngineConfig, EngineConfigurationChannel\n",
"from mlagents_envs.environment import UnityEnvironment\n",
"from mlagents_envs.side_channel.engine_configuration_channel import EngineConfig, EngineConfigurationChannel\n",
"\n",
"%matplotlib inline\n",
"\n",

4
ml-agents-envs/mlagents_envs/communicator.py


import logging
from typing import Optional
from mlagents.envs.communicator_objects.unity_output_pb2 import UnityOutputProto
from mlagents.envs.communicator_objects.unity_input_pb2 import UnityInputProto
from mlagents_envs.communicator_objects.unity_output_pb2 import UnityOutputProto
from mlagents_envs.communicator_objects.unity_input_pb2 import UnityInputProto
logger = logging.getLogger("mlagents.envs")

24
ml-agents-envs/mlagents_envs/environment.py


import subprocess
from typing import Dict, List, Optional, Any
from mlagents.envs.side_channel.side_channel import SideChannel
from mlagents_envs.side_channel.side_channel import SideChannel
from mlagents.envs.base_env import (
from mlagents_envs.base_env import (
BaseEnv,
BatchedStepResult,
AgentGroupSpec,

from mlagents.envs.timers import timed, hierarchical_timer
from mlagents.envs.exception import (
from mlagents_envs.timers import timed, hierarchical_timer
from mlagents_envs.exception import (
UnityEnvironmentException,
UnityCommunicationException,
UnityActionException,

from mlagents.envs.communicator_objects.command_pb2 import STEP, RESET
from mlagents.envs.rpc_utils import (
from mlagents_envs.communicator_objects.command_pb2 import STEP, RESET
from mlagents_envs.rpc_utils import (
from mlagents.envs.communicator_objects.unity_rl_input_pb2 import UnityRLInputProto
from mlagents.envs.communicator_objects.unity_rl_output_pb2 import UnityRLOutputProto
from mlagents.envs.communicator_objects.agent_action_pb2 import AgentActionProto
from mlagents.envs.communicator_objects.unity_output_pb2 import UnityOutputProto
from mlagents.envs.communicator_objects.unity_rl_initialization_input_pb2 import (
from mlagents_envs.communicator_objects.unity_rl_input_pb2 import UnityRLInputProto
from mlagents_envs.communicator_objects.unity_rl_output_pb2 import UnityRLOutputProto
from mlagents_envs.communicator_objects.agent_action_pb2 import AgentActionProto
from mlagents_envs.communicator_objects.unity_output_pb2 import UnityOutputProto
from mlagents_envs.communicator_objects.unity_rl_initialization_input_pb2 import (
from mlagents.envs.communicator_objects.unity_input_pb2 import UnityInputProto
from mlagents_envs.communicator_objects.unity_input_pb2 import UnityInputProto
from .rpc_communicator import RpcCommunicator
from sys import platform

16
ml-agents-envs/mlagents_envs/mock_communicator.py


from .communicator import Communicator
from .environment import UnityEnvironment
from mlagents.envs.communicator_objects.unity_rl_output_pb2 import UnityRLOutputProto
from mlagents.envs.communicator_objects.brain_parameters_pb2 import BrainParametersProto
from mlagents.envs.communicator_objects.unity_rl_initialization_output_pb2 import (
from mlagents_envs.communicator_objects.unity_rl_output_pb2 import UnityRLOutputProto
from mlagents_envs.communicator_objects.brain_parameters_pb2 import BrainParametersProto
from mlagents_envs.communicator_objects.unity_rl_initialization_output_pb2 import (
from mlagents.envs.communicator_objects.unity_input_pb2 import UnityInputProto
from mlagents.envs.communicator_objects.unity_output_pb2 import UnityOutputProto
from mlagents.envs.communicator_objects.agent_info_pb2 import AgentInfoProto
from mlagents.envs.communicator_objects.observation_pb2 import (
from mlagents_envs.communicator_objects.unity_input_pb2 import UnityInputProto
from mlagents_envs.communicator_objects.unity_output_pb2 import UnityOutputProto
from mlagents_envs.communicator_objects.agent_info_pb2 import AgentInfoProto
from mlagents_envs.communicator_objects.observation_pb2 import (
from mlagents.envs.communicator_objects.space_type_pb2 import discrete, continuous
from mlagents_envs.communicator_objects.space_type_pb2 import discrete, continuous
class MockCommunicator(Communicator):

8
ml-agents-envs/mlagents_envs/rpc_communicator.py


from concurrent.futures import ThreadPoolExecutor
from .communicator import Communicator
from mlagents.envs.communicator_objects.unity_to_external_pb2_grpc import (
from mlagents_envs.communicator_objects.unity_to_external_pb2_grpc import (
from mlagents.envs.communicator_objects.unity_message_pb2 import UnityMessageProto
from mlagents.envs.communicator_objects.unity_input_pb2 import UnityInputProto
from mlagents.envs.communicator_objects.unity_output_pb2 import UnityOutputProto
from mlagents_envs.communicator_objects.unity_message_pb2 import UnityMessageProto
from mlagents_envs.communicator_objects.unity_input_pb2 import UnityInputProto
from mlagents_envs.communicator_objects.unity_output_pb2 import UnityOutputProto
from .exception import UnityTimeOutException, UnityWorkerInUseException
logger = logging.getLogger("mlagents.envs")

8
ml-agents-envs/mlagents_envs/rpc_utils.py


from mlagents.envs.base_env import AgentGroupSpec, ActionType, BatchedStepResult
from mlagents.envs.timers import hierarchical_timer, timed
from mlagents.envs.communicator_objects.agent_info_pb2 import AgentInfoProto
from mlagents.envs.communicator_objects.brain_parameters_pb2 import BrainParametersProto
from mlagents_envs.base_env import AgentGroupSpec, ActionType, BatchedStepResult
from mlagents_envs.timers import hierarchical_timer, timed
from mlagents_envs.communicator_objects.agent_info_pb2 import AgentInfoProto
from mlagents_envs.communicator_objects.brain_parameters_pb2 import BrainParametersProto
import logging
import numpy as np
import io

8
ml-agents-envs/mlagents_envs/tests/test_envs.py


import numpy as np
from mlagents.envs.environment import UnityEnvironment
from mlagents.envs.base_env import BatchedStepResult
from mlagents.envs.exception import UnityEnvironmentException, UnityActionException
from mlagents.envs.mock_communicator import MockCommunicator
from mlagents_envs.environment import UnityEnvironment
from mlagents_envs.base_env import BatchedStepResult
from mlagents_envs.exception import UnityEnvironmentException, UnityActionException
from mlagents_envs.mock_communicator import MockCommunicator
@mock.patch("mlagents.envs.environment.UnityEnvironment.get_communicator")

4
ml-agents-envs/mlagents_envs/tests/test_rpc_communicator.py


import pytest
from mlagents.envs.rpc_communicator import RpcCommunicator
from mlagents.envs.exception import UnityWorkerInUseException
from mlagents_envs.rpc_communicator import RpcCommunicator
from mlagents_envs.exception import UnityWorkerInUseException
def test_rpc_communicator_checks_port_on_create():

10
ml-agents-envs/mlagents_envs/tests/test_rpc_utils.py


from typing import List, Tuple
from mlagents.envs.communicator_objects.agent_info_pb2 import AgentInfoProto
from mlagents.envs.communicator_objects.observation_pb2 import (
from mlagents_envs.communicator_objects.agent_info_pb2 import AgentInfoProto
from mlagents_envs.communicator_objects.observation_pb2 import (
from mlagents.envs.communicator_objects.brain_parameters_pb2 import BrainParametersProto
from mlagents_envs.communicator_objects.brain_parameters_pb2 import BrainParametersProto
from mlagents.envs.base_env import AgentGroupSpec, ActionType
from mlagents_envs.base_env import AgentGroupSpec, ActionType
from mlagents.envs.rpc_utils import (
from mlagents_envs.rpc_utils import (
agent_group_spec_from_proto,
process_pixels,
_process_visual_observation,

8
ml-agents-envs/mlagents_envs/tests/test_side_channel.py


import struct
from mlagents.envs.side_channel.side_channel import SideChannel
from mlagents.envs.side_channel.float_properties_channel import FloatPropertiesChannel
from mlagents.envs.side_channel.raw_bytes_channel import RawBytesChannel
from mlagents.envs.environment import UnityEnvironment
from mlagents_envs.side_channel.side_channel import SideChannel
from mlagents_envs.side_channel.float_properties_channel import FloatPropertiesChannel
from mlagents_envs.side_channel.raw_bytes_channel import RawBytesChannel
from mlagents_envs.environment import UnityEnvironment
class IntChannel(SideChannel):

2
ml-agents-envs/mlagents_envs/tests/test_timers.py


from unittest import mock
from mlagents.envs import timers
from mlagents_envs import timers
@timers.timed

4
ml-agents-envs/mlagents_envs/side_channel/engine_configuration_channel.py


from mlagents.envs.side_channel.side_channel import SideChannel, SideChannelType
from mlagents.envs.exception import UnityCommunicationException
from mlagents_envs.side_channel.side_channel import SideChannel, SideChannelType
from mlagents_envs.exception import UnityCommunicationException
import struct
from typing import NamedTuple

2
ml-agents-envs/mlagents_envs/side_channel/float_properties_channel.py


from mlagents.envs.side_channel.side_channel import SideChannel, SideChannelType
from mlagents_envs.side_channel.side_channel import SideChannel, SideChannelType
import struct
from typing import Dict, Tuple, Optional, List

2
ml-agents-envs/mlagents_envs/side_channel/raw_bytes_channel.py


from mlagents.envs.side_channel.side_channel import SideChannel, SideChannelType
from mlagents_envs.side_channel.side_channel import SideChannel, SideChannelType
from typing import List

4
ml-agents-envs/mlagents_envs/communicator_objects/agent_info_action_pair_pb2.py


_sym_db = _symbol_database.Default()
from mlagents.envs.communicator_objects import agent_info_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_agent__info__pb2
from mlagents.envs.communicator_objects import agent_action_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_agent__action__pb2
from mlagents_envs.communicator_objects import agent_info_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_agent__info__pb2
from mlagents_envs.communicator_objects import agent_action_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_agent__action__pb2
DESCRIPTOR = _descriptor.FileDescriptor(

4
ml-agents-envs/mlagents_envs/communicator_objects/agent_info_action_pair_pb2.pyi


Message as google___protobuf___message___Message,
)
from mlagents.envs.communicator_objects.agent_action_pb2 import (
from mlagents_envs.communicator_objects.agent_action_pb2 import (
from mlagents.envs.communicator_objects.agent_info_pb2 import (
from mlagents_envs.communicator_objects.agent_info_pb2 import (
AgentInfoProto as mlagents___envs___communicator_objects___agent_info_pb2___AgentInfoProto,
)

2
ml-agents-envs/mlagents_envs/communicator_objects/agent_info_pb2.py


_sym_db = _symbol_database.Default()
from mlagents.envs.communicator_objects import observation_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_observation__pb2
from mlagents_envs.communicator_objects import observation_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_observation__pb2
DESCRIPTOR = _descriptor.FileDescriptor(

2
ml-agents-envs/mlagents_envs/communicator_objects/agent_info_pb2.pyi


Message as google___protobuf___message___Message,
)
from mlagents.envs.communicator_objects.observation_pb2 import (
from mlagents_envs.communicator_objects.observation_pb2 import (
ObservationProto as mlagents___envs___communicator_objects___observation_pb2___ObservationProto,
)

2
ml-agents-envs/mlagents_envs/communicator_objects/brain_parameters_pb2.py


_sym_db = _symbol_database.Default()
from mlagents.envs.communicator_objects import space_type_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_space__type__pb2
from mlagents_envs.communicator_objects import space_type_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_space__type__pb2
DESCRIPTOR = _descriptor.FileDescriptor(

2
ml-agents-envs/mlagents_envs/communicator_objects/brain_parameters_pb2.pyi


Message as google___protobuf___message___Message,
)
from mlagents.envs.communicator_objects.space_type_pb2 import (
from mlagents_envs.communicator_objects.space_type_pb2 import (
SpaceTypeProto as mlagents___envs___communicator_objects___space_type_pb2___SpaceTypeProto,
)

4
ml-agents-envs/mlagents_envs/communicator_objects/unity_input_pb2.py


_sym_db = _symbol_database.Default()
from mlagents.envs.communicator_objects import unity_rl_input_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__rl__input__pb2
from mlagents.envs.communicator_objects import unity_rl_initialization_input_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__rl__initialization__input__pb2
from mlagents_envs.communicator_objects import unity_rl_input_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__rl__input__pb2
from mlagents_envs.communicator_objects import unity_rl_initialization_input_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__rl__initialization__input__pb2
DESCRIPTOR = _descriptor.FileDescriptor(

4
ml-agents-envs/mlagents_envs/communicator_objects/unity_input_pb2.pyi


Message as google___protobuf___message___Message,
)
from mlagents.envs.communicator_objects.unity_rl_initialization_input_pb2 import (
from mlagents_envs.communicator_objects.unity_rl_initialization_input_pb2 import (
from mlagents.envs.communicator_objects.unity_rl_input_pb2 import (
from mlagents_envs.communicator_objects.unity_rl_input_pb2 import (
UnityRLInputProto as mlagents___envs___communicator_objects___unity_rl_input_pb2___UnityRLInputProto,
)

6
ml-agents-envs/mlagents_envs/communicator_objects/unity_message_pb2.py


_sym_db = _symbol_database.Default()
from mlagents.envs.communicator_objects import unity_output_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__output__pb2
from mlagents.envs.communicator_objects import unity_input_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__input__pb2
from mlagents.envs.communicator_objects import header_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_header__pb2
from mlagents_envs.communicator_objects import unity_output_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__output__pb2
from mlagents_envs.communicator_objects import unity_input_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__input__pb2
from mlagents_envs.communicator_objects import header_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_header__pb2
DESCRIPTOR = _descriptor.FileDescriptor(

6
ml-agents-envs/mlagents_envs/communicator_objects/unity_message_pb2.pyi


Message as google___protobuf___message___Message,
)
from mlagents.envs.communicator_objects.header_pb2 import (
from mlagents_envs.communicator_objects.header_pb2 import (
from mlagents.envs.communicator_objects.unity_input_pb2 import (
from mlagents_envs.communicator_objects.unity_input_pb2 import (
from mlagents.envs.communicator_objects.unity_output_pb2 import (
from mlagents_envs.communicator_objects.unity_output_pb2 import (
UnityOutputProto as mlagents___envs___communicator_objects___unity_output_pb2___UnityOutputProto,
)

4
ml-agents-envs/mlagents_envs/communicator_objects/unity_output_pb2.py


_sym_db = _symbol_database.Default()
from mlagents.envs.communicator_objects import unity_rl_output_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__rl__output__pb2
from mlagents.envs.communicator_objects import unity_rl_initialization_output_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__rl__initialization__output__pb2
from mlagents_envs.communicator_objects import unity_rl_output_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__rl__output__pb2
from mlagents_envs.communicator_objects import unity_rl_initialization_output_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__rl__initialization__output__pb2
DESCRIPTOR = _descriptor.FileDescriptor(

4
ml-agents-envs/mlagents_envs/communicator_objects/unity_output_pb2.pyi


Message as google___protobuf___message___Message,
)
from mlagents.envs.communicator_objects.unity_rl_initialization_output_pb2 import (
from mlagents_envs.communicator_objects.unity_rl_initialization_output_pb2 import (
from mlagents.envs.communicator_objects.unity_rl_output_pb2 import (
from mlagents_envs.communicator_objects.unity_rl_output_pb2 import (
UnityRLOutputProto as mlagents___envs___communicator_objects___unity_rl_output_pb2___UnityRLOutputProto,
)

2
ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_initialization_output_pb2.py


_sym_db = _symbol_database.Default()
from mlagents.envs.communicator_objects import brain_parameters_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_brain__parameters__pb2
from mlagents_envs.communicator_objects import brain_parameters_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_brain__parameters__pb2
DESCRIPTOR = _descriptor.FileDescriptor(

2
ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_initialization_output_pb2.pyi


Message as google___protobuf___message___Message,
)
from mlagents.envs.communicator_objects.brain_parameters_pb2 import (
from mlagents_envs.communicator_objects.brain_parameters_pb2 import (
BrainParametersProto as mlagents___envs___communicator_objects___brain_parameters_pb2___BrainParametersProto,
)

4
ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_input_pb2.py


_sym_db = _symbol_database.Default()
from mlagents.envs.communicator_objects import agent_action_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_agent__action__pb2
from mlagents.envs.communicator_objects import command_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_command__pb2
from mlagents_envs.communicator_objects import agent_action_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_agent__action__pb2
from mlagents_envs.communicator_objects import command_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_command__pb2
DESCRIPTOR = _descriptor.FileDescriptor(

4
ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_input_pb2.pyi


Message as google___protobuf___message___Message,
)
from mlagents.envs.communicator_objects.agent_action_pb2 import (
from mlagents_envs.communicator_objects.agent_action_pb2 import (
from mlagents.envs.communicator_objects.command_pb2 import (
from mlagents_envs.communicator_objects.command_pb2 import (
CommandProto as mlagents___envs___communicator_objects___command_pb2___CommandProto,
)

2
ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_output_pb2.py


_sym_db = _symbol_database.Default()
from mlagents.envs.communicator_objects import agent_info_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_agent__info__pb2
from mlagents_envs.communicator_objects import agent_info_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_agent__info__pb2
DESCRIPTOR = _descriptor.FileDescriptor(

2
ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_output_pb2.pyi


Message as google___protobuf___message___Message,
)
from mlagents.envs.communicator_objects.agent_info_pb2 import (
from mlagents_envs.communicator_objects.agent_info_pb2 import (
AgentInfoProto as mlagents___envs___communicator_objects___agent_info_pb2___AgentInfoProto,
)

2
ml-agents-envs/mlagents_envs/communicator_objects/unity_to_external_pb2.py


_sym_db = _symbol_database.Default()
from mlagents.envs.communicator_objects import unity_message_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__message__pb2
from mlagents_envs.communicator_objects import unity_message_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__message__pb2
DESCRIPTOR = _descriptor.FileDescriptor(

2
ml-agents-envs/mlagents_envs/communicator_objects/unity_to_external_pb2_grpc.py


# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from mlagents.envs.communicator_objects import unity_message_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__message__pb2
from mlagents_envs.communicator_objects import unity_message_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_unity__message__pb2
class UnityToExternalProtoStub(object):

/ml-agents-envs/mlagents/envs → /ml-agents-envs/mlagents_envs

正在加载...
取消
保存