datamllab / rlcard

Reinforcement Learning / AI Bots in Card (Poker) Games - Blackjack, Leduc, Texas, DouDizhu, Mahjong, UNO.
http://www.rlcard.org
MIT License
2.91k stars 630 forks source link

how to use the pretrained model #29

Closed AIMan-Zzx closed 5 years ago

AIMan-Zzx commented 5 years ago

how to use the pretrained model, such as nfsp agents. i want to play doudizhu with 3 players, all of them load the pretrained model

daochenzha commented 5 years ago

@sunnyForIOS I suggest following the example of loading NFSP for Leduc:

https://github.com/datamllab/rlcard/blob/master/rlcard/models/pretrained_models.py

AIMan-Zzx commented 5 years ago

a nfsp model is trained for 3 players together,or each player train a separate model

daochenzha commented 5 years ago

Each player has a separate model. Thus, actually, 3 models are saved, and should be loaded accordingly.

AIMan-Zzx commented 5 years ago

for i in range(env.player_num): agent = NFSPAgent(sess,

saver.save(sess, 'models/doudizhu_nfsp/model')

each player use the same sess, and how to save 3 models, if i use saver.save ,only one model will be save

daochenzha commented 5 years ago

The models have different name scopes. Check the scope argument of NFSP.

AIMan-Zzx commented 5 years ago

you are right ,scope is different . in save stage,use saver.save, one model saved, right? in reload stage, saver restore ,agent will load params by their own name scope, right?

daochenzha commented 5 years ago

Yes. saver.restore will restore the parameters of all the scopes in the entire graph.

AIMan-Zzx commented 5 years ago

thanks very much