Skip to content

Latest commit

 

History

History
12 lines (11 loc) · 1.1 KB

adding-models.md

File metadata and controls

12 lines (11 loc) · 1.1 KB

Adding Pre-trained/Rule-based models

You can add your own pre-trained/rule-based models to the toolkit by following several steps:

  • Develop models. You can either design a rule-based model or save a neural network model. For each game, you need to develop agents for all the players at the same time. You need to wrap each agent as a Agent class and make sure that step and eval_step can work correctly.
  • Wrap models. You need to inherit the Model class in rlcard/models/model.py. Then put all the agents into a list. Rewrite agent property to return this list. Also, rewrite use_raw property. Return True if the input of the model is raw observation. For pre-trained model, we usually return False since the model operates on encoded features.
  • Register the model. Register the model in rlcard/models/__init__.py.
  • Load the model in environment. An example of loading leduc-holdem-nfsp model is as follows:
from rlcard import models
leduc_nfsp_model = models.load('leduc-holdem-nfsp')

Then use leduc_nfsp_model.agents to obtain all the agents for the game.