-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtrain.py
More file actions
57 lines (49 loc) · 1.53 KB
/
Copy pathtrain.py
File metadata and controls
57 lines (49 loc) · 1.53 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""
Authors:
Egehan Orta 150160124
Yiğitcan Çoban 150160039
İlgin Balkan 150170901
Rumeysa Nur Arslan 150160804
"""
import sys
from absl import flags
import ray
from ray.tune import run_experiments, register_env, Experiment
import tensorflow as tf
import os
from collect_mineral_shards import CollectMineralShards
from defeat_roaches import DefeatRoaches
from build_marines import BuildMarines
from collect_minerals_and_gas import CollectMineralsAndGas
FLAGS = flags.FLAGS
FLAGS(sys.argv)
env_name = 'my_env'
experiment_name = 'my_experiment'
ray.init()
register_env(env_name, lambda config: CollectMineralsAndGas())
experiment_spec = Experiment(
experiment_name, #experiment name to log
"DQN", #model to be used
checkpoint_freq=100, #save model each 100th iteration
stop={
"training_iteration": 300, #stop model training after 300 iteration
},
config={
"env": env_name,
"framework": "tensorflow", # used framework
"buffer_size": 50000,
"timesteps_per_iteration": 1000,
"n_step": 3,
"prioritized_replay": True,
"grad_clip": None,
"num_workers": 1,
"num_gpus":1, # use gpu
"exploration_config": {
"type": "EpsilonGreedy", # use EpsilonGreedy for exploration
"initial_epsilon": 1.0,
"final_epsilon": 0.02,
"epsilon_timesteps": 1000
}
},
)
run_experiments(experiment_spec)