Skip to content

Commit

Permalink
add selfplay test
Browse files Browse the repository at this point in the history
  • Loading branch information
huangshiyu13 committed Nov 24, 2023
1 parent 4344954 commit a702e8d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion openrl/selfplay/callbacks/selfplay_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _init_callback(self) -> None:
)

self.bind = SelfplayAPIServer.bind()
serve.run(self.bind)
serve.run(self.bind, route_prefix="/selfplay")
success = False
try_time = 10
while not success:
Expand Down
2 changes: 1 addition & 1 deletion openrl/selfplay/selfplay_api/selfplay_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from openrl.selfplay.selfplay_api.opponent_model import BattleResult


@serve.deployment(route_prefix="/selfplay")
@serve.deployment()
@serve.ingress(app)
class SelfplayAPIServer(BaseSelfplayAPIServer):
@app.post("/set_sample_strategy")
Expand Down
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,14 @@ def get_extra_requires() -> dict:
"datasets==2.13",
"evaluate",
],
"selfplay": ["ray[default]", "ray[serve]", "pettingzoo[classic]", "trueskill"],
"selfplay": [
"ray[default]>=2.7",
"ray[serve]",
"pettingzoo[classic]",
"trueskill",
],
"selfplay_test": [
"ray[default]",
"ray[default]>=2.7",
"ray[serve]",
"fastapi",
"pettingzoo[mpe]",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_selfplay/test_train_selfplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def config(request):
cfg_parser = create_config_parser()
cfg = cfg_parser.parse_args(["--config", "./examples/selfplay/selfplay.yaml"])
cfg.selfplay_api.port = request.param["port"]
print("port:",request.param["port"])
print("port:", request.param["port"])
for i, c in enumerate(cfg.callbacks):
if c["id"] == "SelfplayCallback":
c["args"][
Expand Down

0 comments on commit a702e8d

Please sign in to comment.