ML-Agents Release 17
Package Versions
NOTE: It is strongly recommended that you use packages from the same release together for the best experience.
| Package | Version |
|---|---|
| com.unity.ml-agents (C#) | v2.0.0 |
| com.unity.ml-agents.extensions (C#) | v0.4.0-preview |
| ml-agents (Python) | v0.26.0 |
| ml-agents-envs (Python) | v0.26.0 |
| gym-unity (Python) | v0.26.0 |
| Communicator (C#/Python) | v1.5.0 |
Breaking Changes
Minimum Version Support
- The minimum supported Unity version was updated to 2019.4. (#5166)
C# API Changes
- Several breaking interface changes were made. See the Migration Guide for more details.
- Some methods previously marked as
Obsoletehave been removed. If you were using these methods, you need to replace them with their supported counterpart. (#5024) - The interface for disabling discrete actions in
IDiscreteActionMaskhas changed.WriteMask(int branch, IEnumerable<int> actionIndices)was replaced withSetActionEnabled(int branch, int actionIndex, bool isEnabled). (#5060) - IActuator now implements IHeuristicProvider. (#5110)
ISensor.GetObservationShape()has been removed, andGetObservationSpec()has been added. TheITypedSensorandIDimensionPropertiesSensorinterfaces have been removed. (#5127)ISensor.GetCompressionType()has been removed, andGetCompressionSpec()has been added. TheISparseChannelSensorinterface has been removed. (#5164)- The abstract method
SensorComponent.GetObservationShape()was no longer being called, so it has been removed. (#5172) SensorComponent.CreateSensor()has been replaced withSensorComponent.CreateSensors(), which returns anISensor[]. (#5181)- The default
InferenceDeviceis nowInferenceDevice.Default, which is equivalent toInferenceDevice.Burst. If you depend on the previous behavior, you can explicitly set the Agent'sInferenceDevicetoInferenceDevice.CPU. (#5175)
Model Format Changes
- Models trained with 1.x versions of ML-Agents no longer work at inference if they were trained using recurrent neural networks (#5254)
- The
.onnxmodels input names have changed. All input placeholders now use the prefixobs_removing the distinction between visual and vector observations. In addition, the inputs and outputs of LSTM have changed. Models created with this version are not usable with previous versions of the package (#5080, #5236) - The
.onnxmodels discrete action output now contains the discrete actions values and not the logits. Models created with this version are not usable with previous versions of the package (#5080)
Features Moved from com.unity.ml-agents.extensions to com.unity.ml-agents
Match3
- The Match-3 integration utilities have been moved from
com.unity.ml-agents.extensionstocom.unity.ml-agents. (#5259) Match3Sensorhas been refactored to produce cell and special type observations separately, andMatch3SensorComponentnow produces twoMatch3Sensors (unless there are no special types). Previously trained models have different observation sizes and need to be retrained. (#5181)- The
AbstractBoardclass for integration with Match-3 games has been changed to make it easier to support boards with different sizes using the same model. For a summary of the interface changes, please see the Migration Guide. (##5189)
Grid Sensor
GridSensorhas been refactored and moved to the main package, with changes to both sensor interfaces and behaviors. Existing GridSensor created by the extension package do not work in newer versions. Previously trained models need to be retrained. Please see the Migration Guide for more details. (#5256)
Minor Changes
com.unity.ml-agents / com.unity.ml-agents.extensions (C#)
- Updated the Barracuda package to version
1.4.0-preview(#5236) - Added ML-Agents package settings. Now you can configure project-level ML-Agents settings in Editor > Project Settings > ML-Agents. (#5027)
- Made
com.unity.modules.unityanalyticsan optional dependency. (#5109) - Made
com.unity.modules.physicsandcom.unity.modules.physics2doptional dependencies. (#5112) - Added support for
Goal Signalas a type of observation. Trainers can now use HyperNetworks to processGoal Signal. Trainers with HyperNetworks are more effective at solving multiple tasks. (#5142, #5159, #5149) - Modified the GridWorld environment to use the new
Goal Signalfeature. (#5193) DecisionRequester.ShouldRequestDecision()andShouldRequestAction()methods have been added. These are used to determine whetherAgent.RequestDecision()andAgent.RequestAction()are called (respectively). (#5223)RaycastPerceptionSensornow caches its raycast results; they can be accessed viaRayPerceptionSensor.RayPerceptionOutput. (#5222)ActionBuffersare now reset to zero before being passed toAgent.Heuristic()andIHeuristicProvider.Heuristic(). (#5227)Agentnow callsIDisposable.Dispose()on allISensors that implement theIDisposableinterface. (#5233)CameraSensor,RenderTextureSensor, andMatch3Sensornow reuse theirTexture2Ds, reducing the amount of memory that needs to be allocated during runtime. (#5233)- Optimized
ObservationWriter.WriteTexture()so that it doesn't callTexture2D.GetPixels32()forRGB24textures. This results in much less memory being allocated during inference withCameraSensorandRenderTextureSensor. (#5233)
ml-agents / ml-agents-envs / gym-unity (Python)
- Some console outputs have been moved from
infotodebugand are no longer printed by default. If you want all messages to be printed, you can runmlagents-learnwith the--debugoption or add the linedebug: trueat the top of the yaml config file. (#5211) - The embedding size of attention layers used when a BufferSensor is in the scene has been changed. It is now fixed to 128 units. It might be impossible to resume training from a checkpoint of a previous version. (#5272)
Bug Fixes
com.unity.ml-agents / com.unity.ml-agents.extensions (C#)
- Fixed a potential bug where sensors and actuators could get sorted inconsistently on different systems to different Culture settings. Unfortunately, this may require retraining models if it changes the resulting order of the sensors or actuators on your system. (#5194)
- Removed additional memory allocations that were occurring due to assert messages and iterating of DemonstrationRecorders. (#5246)
- Fixed a bug where agents were trying to access uninitialized fields when creating a new RayPerceptionSensorComponent on an agent. (#5261)
- Fixed a bug where the DemonstrationRecorder would throw a null reference exception if
Num Steps To Record > 0andRecordwas turned off. (#5274)