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
Obsolete
have 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
IDiscreteActionMask
has 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. TheITypedSensor
andIDimensionPropertiesSensor
interfaces have been removed. (#5127)ISensor.GetCompressionType()
has been removed, andGetCompressionSpec()
has been added. TheISparseChannelSensor
interface 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
InferenceDevice
is nowInferenceDevice.Default
, which is equivalent toInferenceDevice.Burst
. If you depend on the previous behavior, you can explicitly set the Agent'sInferenceDevice
toInferenceDevice.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
.onnx
models 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
.onnx
models 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.extensions
tocom.unity.ml-agents
. (#5259) Match3Sensor
has been refactored to produce cell and special type observations separately, andMatch3SensorComponent
now produces twoMatch3Sensor
s (unless there are no special types). Previously trained models have different observation sizes and need to be retrained. (#5181)- The
AbstractBoard
class 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
GridSensor
has 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.unityanalytics
an optional dependency. (#5109) - Made
com.unity.modules.physics
andcom.unity.modules.physics2d
optional dependencies. (#5112) - Added support for
Goal Signal
as 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 Signal
feature. (#5193) DecisionRequester.ShouldRequestDecision()
andShouldRequestAction()
methods have been added. These are used to determine whetherAgent.RequestDecision()
andAgent.RequestAction()
are called (respectively). (#5223)RaycastPerceptionSensor
now caches its raycast results; they can be accessed viaRayPerceptionSensor.RayPerceptionOutput
. (#5222)ActionBuffers
are now reset to zero before being passed toAgent.Heuristic()
andIHeuristicProvider.Heuristic()
. (#5227)Agent
now callsIDisposable.Dispose()
on allISensor
s that implement theIDisposable
interface. (#5233)CameraSensor
,RenderTextureSensor
, andMatch3Sensor
now reuse theirTexture2D
s, reducing the amount of memory that needs to be allocated during runtime. (#5233)- Optimized
ObservationWriter.WriteTexture()
so that it doesn't callTexture2D.GetPixels32()
forRGB24
textures. This results in much less memory being allocated during inference withCameraSensor
andRenderTextureSensor
. (#5233)
ml-agents / ml-agents-envs / gym-unity (Python)
- Some console outputs have been moved from
info
todebug
and are no longer printed by default. If you want all messages to be printed, you can runmlagents-learn
with the--debug
option or add the linedebug: true
at 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 > 0
andRecord
was turned off. (#5274)