GitHub
5 年前
当前提交
85789ded
共有 23 个文件被更改,包括 604 次插入 和 28 次删除
-
1com.unity.ml-agents/CHANGELOG.md
-
9com.unity.ml-agents/Runtime/Academy.cs
-
17com.unity.ml-agents/Runtime/Communicator/GrpcExtensions.cs
-
10com.unity.ml-agents/Runtime/Communicator/ICommunicator.cs
-
3com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs
-
52com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects/UnityRlInitializationInput.cs
-
58com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects/UnityRlInitializationOutput.cs
-
18ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_initialization_input_pb2.py
-
14ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_initialization_input_pb2.pyi
-
17ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_initialization_output_pb2.py
-
14ml-agents-envs/mlagents_envs/communicator_objects/unity_rl_initialization_output_pb2.pyi
-
28ml-agents-envs/mlagents_envs/environment.py
-
4protobuf-definitions/proto/mlagents_envs/communicator_objects/unity_rl_initialization_input.proto
-
4protobuf-definitions/proto/mlagents_envs/communicator_objects/unity_rl_initialization_output.proto
-
36com.unity.ml-agents/Runtime/Communicator/UnityRLCapabilities.cs
-
3com.unity.ml-agents/Runtime/Communicator/UnityRLCapabilities.cs.meta
-
182com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects/Capabilities.cs
-
11com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects/Capabilities.cs.meta
-
23com.unity.ml-agents/Tests/Editor/Communicator/UnityRLCapabilitiesTests.cs
-
3com.unity.ml-agents/Tests/Editor/Communicator/UnityRLCapabilitiesTests.cs.meta
-
71ml-agents-envs/mlagents_envs/communicator_objects/capabilities_pb2.py
-
41ml-agents-envs/mlagents_envs/communicator_objects/capabilities_pb2.pyi
-
13protobuf-definitions/proto/mlagents_envs/communicator_objects/capabilities.proto
|
|||
using UnityEngine; |
|||
|
|||
namespace MLAgents |
|||
{ |
|||
internal class UnityRLCapabilities |
|||
{ |
|||
internal bool m_BaseRLCapabilities; |
|||
|
|||
/// <summary>
|
|||
/// A class holding the capabilities flags for Reinforcement Learning across C# and the Trainer codebase. This
|
|||
/// struct will be used to inform users if and when they are using C# / Trainer features that are mismatched.
|
|||
/// </summary>
|
|||
public UnityRLCapabilities(bool baseRlCapabilities=true) |
|||
{ |
|||
m_BaseRLCapabilities = baseRlCapabilities; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Will print a warning to the console if Python does not support base capabilities and will
|
|||
/// return <value>true</value> if the warning was printed.
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public bool WarnOnPythonMissingBaseRLCapabilities() |
|||
{ |
|||
if (m_BaseRLCapabilities) |
|||
{ |
|||
return false; |
|||
} |
|||
Debug.LogWarning("Unity has connected to a Training process that does not support" + |
|||
"Base Reinforcement Learning Capabilities. Please make sure you have the" + |
|||
" latest training codebase installed for this version of the ML-Agents package."); |
|||
return true; |
|||
} |
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f95d271af72d4b75aa94d308222f79d8 |
|||
timeCreated: 1587670989 |
|
|||
// <auto-generated>
|
|||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
|||
// source: mlagents_envs/communicator_objects/capabilities.proto
|
|||
// </auto-generated>
|
|||
#pragma warning disable 1591, 0612, 3021
|
|||
#region Designer generated code
|
|||
|
|||
using pb = global::Google.Protobuf; |
|||
using pbc = global::Google.Protobuf.Collections; |
|||
using pbr = global::Google.Protobuf.Reflection; |
|||
using scg = global::System.Collections.Generic; |
|||
namespace MLAgents.CommunicatorObjects { |
|||
|
|||
/// <summary>Holder for reflection information generated from mlagents_envs/communicator_objects/capabilities.proto</summary>
|
|||
internal static partial class CapabilitiesReflection { |
|||
|
|||
#region Descriptor
|
|||
/// <summary>File descriptor for mlagents_envs/communicator_objects/capabilities.proto</summary>
|
|||
public static pbr::FileDescriptor Descriptor { |
|||
get { return descriptor; } |
|||
} |
|||
private static pbr::FileDescriptor descriptor; |
|||
|
|||
static CapabilitiesReflection() { |
|||
byte[] descriptorData = global::System.Convert.FromBase64String( |
|||
string.Concat( |
|||
"CjVtbGFnZW50c19lbnZzL2NvbW11bmljYXRvcl9vYmplY3RzL2NhcGFiaWxp", |
|||
"dGllcy5wcm90bxIUY29tbXVuaWNhdG9yX29iamVjdHMiNgoYVW5pdHlSTENh", |
|||
"cGFiaWxpdGllc1Byb3RvEhoKEmJhc2VSTENhcGFiaWxpdGllcxgBIAEoCEIf", |
|||
"qgIcTUxBZ2VudHMuQ29tbXVuaWNhdG9yT2JqZWN0c2IGcHJvdG8z")); |
|||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, |
|||
new pbr::FileDescriptor[] { }, |
|||
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { |
|||
new pbr::GeneratedClrTypeInfo(typeof(global::MLAgents.CommunicatorObjects.UnityRLCapabilitiesProto), global::MLAgents.CommunicatorObjects.UnityRLCapabilitiesProto.Parser, new[]{ "BaseRLCapabilities" }, null, null, null) |
|||
})); |
|||
} |
|||
#endregion
|
|||
|
|||
} |
|||
#region Messages
|
|||
/// <summary>
|
|||
///
|
|||
/// A Capabilities message that will communicate both C# and Python
|
|||
/// what features are available to both.
|
|||
/// </summary>
|
|||
internal sealed partial class UnityRLCapabilitiesProto : pb::IMessage<UnityRLCapabilitiesProto> { |
|||
private static readonly pb::MessageParser<UnityRLCapabilitiesProto> _parser = new pb::MessageParser<UnityRLCapabilitiesProto>(() => new UnityRLCapabilitiesProto()); |
|||
private pb::UnknownFieldSet _unknownFields; |
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public static pb::MessageParser<UnityRLCapabilitiesProto> Parser { get { return _parser; } } |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public static pbr::MessageDescriptor Descriptor { |
|||
get { return global::MLAgents.CommunicatorObjects.CapabilitiesReflection.Descriptor.MessageTypes[0]; } |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
pbr::MessageDescriptor pb::IMessage.Descriptor { |
|||
get { return Descriptor; } |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public UnityRLCapabilitiesProto() { |
|||
OnConstruction(); |
|||
} |
|||
|
|||
partial void OnConstruction(); |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public UnityRLCapabilitiesProto(UnityRLCapabilitiesProto other) : this() { |
|||
baseRLCapabilities_ = other.baseRLCapabilities_; |
|||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public UnityRLCapabilitiesProto Clone() { |
|||
return new UnityRLCapabilitiesProto(this); |
|||
} |
|||
|
|||
/// <summary>Field number for the "baseRLCapabilities" field.</summary>
|
|||
public const int BaseRLCapabilitiesFieldNumber = 1; |
|||
private bool baseRLCapabilities_; |
|||
/// <summary>
|
|||
/// These are the 1.0 capabilities.
|
|||
/// </summary>
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public bool BaseRLCapabilities { |
|||
get { return baseRLCapabilities_; } |
|||
set { |
|||
baseRLCapabilities_ = value; |
|||
} |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public override bool Equals(object other) { |
|||
return Equals(other as UnityRLCapabilitiesProto); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public bool Equals(UnityRLCapabilitiesProto other) { |
|||
if (ReferenceEquals(other, null)) { |
|||
return false; |
|||
} |
|||
if (ReferenceEquals(other, this)) { |
|||
return true; |
|||
} |
|||
if (BaseRLCapabilities != other.BaseRLCapabilities) return false; |
|||
return Equals(_unknownFields, other._unknownFields); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public override int GetHashCode() { |
|||
int hash = 1; |
|||
if (BaseRLCapabilities != false) hash ^= BaseRLCapabilities.GetHashCode(); |
|||
if (_unknownFields != null) { |
|||
hash ^= _unknownFields.GetHashCode(); |
|||
} |
|||
return hash; |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public override string ToString() { |
|||
return pb::JsonFormatter.ToDiagnosticString(this); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public void WriteTo(pb::CodedOutputStream output) { |
|||
if (BaseRLCapabilities != false) { |
|||
output.WriteRawTag(8); |
|||
output.WriteBool(BaseRLCapabilities); |
|||
} |
|||
if (_unknownFields != null) { |
|||
_unknownFields.WriteTo(output); |
|||
} |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public int CalculateSize() { |
|||
int size = 0; |
|||
if (BaseRLCapabilities != false) { |
|||
size += 1 + 1; |
|||
} |
|||
if (_unknownFields != null) { |
|||
size += _unknownFields.CalculateSize(); |
|||
} |
|||
return size; |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public void MergeFrom(UnityRLCapabilitiesProto other) { |
|||
if (other == null) { |
|||
return; |
|||
} |
|||
if (other.BaseRLCapabilities != false) { |
|||
BaseRLCapabilities = other.BaseRLCapabilities; |
|||
} |
|||
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public void MergeFrom(pb::CodedInputStream input) { |
|||
uint tag; |
|||
while ((tag = input.ReadTag()) != 0) { |
|||
switch(tag) { |
|||
default: |
|||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); |
|||
break; |
|||
case 8: { |
|||
BaseRLCapabilities = input.ReadBool(); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
} |
|||
|
|||
#endregion Designer generated code
|
|
|||
fileFormatVersion: 2 |
|||
guid: e8388443b440343299cab2e88988e14e |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Text.RegularExpressions; |
|||
using NUnit.Framework; |
|||
using UnityEngine; |
|||
using UnityEngine.TestTools; |
|||
|
|||
namespace MLAgents.Tests.Communicator |
|||
{ |
|||
[TestFixture] |
|||
public class UnityRLCapabilitiesTests |
|||
{ |
|||
[Test] |
|||
public void TestWarnOnPythonMissingBaseRLCapabilities() |
|||
{ |
|||
var caps = new UnityRLCapabilities(); |
|||
Assert.False(caps.WarnOnPythonMissingBaseRLCapabilities()); |
|||
LogAssert.NoUnexpectedReceived(); |
|||
caps = new UnityRLCapabilities(false); |
|||
Assert.True(caps.WarnOnPythonMissingBaseRLCapabilities()); |
|||
LogAssert.Expect(LogType.Warning, new Regex(".+")); |
|||
} |
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e6a3e82911b84029a446dcfd2d8af520 |
|||
timeCreated: 1587695055 |
|
|||
# Generated by the protocol buffer compiler. DO NOT EDIT! |
|||
# source: mlagents_envs/communicator_objects/capabilities.proto |
|||
|
|||
import sys |
|||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) |
|||
from google.protobuf import descriptor as _descriptor |
|||
from google.protobuf import message as _message |
|||
from google.protobuf import reflection as _reflection |
|||
from google.protobuf import symbol_database as _symbol_database |
|||
from google.protobuf import descriptor_pb2 |
|||
# @@protoc_insertion_point(imports) |
|||
|
|||
_sym_db = _symbol_database.Default() |
|||
|
|||
|
|||
|
|||
|
|||
DESCRIPTOR = _descriptor.FileDescriptor( |
|||
name='mlagents_envs/communicator_objects/capabilities.proto', |
|||
package='communicator_objects', |
|||
syntax='proto3', |
|||
serialized_pb=_b('\n5mlagents_envs/communicator_objects/capabilities.proto\x12\x14\x63ommunicator_objects\"6\n\x18UnityRLCapabilitiesProto\x12\x1a\n\x12\x62\x61seRLCapabilities\x18\x01 \x01(\x08\x42\x1f\xaa\x02\x1cMLAgents.CommunicatorObjectsb\x06proto3') |
|||
) |
|||
|
|||
|
|||
|
|||
|
|||
_UNITYRLCAPABILITIESPROTO = _descriptor.Descriptor( |
|||
name='UnityRLCapabilitiesProto', |
|||
full_name='communicator_objects.UnityRLCapabilitiesProto', |
|||
filename=None, |
|||
file=DESCRIPTOR, |
|||
containing_type=None, |
|||
fields=[ |
|||
_descriptor.FieldDescriptor( |
|||
name='baseRLCapabilities', full_name='communicator_objects.UnityRLCapabilitiesProto.baseRLCapabilities', index=0, |
|||
number=1, type=8, cpp_type=7, label=1, |
|||
has_default_value=False, default_value=False, |
|||
message_type=None, enum_type=None, containing_type=None, |
|||
is_extension=False, extension_scope=None, |
|||
options=None, file=DESCRIPTOR), |
|||
], |
|||
extensions=[ |
|||
], |
|||
nested_types=[], |
|||
enum_types=[ |
|||
], |
|||
options=None, |
|||
is_extendable=False, |
|||
syntax='proto3', |
|||
extension_ranges=[], |
|||
oneofs=[ |
|||
], |
|||
serialized_start=79, |
|||
serialized_end=133, |
|||
) |
|||
|
|||
DESCRIPTOR.message_types_by_name['UnityRLCapabilitiesProto'] = _UNITYRLCAPABILITIESPROTO |
|||
_sym_db.RegisterFileDescriptor(DESCRIPTOR) |
|||
|
|||
UnityRLCapabilitiesProto = _reflection.GeneratedProtocolMessageType('UnityRLCapabilitiesProto', (_message.Message,), dict( |
|||
DESCRIPTOR = _UNITYRLCAPABILITIESPROTO, |
|||
__module__ = 'mlagents_envs.communicator_objects.capabilities_pb2' |
|||
# @@protoc_insertion_point(class_scope:communicator_objects.UnityRLCapabilitiesProto) |
|||
)) |
|||
_sym_db.RegisterMessage(UnityRLCapabilitiesProto) |
|||
|
|||
|
|||
DESCRIPTOR.has_options = True |
|||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\252\002\034MLAgents.CommunicatorObjects')) |
|||
# @@protoc_insertion_point(module_scope) |
|
|||
# @generated by generate_proto_mypy_stubs.py. Do not edit! |
|||
import sys |
|||
from google.protobuf.descriptor import ( |
|||
Descriptor as google___protobuf___descriptor___Descriptor, |
|||
) |
|||
|
|||
from google.protobuf.message import ( |
|||
Message as google___protobuf___message___Message, |
|||
) |
|||
|
|||
from typing import ( |
|||
Optional as typing___Optional, |
|||
) |
|||
|
|||
from typing_extensions import ( |
|||
Literal as typing_extensions___Literal, |
|||
) |
|||
|
|||
|
|||
builtin___bool = bool |
|||
builtin___bytes = bytes |
|||
builtin___float = float |
|||
builtin___int = int |
|||
|
|||
|
|||
class UnityRLCapabilitiesProto(google___protobuf___message___Message): |
|||
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... |
|||
baseRLCapabilities = ... # type: builtin___bool |
|||
|
|||
def __init__(self, |
|||
*, |
|||
baseRLCapabilities : typing___Optional[builtin___bool] = None, |
|||
) -> None: ... |
|||
@classmethod |
|||
def FromString(cls, s: builtin___bytes) -> UnityRLCapabilitiesProto: ... |
|||
def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... |
|||
def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... |
|||
if sys.version_info >= (3,): |
|||
def ClearField(self, field_name: typing_extensions___Literal[u"baseRLCapabilities"]) -> None: ... |
|||
else: |
|||
def ClearField(self, field_name: typing_extensions___Literal[u"baseRLCapabilities",b"baseRLCapabilities"]) -> None: ... |
|
|||
syntax = "proto3"; |
|||
|
|||
option csharp_namespace="MLAgents.CommunicatorObjects"; |
|||
package communicator_objects; |
|||
|
|||
/* |
|||
* A Capabilities message that will communicate both C# and Python |
|||
* what features are available to both. |
|||
*/ |
|||
message UnityRLCapabilitiesProto { |
|||
// These are the 1.0 capabilities. |
|||
bool baseRLCapabilities = 1; |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue