From 6db98615711b5a999ad8d388a618aa31d7e76406 Mon Sep 17 00:00:00 2001 From: Chris Elion Date: Fri, 9 Apr 2021 10:56:20 -0700 Subject: [PATCH] better message for new model format --- .../Runtime/Inference/BarracudaModelParamLoader.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/com.unity.ml-agents/Runtime/Inference/BarracudaModelParamLoader.cs b/com.unity.ml-agents/Runtime/Inference/BarracudaModelParamLoader.cs index d45e59246b..3e3b91b5d6 100644 --- a/com.unity.ml-agents/Runtime/Inference/BarracudaModelParamLoader.cs +++ b/com.unity.ml-agents/Runtime/Inference/BarracudaModelParamLoader.cs @@ -66,13 +66,22 @@ public static IEnumerable CheckModel(Model model, BrainParameters brainP "Cannot use this model."); return failedModelChecks; } - if (modelApiVersion != k_ApiVersion) + if (modelApiVersion < k_ApiVersion) { failedModelChecks.Add( $"Version of the trainer the model was trained with ({modelApiVersion}) " + $"is not compatible with the Brain's version ({k_ApiVersion})."); return failedModelChecks; } + if (modelApiVersion > k_ApiVersion) + { + failedModelChecks.Add( + "Model was trained with a newer version of the trainer than is supported. " + + "Either retrain with an older trainer, or update to a newer version of com.unity.ml-agents.\n" + + $"Model version: {modelApiVersion} Supported version: {k_ApiVersion}" + ); + return failedModelChecks; + } var memorySize = (int)model.GetTensorByName(TensorNames.MemorySize)[0]; if (memorySize == -1)