This program is created to use MuZero's game steps by another program. Mainly board games are supposed to be used.
- This program provides http service to see MuZero's action.
- This program uses MuZero General's code in a submodule's directory.
- This program uses a code based on MuZero's one.
- self_play_replicate.py is like self_play.py
Built image is located in Docker Hub.
docker run --rm -it -p 8000:8000 ssashir06/muzero-http-service
- Open http://localhost:8000/docs to see what apis are provided.
- Docker for Desktop
You can build it manually.
git clone https://github.com/ssashir06/muzero-http-service.git
cd muzero-http-service
git submodule init
git submodule update --remote
docker-compose up --build
This is the easiest way to use it for test.
- Open http://localhost:8888 to open a sample UI application.
- Click the "Reset" button.
- Click the "self" button to see the MuZero's action.
- Click the "expert" or the "random" button to see another action.
- Click a number at the "Actions:" label or a cell in the board to select human action.
This might be complicated a little.
- Open http://localhost:8000/docs to see a page of Swagger.
- Try to use
/game/{game_name}
- ๐ This method shows basic info for the specified game. It includes action_space and players data.
- Fill
game_name
astictactoe
- Try to use
/game/{game_name}/{seed}
- ๐ This method shows the initial state of the game based on specified random seed.
- Fill
game_name
astictactoe
- Fill
seed
as1000
- Try to use
/game/{game_name}/{seed}/action
for the 1st game step- ๐ This method creates a step for the game, and shows the step's result.
- Fill
game_name
astictactoe
- Fill
seed
as1000
- Fill
opponent
asself
- Copy the
steps
in theResponse body
for the 2nd game step.
[
{
"action": 3,
"root": null,
"next": 1
}
]
- Try to use
/game/{game_name}/{seed}/action
for the 2nd game step- ๐ This method creates a step for the game, and shows the step's result.
- Fill
game_name
astictactoe
- Fill
seed
as1000
- Fill
opponent
asself
- Paste
steps
of the 1st game step to theRequest body
{
"steps": [
{
"action": 3,
"root": null,
"next": 1
}
]
}
This program uses tic-tac-toe's module in the models directory. Another game's model can be used by adding or changing these things by editing docker-compose.yml file.
- Environment variable
- ๐
MODEL_PATH_tictactoe=./models/_for_test/tictactoe/model.checkpoint
in docker-compose.yml - The checkpoint model file can be referenced by the program by this environment variable.
- A new environment variable having the format of
MODEL_PATH_{game_name}
.
- ๐
- The attached model file in this git repository for the Tic-Tac-Toe is not trained at all. This is just only for testing.
- If the "random" is selected as the opponent, it selects a similar action each time because it is using same random seed.