-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
36 lines (29 loc) · 845 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from a3c import *
'''
@authors:
Nicklas Hansen
Run a test with:
python test.py FOLDER
where FOLDER is the name of an auto-generated folder in /results.
'''
if __name__ == '__main__':
# Parse arguments
parser = argparse.ArgumentParser()
parser.add_argument('data', type=str)
parser.add_argument('--print_args', type=bool, default=False)
args = parser.parse_args()
# Load args
args2 = load_args(args.data)
if args.print_args is True:
print(args2)
# Initialize environment
gym.logger.set_level(40)
_env = gym.make(args2.env)
args2.conv = len(_env.observation_space.shape) == 3
model = ConvAC(args2) if args2.conv == True else AC(args2)
# Load model
model = load_model(model, args.data)
model.eval()
print('Initializing testing...')
# Run
test(model, args2)