Skip to content
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

Modify mlagents for removing server build #58

Merged
merged 6 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 7 additions & 5 deletions jorldy/core/env/ml_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

def match_build():
os = platform.system()
if os == "Linux":
return "Server" if subprocess.getoutput("which Xorg") == "" else "Linux"
else:
return {"Windows": "Windows", "Darwin": "Mac"}[os]
return {"Windows": "Windows", "Darwin": "Mac", "Linux": "Linux"}[os]


class _MLAgent(BaseEnv):
Expand All @@ -22,21 +19,26 @@ class _MLAgent(BaseEnv):
Args:
env_name (str): name of environment in ML-Agents.
train_mode (bool): parameter that determine whether to use low-resource training rendering mode.
render (bool): parameter that determine whether to render.
"""

def __init__(self, env_name, train_mode=True, id=None, **kwargs):
def __init__(self, env_name, train_mode=True, render=False, id=None, **kwargs):
env_path = f"./core/env/mlagents/{env_name}/{match_build()}/{env_name}"
id = (
np.random.randint(65534 - UnityEnvironment.BASE_ENVIRONMENT_PORT)
if id is None
else id
)

graphic_available = False if subprocess.getoutput("which Xorg") == "" else True
no_graphics = not (render and graphic_available)

engine_configuration_channel = EngineConfigurationChannel()
self.env = UnityEnvironment(
file_name=env_path,
side_channels=[engine_configuration_channel],
worker_id=id,
no_graphics=no_graphics,
)

self.env.reset()
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"count":1,"self":26.936591999999997,"total":118.449636,"children":{"InitializeActuators":{"count":2,"self":0.001787,"total":0.001787,"children":null},"InitializeSensors":{"count":2,"self":0.008045,"total":0.008045,"children":null},"AgentSendState":{"count":64469,"self":0.078348,"total":7.660735,"children":{"CollectObservations":{"count":12960,"self":0.982823,"total":0.982823,"children":null},"WriteActionMask":{"count":12960,"self":0.006781,"total":0.006781,"children":null},"RequestDecision":{"count":12960,"self":0.021561,"total":6.592783,"children":{"AgentInfo.ToProto":{"count":12960,"self":0.03957,"total":6.571222,"children":{"GenerateSensorData":{"count":12960,"self":0.882423,"total":6.5316519999999993,"children":{"RenderTextureSensor.GetCompressedObservation":{"count":64800,"self":5.6492287999999995,"total":5.649229,"children":null}}}}}}}}},"DecideAction":{"count":64469,"self":83.570432,"total":83.57042899999999,"children":null},"AgentAct":{"count":64469,"self":0.19736199999999998,"total":0.218889,"children":{"AgentInfo.ToProto":{"count":40,"self":0.00010899999999999999,"total":0.021526999999999998,"children":{"GenerateSensorData":{"count":40,"self":0.004854,"total":0.021418,"children":{"RenderTextureSensor.GetCompressedObservation":{"count":200,"self":0.016564,"total":0.016564,"children":null}}}}}}},"AgentInfo.ToProto":{"count":104,"self":0.000329,"total":0.051813,"children":{"GenerateSensorData":{"count":104,"self":0.008588,"total":0.051483999999999995,"children":{"RenderTextureSensor.GetCompressedObservation":{"count":520,"self":0.042896,"total":0.042896,"children":null}}}}}},"gauges":{"My Behavior.CumulativeReward":{"count":144,"max":8.68783951,"min":-2.13500714,"runningAverage":-0.7490371,"value":-0.8841691,"weightedAverage":-0.534805238}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1637553147","unity_version":"2021.1.6f1","command_line_arguments":"\/data\/private\/JORLDY\/jorldy\/.\/core\/env\/mlagents\/DroneDelivery\/Linux\/DroneDelivery.x86_64 -nographics -batchmode --mlagents-port 5009","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.1.0-exp.1","scene_name":"TrainScene","end_time_seconds":"1637553266"}}.1.0-exp.1","scene_name":"TrainScene","end_time_seconds":"1637553266"}}
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Loading