Skip to content

Commit 88f886b

Browse files
author
Chris Elion
authored
better message for new model format (#5240)
1 parent f8f2bfe commit 88f886b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

com.unity.ml-agents/Runtime/Inference/BarracudaModelParamLoader.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,22 @@ public static IEnumerable<string> CheckModel(Model model, BrainParameters brainP
6666
"Cannot use this model.");
6767
return failedModelChecks;
6868
}
69-
if (modelApiVersion != k_ApiVersion)
69+
if (modelApiVersion < k_ApiVersion)
7070
{
7171
failedModelChecks.Add(
7272
$"Version of the trainer the model was trained with ({modelApiVersion}) " +
7373
$"is not compatible with the Brain's version ({k_ApiVersion}).");
7474
return failedModelChecks;
7575
}
76+
if (modelApiVersion > k_ApiVersion)
77+
{
78+
failedModelChecks.Add(
79+
"Model was trained with a newer version of the trainer than is supported. " +
80+
"Either retrain with an older trainer, or update to a newer version of com.unity.ml-agents.\n" +
81+
$"Model version: {modelApiVersion} Supported version: {k_ApiVersion}"
82+
);
83+
return failedModelChecks;
84+
}
7685

7786
var memorySize = (int)model.GetTensorByName(TensorNames.MemorySize)[0];
7887
if (memorySize == -1)

0 commit comments

Comments
 (0)