Skip to content

Commit

Permalink
Clean up example.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gamenot committed Jul 21, 2023
1 parent ca17d71 commit f7f4b8d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/5_agent_zoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,31 @@ def main():
agent_interface = agent_spec.interface
agent = agent_spec.build_agent()
# alternatively this will build the agent
agent, agent_interface = registry.make_agent(
agent, _ = registry.make_agent(
locator=f"__main__:{name}"
)
# just "random_lane_control-v0" also works because the agent has already been registered in this file.
agent, agent_interface = registry.make_agent(
agent, _ = registry.make_agent(
locator=name
)

locator = "zoo.policies:chase-via-points-agent-v0"
# Here is an example of using the module component of the locator to dynamically load agents:
agent, agent_interface = registry.make_agent(
agent, _ = registry.make_agent(
locator=locator
)
print(f"=== After loading `{locator}` ===")
print(registry.agent_registry)


## This agent requires installation
# agent, agent_interface = registry.make_agent(
# agent, _ = registry.make_agent(
# locator="zoo.policies:discrete-soft-actor-critic-agent-v0"
# )

locator = "non_existing.module:md-v44"
try:
agent, agent_interface = registry.make_agent(
agent, _ = registry.make_agent(
locator="non_existing.module:md-v44"
)
except (ModuleNotFoundError, ImportError):
Expand Down

0 comments on commit f7f4b8d

Please sign in to comment.