Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ae4a5bc
Commiting changes.
Apr 5, 2023
718ea24
Initial barracuda 4 upgrade.
Apr 9, 2023
7d4ed74
Play mode tests passing.
Apr 12, 2023
76b2e29
Edit mode tests passing.
Apr 13, 2023
3b0ebbe
Training fixes.
Apr 16, 2023
aa5256c
Fixed performance issue with stacking sensor.
Apr 16, 2023
39eaa39
Fixed failing tests and issue with stacking sensor.
Apr 16, 2023
b5b6264
Updated examples for barracuda 4 upgrade.
Apr 17, 2023
621756f
Fixed issue with attention ONNX export w.r.t. dimensions.
Apr 19, 2023
82e45d6
Fixed issue with Buffer Sensor and Recurrent In/Out.
Apr 20, 2023
1c322a3
Retrained old policies and updated with ONNX policies. Deprecated old…
Apr 20, 2023
7aca88a
Saving work.
Jul 26, 2023
a829b72
Saving work.
Aug 14, 2023
6a6237c
Updating to Sentis 1.1.1-exp.2
Sep 11, 2023
9d34079
Fixed more errors with Sentis upgrade.
Sep 12, 2023
6b8e7a3
Fixed tensor allocation issue in TensorUtils.ResizeTensor. Inference …
Sep 12, 2023
56e7630
Fixed broken Sentis model links for some example environments.
Sep 12, 2023
343cc5f
Fixed some broken edit mode tests.
Sep 12, 2023
a98520e
Fixed some failing tests.
Sep 12, 2023
c6f8303
Fixing bugs with GPU inference on Sentis.
Oct 2, 2023
01dd77f
Updated packages lock and onnx meta files.
Oct 2, 2023
c8f46d0
Refactoring all Barracuda related naming to Sentis.
Oct 2, 2023
b4122df
Python max version bump.
Oct 2, 2023
17ee61f
Precommit fixes.
Oct 2, 2023
1fcf380
Pinned tensorboard version
Oct 2, 2023
44d80de
Revert tensorboard version.
Oct 2, 2023
565568c
Fixed rpc tests.
Oct 2, 2023
d49357c
Fixed failing python tests.
Oct 3, 2023
d40d4d2
Fixed some more failing tests. Added six as an explicit dependency du…
Oct 3, 2023
fff6d98
gha fix.
Oct 3, 2023
2196124
Updated environment registry for Sentis.
Oct 3, 2023
e6a7c0b
Fixed texture sensor test.
Oct 3, 2023
42ab41f
Develop python 3.10 (#5981)
miguelalonsojr Oct 4, 2023
6427cdf
Develop torch 1.13.1 (#5982)
miguelalonsojr Oct 5, 2023
4e39553
Updated protobufs. (#5983)
miguelalonsojr Oct 5, 2023
ddcc42a
Updated training init tests to remove inference test temporarily. (#5…
miguelalonsojr Oct 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Commiting changes.
  • Loading branch information
Miguel Alonso Jr committed Aug 8, 2023
commit ae4a5bcca1247d781716839bcf3e38795b6e22fc
3 changes: 2 additions & 1 deletion Project/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
"com.unity.ml-agents",
"com.unity.ml-agents.extensions",
"com.unity.inputsystem"
]
],
"registry": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
}
32 changes: 16 additions & 16 deletions Project/Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
"url": "https://packages.unity.com"
},
"com.unity.barracuda": {
"version": "3.0.0",
"version": "4.2.0-preview",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.burst": "1.6.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0"
},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.burst": {
"version": "1.8.7",
Expand All @@ -34,14 +34,14 @@
"dependencies": {
"com.unity.mathematics": "1.2.1"
},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.ext.nunit": {
"version": "1.0.6",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.formats.fbx": {
"version": "4.2.1",
Expand All @@ -60,7 +60,7 @@
"dependencies": {
"com.unity.ext.nunit": "1.0.6"
},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.inputsystem": {
"version": "1.6.1",
Expand All @@ -69,21 +69,21 @@
"dependencies": {
"com.unity.modules.uielements": "1.0.0"
},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.mathematics": {
"version": "1.2.6",
"depth": 3,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.ml-agents": {
"version": "file:../../com.unity.ml-agents",
"depth": 0,
"source": "local",
"dependencies": {
"com.unity.barracuda": "3.0.0",
"com.unity.barracuda": "4.2.0-preview",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
}
Expand All @@ -102,7 +102,7 @@
"depth": 0,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.recorder": {
"version": "4.0.1",
Expand All @@ -111,14 +111,14 @@
"dependencies": {
"com.unity.timeline": "1.0.0"
},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.sysroot": {
"version": "2.0.5",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.sysroot.linux-x86_64": {
"version": "2.0.4",
Expand All @@ -127,7 +127,7 @@
"dependencies": {
"com.unity.sysroot": "2.0.5"
},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.test-framework": {
"version": "1.1.33",
Expand All @@ -138,7 +138,7 @@
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.textmeshpro": {
"version": "3.0.6",
Expand All @@ -147,7 +147,7 @@
"dependencies": {
"com.unity.ugui": "1.0.0"
},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.timeline": {
"version": "1.7.4",
Expand All @@ -159,7 +159,7 @@
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0"
},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.toolchain.macos-x86_64-linux-x86_64": {
"version": "2.0.4",
Expand All @@ -169,7 +169,7 @@
"com.unity.sysroot": "2.0.5",
"com.unity.sysroot.linux-x86_64": "2.0.4"
},
"url": "https://packages.unity.com"
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.ugui": {
"version": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion com.unity.ml-agents/Runtime/Analytics/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal struct InferenceEvent
/// </summary>
public string BehaviorName;
public string BarracudaModelSource;
public string BarracudaModelVersion;
public long BarracudaModelVersion;
public string BarracudaModelProducer;
public string BarracudaPackageVersion;
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ static long GetModelWeightSize(Model barracudaModel)
long totalWeightsSizeInBytes = 0;
for (var l = 0; l < barracudaModel.layers.Count; ++l)
{
// for (var d = 0; d < barracudaModel.layers[l].datasets.Length; ++d)
for (var d = 0; d < barracudaModel.layers[l].datasets.Length; ++d)
{
totalWeightsSizeInBytes += barracudaModel.layers[l].datasets[d].length;
Expand Down
10 changes: 5 additions & 5 deletions com.unity.ml-agents/Runtime/Inference/ApplierImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void Apply(TensorProxy tensorProxy, IList<int> actionIds, Dictionary<int,
var continuousBuffer = actionBuffer.ContinuousActions;
for (var j = 0; j < actionSize; j++)
{
continuousBuffer[j] = tensorProxy.data[agentIndex, j];
continuousBuffer[j] = ((TensorFloat)tensorProxy.data)[agentIndex, j];
}
}
agentIndex++;
Expand Down Expand Up @@ -77,7 +77,7 @@ public void Apply(TensorProxy tensorProxy, IList<int> actionIds, Dictionary<int,
var discreteBuffer = actionBuffer.DiscreteActions;
for (var j = 0; j < actionSize; j++)
{
discreteBuffer[j] = (int)tensorProxy.data[agentIndex, j];
discreteBuffer[j] = ((TensorInt)tensorProxy.data)[agentIndex, j];
}
}
agentIndex++;
Expand Down Expand Up @@ -152,14 +152,14 @@ internal void ComputeCdf(TensorProxy logProbs, int batch, int channelOffset, int
var maxProb = float.NegativeInfinity;
for (var cls = 0; cls < branchSize; ++cls)
{
maxProb = Mathf.Max(logProbs.data[batch, cls + channelOffset], maxProb);
maxProb = Mathf.Max(((TensorFloat)logProbs.data)[batch, cls + channelOffset], maxProb);
}

// Sum the log probabilities and compute CDF
var sumProb = 0.0f;
for (var cls = 0; cls < branchSize; ++cls)
{
sumProb += Mathf.Exp(logProbs.data[batch, cls + channelOffset] - maxProb);
sumProb += Mathf.Exp(((TensorFloat)logProbs.data)[batch, cls + channelOffset] - maxProb);
m_CdfBuffer[cls] = sumProb;
}
}
Expand Down Expand Up @@ -196,7 +196,7 @@ public void Apply(TensorProxy tensorProxy, IList<int> actionIds, Dictionary<int,

for (var j = 0; j < memorySize; j++)
{
memory[j] = tensorProxy.data[agentIndex, 0, j, 0];
memory[j] = ((TensorFloat)tensorProxy.data)[agentIndex, 0, j, 0];
}

m_Memories[agentId] = memory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ static IEnumerable<FailedCheck> CheckOutputTensorShape(
/// check failed. If the check passed, returns null.
/// </returns>
static FailedCheck CheckDiscreteActionOutputShape(
BrainParameters brainParameters, ActuatorComponent[] actuatorComponents, Tensor modelDiscreteBranches)
BrainParameters brainParameters, ActuatorComponent[] actuatorComponents, TensorInt modelDiscreteBranches)
{
var discreteActionBranches = brainParameters.ActionSpec.BranchSizes.ToList();
foreach (var actuatorComponent in actuatorComponents)
Expand All @@ -811,7 +811,7 @@ static FailedCheck CheckDiscreteActionOutputShape(
discreteActionBranches.AddRange(actionSpec.BranchSizes);
}

int modelDiscreteBranchesLength = modelDiscreteBranches?.length ?? 0;
int modelDiscreteBranchesLength = modelDiscreteBranches?.shape.length ?? 0;
if (modelDiscreteBranchesLength != discreteActionBranches.Count)
{
return FailedCheck.Warning("Discrete Action Size of the model does not match. The BrainParameters expect " +
Expand Down
12 changes: 6 additions & 6 deletions com.unity.ml-agents/Runtime/Inference/GeneratorImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void Generate(TensorProxy tensorProxy, int batchSize, IList<AgentInfoSens
{
tensorProxy.data?.Dispose();
tensorProxy.data = m_Allocator.Alloc(new TensorShape(1, 1));
tensorProxy.data[0] = batchSize;
((TensorInt)tensorProxy.data)[0] = batchSize;
}
}

Expand All @@ -67,7 +67,7 @@ public void Generate(TensorProxy tensorProxy, int batchSize, IList<AgentInfoSens
tensorProxy.shape = new long[0];
tensorProxy.data?.Dispose();
tensorProxy.data = m_Allocator.Alloc(new TensorShape(1, 1));
tensorProxy.data[0] = 1;
((TensorInt)tensorProxy.data)[0] = 1;
}
}

Expand Down Expand Up @@ -112,7 +112,7 @@ public void Generate(
{
for (var j = 0; j < memorySize; j++)
{
tensorProxy.data[agentIndex, 0, j, 0] = 0;
((TensorFloat)tensorProxy.data)[agentIndex, 0, j, 0] = 0;
}
agentIndex++;
continue;
Expand All @@ -123,7 +123,7 @@ public void Generate(
{
break;
}
tensorProxy.data[agentIndex, 0, j, 0] = memory[j];
((TensorFloat)tensorProxy.data)[agentIndex, 0, j, 0] = memory[j];
}
agentIndex++;
}
Expand Down Expand Up @@ -160,7 +160,7 @@ public void Generate(TensorProxy tensorProxy, int batchSize, IList<AgentInfoSens
{
for (var j = 0; j < actionSize; j++)
{
tensorProxy.data[agentIndex, j] = pastAction[j];
((TensorInt)tensorProxy.data)[agentIndex, j] = pastAction[j];
}
}

Expand Down Expand Up @@ -198,7 +198,7 @@ public void Generate(TensorProxy tensorProxy, int batchSize, IList<AgentInfoSens
for (var j = 0; j < maskSize; j++)
{
var isUnmasked = (maskList != null && maskList[j]) ? 0.0f : 1.0f;
tensorProxy.data[agentIndex, j] = isUnmasked;
((TensorFloat)tensorProxy.data)[agentIndex, j] = isUnmasked;
}
agentIndex++;
}
Expand Down
4 changes: 2 additions & 2 deletions com.unity.ml-agents/Runtime/Inference/TensorProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static void FillTensorBatch(TensorProxy tensorProxy, int batch, float fil
{
for (var c = 0; c < channels; c++)
{
tensorProxy.data[batch, h, w, c] = fillValue;
((TensorFloat)tensorProxy.data)[batch, h, w, c] = fillValue;
}
}
}
Expand Down Expand Up @@ -154,7 +154,7 @@ public static void FillTensorWithRandomNormal(

for (var i = 0; i < tensorProxy.data.length; i++)
{
tensorProxy.data[i] = (float)randomNormal.NextDouble();
((TensorFloat)tensorProxy.data)[i] = (float)randomNormal.NextDouble();
}
}
}
Expand Down
28 changes: 14 additions & 14 deletions com.unity.ml-agents/Runtime/Sensors/ObservationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public float this[int index]
}
else
{
m_Proxy.data[m_Batch, index + m_Offset] = value;
((TensorFloat)m_Proxy.data)[m_Batch, index + m_Offset] = value;
}
}
}
Expand Down Expand Up @@ -123,7 +123,7 @@ public float this[int index]
}
else
{
m_Proxy.data[m_Batch, h, w, ch + m_Offset] = value;
((TensorFloat)m_Proxy.data)[m_Batch, h, w, ch + m_Offset] = value;
}
}
}
Expand All @@ -148,7 +148,7 @@ public void AddList(IList<float> data, int writeOffset = 0)
for (var index = 0; index < data.Count; index++)
{
var val = data[index];
m_Proxy.data[m_Batch, index + m_Offset + writeOffset] = val;
((TensorFloat)m_Proxy.data)[m_Batch, index + m_Offset + writeOffset] = val;
}
}
}
Expand All @@ -168,9 +168,9 @@ public void Add(Vector3 vec, int writeOffset = 0)
}
else
{
m_Proxy.data[m_Batch, m_Offset + writeOffset + 0] = vec.x;
m_Proxy.data[m_Batch, m_Offset + writeOffset + 1] = vec.y;
m_Proxy.data[m_Batch, m_Offset + writeOffset + 2] = vec.z;
((TensorFloat)m_Proxy.data)[m_Batch, m_Offset + writeOffset + 0] = vec.x;
((TensorFloat)m_Proxy.data)[m_Batch, m_Offset + writeOffset + 1] = vec.y;
((TensorFloat)m_Proxy.data)[m_Batch, m_Offset + writeOffset + 2] = vec.z;
}
}

Expand All @@ -190,10 +190,10 @@ public void Add(Vector4 vec, int writeOffset = 0)
}
else
{
m_Proxy.data[m_Batch, m_Offset + writeOffset + 0] = vec.x;
m_Proxy.data[m_Batch, m_Offset + writeOffset + 1] = vec.y;
m_Proxy.data[m_Batch, m_Offset + writeOffset + 2] = vec.z;
m_Proxy.data[m_Batch, m_Offset + writeOffset + 3] = vec.w;
((TensorFloat)m_Proxy.data)[m_Batch, m_Offset + writeOffset + 0] = vec.x;
((TensorFloat)m_Proxy.data)[m_Batch, m_Offset + writeOffset + 1] = vec.y;
((TensorFloat)m_Proxy.data)[m_Batch, m_Offset + writeOffset + 2] = vec.z;
((TensorFloat)m_Proxy.data)[m_Batch, m_Offset + writeOffset + 3] = vec.w;
}
}

Expand All @@ -214,10 +214,10 @@ public void Add(Quaternion quat, int writeOffset = 0)
}
else
{
m_Proxy.data[m_Batch, m_Offset + writeOffset + 0] = quat.x;
m_Proxy.data[m_Batch, m_Offset + writeOffset + 1] = quat.y;
m_Proxy.data[m_Batch, m_Offset + writeOffset + 2] = quat.z;
m_Proxy.data[m_Batch, m_Offset + writeOffset + 3] = quat.w;
((TensorFloat)m_Proxy.data)[m_Batch, m_Offset + writeOffset + 0] = quat.x;
((TensorFloat)m_Proxy.data)[m_Batch, m_Offset + writeOffset + 1] = quat.y;
((TensorFloat)m_Proxy.data)[m_Batch, m_Offset + writeOffset + 2] = quat.z;
((TensorFloat)m_Proxy.data)[m_Batch, m_Offset + writeOffset + 3] = quat.w;
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion com.unity.ml-agents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
"unity": "2022.3",
"description": "Use state-of-the-art machine learning to create intelligent character behaviors in any Unity environment (games, robotics, film, etc.).",
"dependencies": {
"com.unity.barracuda": "3.0.0",
"com.unity.barracuda": "4.2.0-preview",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.physics": "1.0.0"
}
"registry": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
}