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 thatstep
,eval_step
anduse_raw
can work correctly. - Wrap models. You need to inherit the
Model
class inrlcard/models/model.py
. Then put all the agents into a list. Rewriteagent
property to return this list. - 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.