2021-12-08 17:16:27 +08:00
|
|
|
import os
|
2021-09-07 16:38:34 +08:00
|
|
|
import argparse
|
|
|
|
|
|
|
|
from douzero.evaluation.simulation import evaluate
|
|
|
|
|
2021-12-08 17:16:27 +08:00
|
|
|
|
|
|
|
def make_evaluate(args, t, frame, adp_frame, folder_a = 'baselines', folder_b = 'baselines'):
|
|
|
|
if t == 1:
|
|
|
|
args.landlord = '%s/resnet_landlord_%i.ckpt' % (folder_a, frame)
|
|
|
|
args.landlord_up = 'random'
|
|
|
|
args.landlord_front = 'random'
|
|
|
|
args.landlord_down = 'random'
|
|
|
|
print('%i vs random' % frame)
|
|
|
|
elif t == 2:
|
|
|
|
args.landlord = 'random'
|
|
|
|
args.landlord_up = '%s/resnet_landlord_up_%i.ckpt' % (folder_a, frame)
|
|
|
|
args.landlord_front = '%s/resnet_landlord_front_%i.ckpt' % (folder_a, frame)
|
|
|
|
args.landlord_down = '%s/resnet_landlord_down_%i.ckpt' % (folder_a, frame)
|
|
|
|
print('random vs %i' % frame)
|
|
|
|
elif t == 3:
|
|
|
|
args.landlord = '%s/resnet_landlord_%i.ckpt' % (folder_a, frame)
|
|
|
|
args.landlord_up = '%s/resnet_landlord_up_%i.ckpt' % (folder_b, adp_frame)
|
|
|
|
args.landlord_front = '%s/resnet_landlord_front_%i.ckpt' % (folder_b, adp_frame)
|
|
|
|
args.landlord_down = '%s/resnet_landlord_down_%i.ckpt' % (folder_b, adp_frame)
|
|
|
|
print('%i vs %i' % (frame, adp_frame))
|
|
|
|
elif t == 4:
|
|
|
|
args.landlord = '%s/resnet_landlord_%i.ckpt' % (folder_b, adp_frame)
|
|
|
|
args.landlord_up = '%s/resnet_landlord_up_%i.ckpt' % (folder_a, frame)
|
|
|
|
args.landlord_front = '%s/resnet_landlord_front_%i.ckpt' % (folder_a, frame)
|
|
|
|
args.landlord_down = '%s/resnet_landlord_down_%i.ckpt' % (folder_a, frame)
|
|
|
|
print('%i vs %i' % (adp_frame, frame))
|
|
|
|
|
|
|
|
evaluate(args.landlord,
|
|
|
|
args.landlord_up,
|
|
|
|
args.landlord_down,
|
|
|
|
args.eval_data,
|
|
|
|
args.num_workers,
|
|
|
|
args.output,
|
|
|
|
args.bid,
|
|
|
|
args.title)
|
|
|
|
|
|
|
|
|
2021-09-07 16:38:34 +08:00
|
|
|
if __name__ == '__main__':
|
|
|
|
parser = argparse.ArgumentParser(
|
2021-12-08 17:16:27 +08:00
|
|
|
'Dou Dizhu Evaluation')
|
2021-09-07 16:38:34 +08:00
|
|
|
parser.add_argument('--landlord', type=str,
|
2021-12-08 17:16:27 +08:00
|
|
|
default='baselines/douzero_12/landlord_weights_39762328900.ckpt')
|
2021-09-07 16:38:34 +08:00
|
|
|
parser.add_argument('--landlord_up', type=str,
|
2021-12-08 17:16:27 +08:00
|
|
|
default='baselines/douzero_12/landlord_up_weights_39762328900.ckpt')
|
2021-12-05 12:03:30 +08:00
|
|
|
parser.add_argument('--landlord_front', type=str,
|
2021-12-08 17:16:27 +08:00
|
|
|
default='baselines/douzero_12/landlord_front_weights_39762328900.ckpt')
|
2021-09-07 16:38:34 +08:00
|
|
|
parser.add_argument('--landlord_down', type=str,
|
2021-12-08 17:16:27 +08:00
|
|
|
default='baselines/douzero_12/landlord_down_weights_39762328900.ckpt')
|
2021-09-07 16:38:34 +08:00
|
|
|
parser.add_argument('--eval_data', type=str,
|
2021-12-08 17:16:27 +08:00
|
|
|
default='eval_data_200.pkl')
|
2021-09-07 16:38:34 +08:00
|
|
|
parser.add_argument('--num_workers', type=int, default=5)
|
|
|
|
parser.add_argument('--gpu_device', type=str, default='0')
|
|
|
|
parser.add_argument('--output', type=bool, default=True)
|
|
|
|
parser.add_argument('--bid', type=bool, default=True)
|
|
|
|
parser.add_argument('--title', type=str, default='New')
|
|
|
|
args = parser.parse_args()
|
2021-12-08 17:16:27 +08:00
|
|
|
# args.output = True
|
|
|
|
args.output = False
|
2021-09-07 16:38:34 +08:00
|
|
|
args.bid = False
|
|
|
|
if args.output or args.bid:
|
|
|
|
args.num_workers = 1
|
2021-12-08 17:16:27 +08:00
|
|
|
|
2021-09-07 16:38:34 +08:00
|
|
|
t = 3
|
2021-12-08 17:16:27 +08:00
|
|
|
frame = 13252000
|
|
|
|
adp_frame = 8697600
|
|
|
|
|
2021-09-07 16:38:34 +08:00
|
|
|
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
|
|
|
|
os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu_device
|
|
|
|
|
2021-12-08 17:16:27 +08:00
|
|
|
# eval_list = [
|
|
|
|
# [8697600, None],
|
|
|
|
# [8697600, 8697600],
|
|
|
|
# [11402400, None],
|
|
|
|
# [11402400, 8697600],
|
|
|
|
# [11402400, 11402400],
|
|
|
|
# [13252000, None],
|
|
|
|
# [13252000, 8697600],
|
|
|
|
# [13252000, 11402400],
|
|
|
|
# [13252000, 13252000],
|
|
|
|
# [15096800, None],
|
|
|
|
# [15096800, 8697600],
|
|
|
|
# [15096800, 11402400],
|
|
|
|
# [15096800, 13252000],
|
|
|
|
# [15096800, 15096800],
|
|
|
|
# [25397600, None],
|
|
|
|
# [25397600, 8697600],
|
|
|
|
# [25397600, 11402400],
|
|
|
|
# [25397600, 13252000],
|
|
|
|
# [25397600, 15096800],
|
|
|
|
# [25397600, 25397600],
|
|
|
|
# ]
|
|
|
|
|
|
|
|
eval_list = [
|
|
|
|
[4968800, 8697600, 'baselines', 'baselines2'],
|
|
|
|
[4968800, 4968800, 'baselines', 'baselines'],
|
|
|
|
]
|
|
|
|
|
|
|
|
for vs in reversed(eval_list):
|
|
|
|
frame = vs[0]
|
|
|
|
adp_frame = vs[1]
|
|
|
|
folder_a = vs[2]
|
|
|
|
folder_b = vs[3]
|
|
|
|
if adp_frame is None:
|
|
|
|
make_evaluate(args, 1, frame, None)
|
|
|
|
make_evaluate(args, 2, frame, None)
|
|
|
|
else:
|
|
|
|
make_evaluate(args, 3, frame, adp_frame, folder_a , folder_b)
|
|
|
|
if frame != adp_frame:
|
|
|
|
make_evaluate(args, 4, frame, adp_frame, folder_a, folder_b)
|