Skip to content

Commit dfd65a3

Browse files
author
Chris Elion
authored
class variable for API verison, fix env tests (#2817)
1 parent 57a6499 commit dfd65a3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ml-agents-envs/mlagents/envs/environment.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class UnityEnvironment(BaseUnityEnvironment):
4242
SCALAR_ACTION_TYPES = (int, np.int32, np.int64, float, np.float32, np.float64)
4343
SINGLE_BRAIN_ACTION_TYPES = SCALAR_ACTION_TYPES + (list, np.ndarray)
4444
SINGLE_BRAIN_TEXT_TYPES = list
45+
API_VERSION = "API-11"
4546

4647
def __init__(
4748
self,
@@ -72,7 +73,7 @@ def __init__(
7273
atexit.register(self._close)
7374
self.port = base_port + worker_id
7475
self._buffer_size = 12000
75-
self._version_ = "API-11"
76+
self._version_ = UnityEnvironment.API_VERSION
7677
self._loaded = (
7778
False
7879
) # If true, this means the environment was successfully loaded

ml-agents-envs/mlagents/envs/mock_communicator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from .communicator import Communicator
2+
from .environment import UnityEnvironment
23
from mlagents.envs.communicator_objects.unity_rl_output_pb2 import UnityRLOutputProto
34
from mlagents.envs.communicator_objects.brain_parameters_pb2 import BrainParametersProto
45
from mlagents.envs.communicator_objects.unity_rl_initialization_output_pb2 import (
@@ -52,7 +53,10 @@ def initialize(self, inputs: UnityInputProto) -> UnityOutputProto:
5253
is_training=True,
5354
)
5455
rl_init = UnityRLInitializationOutputProto(
55-
name="RealFakeAcademy", version="API-10", log_path="", brain_parameters=[bp]
56+
name="RealFakeAcademy",
57+
version=UnityEnvironment.API_VERSION,
58+
log_path="",
59+
brain_parameters=[bp],
5660
)
5761
output = UnityRLOutputProto(agentInfos=self._get_agent_infos())
5862
return UnityOutputProto(rl_initialization_output=rl_init, rl_output=output)

0 commit comments

Comments
 (0)