-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Custom trainer editor analytics #5511
Merged
Merged
Changes from 7 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9c0fa10
Custom trainer editor analytics
vincentpierre 0a558c6
inherit the default_training_analytics_side_channel
maryamhonari 291b680
inherit the default_training_analytics_side_channel
maryamhonari d744766
fixing pytest
maryamhonari abad575
find channel with uuid, remove unused attr in proto
maryamhonari 1da6c43
formatting
maryamhonari 6baf3ad
formatting
maryamhonari b726104
Only update the native library and the c# calls that need to be made …
surfnerd ebb2697
Fix Mac backcompat test (#5519)
surfnerd f83612c
Update dotnet-format to address breaking changes introduced by upstre…
sini 676b3a6
Initialize-from custom checkpoints (#5525)
maryamhonari 0b460d9
Fix broken link in documentation (#5477)
a07f58f
Update gym version to 0.20.0 (#5540)
miguelalonsojr 8506022
Update README.md with new survey link(#5500)
jmercado1985 f9ba5c1
Fix test failures on trunk with input system 1.1.1 (#5542)
dongruoping 196c03e
Update Learning-Environment-Design-Agents.md (#5507)
metinc 65e7717
Fix VAIL (#5546)
andrewcoh 3f6504d
added change log
maryamhonari 9aa8dca
Merge branch 'main' into exp-custom-training-analytics
maryamhonari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
ml-agents-envs/mlagents_envs/side_channel/default_training_analytics_side_channel.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import sys | ||
import uuid | ||
import mlagents_envs | ||
|
||
from mlagents_envs.exception import UnityCommunicationException | ||
from mlagents_envs.side_channel import SideChannel, IncomingMessage, OutgoingMessage | ||
from mlagents_envs.communicator_objects.training_analytics_pb2 import ( | ||
TrainingEnvironmentInitialized, | ||
) | ||
from google.protobuf.any_pb2 import Any | ||
|
||
|
||
class DefaultTrainingAnalyticsSideChannel(SideChannel): | ||
""" | ||
Side channel that sends information about the training to the Unity environment so it can be logged. | ||
""" | ||
|
||
CHANNEL_ID = uuid.UUID("b664a4a9-d86f-5a5f-95cb-e8353a7e8356") | ||
|
||
def __init__(self) -> None: | ||
# >>> uuid.uuid5(uuid.NAMESPACE_URL, "com.unity.ml-agents/TrainingAnalyticsSideChannel") | ||
# UUID('b664a4a9-d86f-5a5f-95cb-e8353a7e8356') | ||
# We purposefully use the SAME side channel as the TrainingAnalyticsSideChannel | ||
|
||
super().__init__(DefaultTrainingAnalyticsSideChannel.CHANNEL_ID) | ||
|
||
def on_message_received(self, msg: IncomingMessage) -> None: | ||
raise UnityCommunicationException( | ||
"The DefaultTrainingAnalyticsSideChannel received a message from Unity, " | ||
+ "this should not have happened." | ||
) | ||
|
||
def environment_initialized(self) -> None: | ||
# Tuple of (major, minor, patch) | ||
vi = sys.version_info | ||
|
||
msg = TrainingEnvironmentInitialized( | ||
python_version=f"{vi[0]}.{vi[1]}.{vi[2]}", | ||
mlagents_version="Custom", | ||
mlagents_envs_version=mlagents_envs.__version__, | ||
torch_version="Unknown", | ||
torch_device_type="Unknown", | ||
) | ||
any_message = Any() | ||
any_message.Pack(msg) | ||
|
||
env_init_msg = OutgoingMessage() | ||
env_init_msg.set_raw_bytes(any_message.SerializeToString()) # type: ignore | ||
super().queue_message_to_send(env_init_msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is the main piece. "Custom" will be sent instead of the mlagents version.