-
Notifications
You must be signed in to change notification settings - Fork 4.3k
[MLA-1540] Training Analytics #4780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
var eventName = msg.ReadString(); | ||
if (!string.IsNullOrEmpty(eventName)) | ||
{ | ||
Debug.Log(eventName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed that this gets
environment_initialized!
and
training_started for 3DBall with config TrainerSettings(trainer_type=<TrainerType.PPO: 'ppo'>, ...)!
when using 3DBall. This is obviously placeholder; the plan is to add a protobuf message and send that over the SideChannel instead.
var unityCommunicationVersion = initParameters.unityCommunicationVersion; | ||
|
||
TrainingAnalytics.SetTrainerInformation(pythonPackageVersion, pythonCommunicationVersion); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love this, but it seems liked the best way to push this info to the analytics code for later use. We could potentially "pull" it from here in analytics, but that seems more brittle.
/// Hash a string to remove PII or secret info before sending to analytics | ||
/// </summary> | ||
/// <param name="s"></param> | ||
/// <returns></returns> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this cause a warning during validation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add some actual content there. It's internal, though, so probably not.
com.unity.ml-agents/Runtime/SideChannels/TrainingAnalyticsSideChannel.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I think someone more familiar with the python end should also approve.
For the C# Trainging analytics side-channel tests: are they there just to show that they don't throw an exception?
worker_id, [env_parameters, engine_configuration_channel, stats_channel] | ||
) | ||
side_channels = [env_parameters, engine_configuration_channel, stats_channel] | ||
if training_analytics_channel is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put this line after line 161 (after we check if the environment can support training_analytics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed it's a bit convoluted. But we don't currently have a way to add a SideChannel after the BaseEnv has been created, and we can't get the capabilities until after we've created the environment. So this always adds the sidechannel (for worker==0) but then doesn't use it if the capabilities don't support it.
Do you think it's worth adding an interface to BaseEnv to add SideChannels after creation? Note that modifying the side_channels
list after creation won't have any effect, because the list is turned into an ID->SideChannel mapping in
def _get_side_channels_dict( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the OS information already somewhere in the analytics?
@dongruoping good call, we can add |
Actually, looks like we already have that in the "base" event. |
Proposed change(s)
Adds analytics events for training. We will send 3 events:
The reason for splitting the two per-behavior events is so that we can backport the first to the verified branch and get some data from there too (without needing to rely on trainer upgrades).
Data is sent from python to the Unity executable, from there we'll send it through EditorAnalytics so the Unity Privacy Policy will apply.
Example events
These are from one of the behaviors from the WallJump scene with curriculum.
ml_agents_training_environment_initialized
ml_agents_remote_policy_initialized
ml_agents_training_behavior_initialized
Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)
Types of change(s)
Checklist
Other comments