Commit faec6370 authored by Yuxin Wu's avatar Yuxin Wu

readme for training atari models

parent 4587944d
...@@ -57,7 +57,7 @@ def eval_with_funcs(predict_funcs, nr_eval): ...@@ -57,7 +57,7 @@ def eval_with_funcs(predict_funcs, nr_eval):
return return
self.queue_put_stoppable(self.q, score) self.queue_put_stoppable(self.q, score)
q = queue.Queue(maxsize=2) q = queue.Queue()
threads = [Worker(f, q) for f in predict_funcs] threads = [Worker(f, q) for f in predict_funcs]
for k in threads: for k in threads:
...@@ -68,12 +68,15 @@ def eval_with_funcs(predict_funcs, nr_eval): ...@@ -68,12 +68,15 @@ def eval_with_funcs(predict_funcs, nr_eval):
for _ in tqdm(range(nr_eval), **get_tqdm_kwargs()): for _ in tqdm(range(nr_eval), **get_tqdm_kwargs()):
r = q.get() r = q.get()
stat.feed(r) stat.feed(r)
except:
logger.exception("Eval")
finally:
logger.info("Waiting for all the workers to finish the last run...") logger.info("Waiting for all the workers to finish the last run...")
for k in threads: k.stop() for k in threads: k.stop()
for k in threads: k.join() for k in threads: k.join()
while q.qsize():
r = q.get()
stat.feed(r)
except:
logger.exception("Eval")
finally:
if stat.count > 0: if stat.count > 0:
return (stat.average, stat.max) return (stat.average, stat.max)
return (0, 0) return (0, 0)
......
# To train an Atari game in gym:
# To run a pretrained Batch-A3C atari model for 100 episodes: `./train-atari.py --env Breakout-v0 --gpu 0`
1. install [tensorpack](https://github.com/ppwwyyxx/tensorpack) # To run a pretrained Atari model for 100 episodes:
2. Download models from [model zoo](https://drive.google.com/open?id=0B9IPQTvr2BBkS0VhX0xmS1c5aFk)
3. `ENV=NAME_OF_ENV ./run-atari.py --load "$ENV".tfmodel --env "$ENV"` 1. Download models from [model zoo](https://drive.google.com/open?id=0B9IPQTvr2BBkS0VhX0xmS1c5aFk)
2. `ENV=NAME_OF_ENV ./run-atari.py --load "$ENV".tfmodel --env "$ENV"`
Models are available for the following gym atari environments (click links for videos): Models are available for the following gym atari environments (click links for videos):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment