Team Ai
Modelpublic

AnnaMats/ppo-Pyramids-Training

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes110downloads
Unity-Inference-Engine.md48 linesDownload Raw Back to docs
1# Unity Inference Engine2 3The ML-Agents Toolkit allows you to use pre-trained neural network models inside4your Unity games. This support is possible thanks to the5[Unity Inference Engine](https://docs.unity3d.com/Packages/com.unity.barracuda@latest/index.html)6(codenamed Barracuda). The Unity Inference Engine uses7[compute shaders](https://docs.unity3d.com/Manual/class-ComputeShader.html) to8run the neural network within Unity.9 10## Supported devices11 12See the Unity Inference Engine documentation for a list of the13[supported platforms](https://docs.unity3d.com/Packages/com.unity.barracuda@latest/index.html#supported-platforms).14 15Scripting Backends : The Unity Inference Engine is generally faster with16**IL2CPP** than with **Mono** for Standalone builds. In the Editor, It is not17possible to use the Unity Inference Engine with GPU device selected when Editor18Graphics Emulation is set to **OpenGL(ES) 3.0 or 2.0 emulation**. Also there19might be non-fatal build time errors when target platform includes Graphics API20that does not support **Unity Compute Shaders**.21 22## Using the Unity Inference Engine23 24When using a model, drag the model file into the **Model** field in the25Inspector of the Agent. Select the **Inference Device** : CPU or GPU you want to26use for Inference.27 28**Note:** For most of the models generated with the ML-Agents Toolkit, CPU will29be faster than GPU. You should use the GPU only if you use the ResNet visual30encoder or have a large number of agents with visual observations.31 32# Unsupported use cases33## Externally trained models34The ML-Agents Toolkit only supports the models created with our trainers. Model35loading expects certain conventions for constants and tensor names. While it is36possible to construct a model that follows these conventions, we don't provide37any additional help for this. More details can be found in38[TensorNames.cs](https://github.com/Unity-Technologies/ml-agents/blob/release_20_docs/com.unity.ml-agents/Runtime/Inference/TensorNames.cs)39and40[BarracudaModelParamLoader.cs](https://github.com/Unity-Technologies/ml-agents/blob/release_20_docs/com.unity.ml-agents/Runtime/Inference/BarracudaModelParamLoader.cs).41 42If you wish to run inference on an externally trained model, you should use43Barracuda directly, instead of trying to run it through ML-Agents.44 45## Model inference outside of Unity46We do not provide support for inference anywhere outside of Unity. The `.onnx` files produced by training use the open format ONNX; if you wish to convert a `.onnx` file to another47format or run inference with them, refer to their documentation.48