Closed TheTrope closed 3 years ago
Another follow up:
When importing (or selection ) an onnx trained with the grid sensor, I have this error (x8 times)
Unexpected error while evaluating model output version_number. System.ArgumentException: Cannot reshape array of size 32768 into shape with multiple of 768 elements
at Unity.Barracuda.TensorExtensions.Reshape (Unity.Barracuda.TensorShape shape, System.Int32[] size4Dor8D) [0x0018c] in C:\Users\alexi\Dev\MyProject\Library\PackageCache\com.unity.barracuda@1.4.0-preview\Barracuda\Runtime\Core\TensorExtensions.cs:495
at Unity.Barracuda.ModelAnalyzer.ListTemporaryTensorShapes (Unity.Barracuda.Model model, System.Collections.Generic.IDictionary`2[TKey,TValue] inputShapes, System.Collections.Generic.IDictionary`2[System.String,System.Nullable`1[Unity.Barracuda.TensorShape]]& shapesByName) [0x00c2f] in C:\Users\alexi\Dev\MyProject\Library\PackageCache\com.unity.barracuda@1.4.0-preview\Barracuda\Runtime\Core\Backends\ModelAnalyzer.cs:410
at Unity.Barracuda.ModelAnalyzer.TryGetOutputTensorShape (Unity.Barracuda.Model model, System.Collections.Generic.IDictionary`2[TKey,TValue] inputShapes, System.String output, Unity.Barracuda.TensorShape& shape) [0x00007] in C:\Users\alexi\Dev\MyProject\Library\PackageCache\com.unity.barracuda@1.4.0-preview\Barracuda\Runtime\Core\Backends\ModelAnalyzer.cs:586
at Unity.Barracuda.Editor.NNModelEditor+<>c__DisplayClass33_0.<OnEnable>b__2 (System.String i) [0x00006] in C:\Users\alexi\Dev\MyProject\Library\PackageCache\com.unity.barracuda@1.4.0-preview\Barracuda\Editor\ONNXModelImporterEditor.cs:209
UnityEngine.Debug:LogError (object)
Unity.Barracuda.D:LogError (object) (at Library/PackageCache/com.unity.barracuda@1.4.0-preview/Barracuda/Runtime/Core/Internals/Debug.cs:131)
Unity.Barracuda.Editor.NNModelEditor/<>c__DisplayClass33_0:<OnEnable>b__2 (string) (at Library/PackageCache/com.unity.barracuda@1.4.0-preview/Barracuda/Editor/ONNXModelImporterEditor.cs:214)
System.Linq.Enumerable:ToList<string> (System.Collections.Generic.IEnumerable`1<string>)
Unity.Barracuda.Editor.NNModelEditor:OnEnable () (at Library/PackageCache/com.unity.barracuda@1.4.0-preview/Barracuda/Editor/ONNXModelImporterEditor.cs:204)
Is it related? or is it a separate issue?
Another follow up:
When importing (or selection ) an onnx trained with the grid sensor, I have this error (x8 times)
Unexpected error while evaluating model output version_number. System.ArgumentException: Cannot reshape array of size 32768 into shape with multiple of 768 elements at Unity.Barracuda.TensorExtensions.Reshape (Unity.Barracuda.TensorShape shape, System.Int32[] size4Dor8D) [0x0018c] in C:\Users\alexi\Dev\MyProject\Library\PackageCache\com.unity.barracuda@1.4.0-preview\Barracuda\Runtime\Core\TensorExtensions.cs:495 at Unity.Barracuda.ModelAnalyzer.ListTemporaryTensorShapes (Unity.Barracuda.Model model, System.Collections.Generic.IDictionary`2[TKey,TValue] inputShapes, System.Collections.Generic.IDictionary`2[System.String,System.Nullable`1[Unity.Barracuda.TensorShape]]& shapesByName) [0x00c2f] in C:\Users\alexi\Dev\MyProject\Library\PackageCache\com.unity.barracuda@1.4.0-preview\Barracuda\Runtime\Core\Backends\ModelAnalyzer.cs:410 at Unity.Barracuda.ModelAnalyzer.TryGetOutputTensorShape (Unity.Barracuda.Model model, System.Collections.Generic.IDictionary`2[TKey,TValue] inputShapes, System.String output, Unity.Barracuda.TensorShape& shape) [0x00007] in C:\Users\alexi\Dev\MyProject\Library\PackageCache\com.unity.barracuda@1.4.0-preview\Barracuda\Runtime\Core\Backends\ModelAnalyzer.cs:586 at Unity.Barracuda.Editor.NNModelEditor+<>c__DisplayClass33_0.<OnEnable>b__2 (System.String i) [0x00006] in C:\Users\alexi\Dev\MyProject\Library\PackageCache\com.unity.barracuda@1.4.0-preview\Barracuda\Editor\ONNXModelImporterEditor.cs:209 UnityEngine.Debug:LogError (object) Unity.Barracuda.D:LogError (object) (at Library/PackageCache/com.unity.barracuda@1.4.0-preview/Barracuda/Runtime/Core/Internals/Debug.cs:131) Unity.Barracuda.Editor.NNModelEditor/<>c__DisplayClass33_0:<OnEnable>b__2 (string) (at Library/PackageCache/com.unity.barracuda@1.4.0-preview/Barracuda/Editor/ONNXModelImporterEditor.cs:214) System.Linq.Enumerable:ToList<string> (System.Collections.Generic.IEnumerable`1<string>) Unity.Barracuda.Editor.NNModelEditor:OnEnable () (at Library/PackageCache/com.unity.barracuda@1.4.0-preview/Barracuda/Editor/ONNXModelImporterEditor.cs:204)
Is it related? or is it a separate issue?
This is a different issue, please create another issue for the above error.
~A fix for the original issue has been merged into main
from #5345. Could you please give it a try to see if it fixes your original problem? Thanks.~
My apologies, the issue wasn't fixed, but you will not receive a better error message about the dimensions of your grid.
@surfnerd So what's fixed now is the division/zero error handling right ?
However the cause of this error (the grid dimensions < 20) is still there, what should we do about it, start a new issue? Thanks
Yes, please create a new issue.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Describe the bug Grid sensor isn't working: Leads to division by zero somewhere
To Reproduce Use the default grid sensor component with basic parameters, nothing more, I was able to create a minimalist env with the same issue. If the gridsensor gameobject is disabled, the training start normaly, when I enable the gridsensor, it's crashing. One wierd thing is the the warning: "[WARNING] Trainer has no policies, not saving anything." when the gridsensor is enabled.
EDIT : I've been able to reproduce the bug in the ml-agent examples, and to make my minimalist env working, by tweaking the grid size parameters. Changing the foodCollector agent grid size to 8,0,8 or 16,0,16 will give differents error. Moving grid size from 16,0,16 to 20,0,20 in my minimalist env makes the training run fine.
Console logs / stack traces
Environment (please complete the following information):