Giter VIP home page Giter VIP logo

muzero-http-service's Introduction

MuZero http service

Purpose

This program is created to use MuZero's game steps by another program. Mainly board games are supposed to be used.

Notices

  • 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.

Docker image

Built image is located in Docker Hub.

  1. docker run --rm -it -p 8000:8000 ssashir06/muzero-http-service
  2. Open http://localhost:8000/docs to see what apis are provided.

How to build and run

Requirements

  • Docker for Desktop

Run

Using Docker Compose

You can build it manually.

  1. git clone https://github.com/ssashir06/muzero-http-service.git
  2. cd muzero-http-service
  3. git submodule init
  4. git submodule update --remote
  5. docker-compose up --build

Play Tic-Tac-Toe to try

By using sample UI application

This is the easiest way to use it for test.

  1. Open http://localhost:8888 to open a sample UI application.
  2. Click the "Reset" button.
  3. Click the "self" button to see the MuZero's action.
  4. Click the "expert" or the "random" button to see another action.
  5. Click a number at the "Actions:" label or a cell in the board to select human action.

By using Swagger

This might be complicated a little.

  1. Open http://localhost:8000/docs to see a page of Swagger.
  2. Try to use /game/{game_name}
    • ๐Ÿ‘‰ This method shows basic info for the specified game. It includes action_space and players data.
    1. Fill game_name as tictactoe
  3. Try to use /game/{game_name}/{seed}
    • ๐Ÿ‘‰ This method shows the initial state of the game based on specified random seed.
    1. Fill game_name as tictactoe
    2. Fill seed as 1000
  4. 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.
    1. Fill game_name as tictactoe
    2. Fill seed as 1000
    3. Fill opponent as self
    4. Copy the steps in the Response body for the 2nd game step.
[
  {
    "action": 3,
    "root": null,
    "next": 1
  }
]
  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.
    1. Fill game_name as tictactoe
    2. Fill seed as 1000
    3. Fill opponent as self
    4. Paste steps of the 1st game step to the Request body
{
  "steps": [
    {
      "action": 3,
      "root": null,
      "next": 1
    }
  ]
}

Customize

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}.

Issues

  • 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.

References

muzero-http-service's People

Contributors

ssashir06 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.