Skip to content
This repository was archived by the owner on Mar 11, 2021. It is now read-only.

Commit 00e5a8f

Browse files
authored
update readme (#100)
1 parent 11db8b3 commit 00e5a8f

File tree

1 file changed

+40
-36
lines changed

1 file changed

+40
-36
lines changed

README.md

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ Minigo: A minimalist Go engine modeled after AlphaGo Zero, built on MuGo
33

44
This is a pure Python implementation of a neural-network based Go AI, using
55
TensorFlow. While inspired by Deepmind's AlphaGo algorithm, this project is not
6-
a Deepmind project.
6+
a Deepmind project nor is it affiliated with the official AlphaGo project.
77

88
### This is NOT an official version of AlphaGo ###
99

1010
Repeat, *this is not the official AlphaGo program by DeepMind*. This is an
1111
independent effort by Go enthusiasts to replicate the results of the AlphaGo
12-
Zero paper ("Mastering the Game of Go without Human Knowledge" *Nature*), with
12+
Zero paper ("Mastering the Game of Go without Human Knowledge," *Nature*), with
1313
some resources generously made available by Google.
1414

1515
Minigo is based off of Brian Lee's "MuGo" -- a pure Python implementation of the
@@ -44,10 +44,17 @@ establishes itself as the top Go AI. Instead, we strive for a readable,
4444
understandable implementation that can benefit the community, even if that
4545
means our implementation is not as fast or efficient as possible.
4646

47+
While this product might produce such a strong model, we hope to focus on the
48+
process. Remember, getting there is half the fun :)
49+
4750
We hope this project is an accessible way for interested developers to have
4851
access to a strong Go model with an easy-to-understand platform of python code
4952
available for extension, adaptation, etc.
5053

54+
If you'd like to read about our experiences training models, see RESULTS.md
55+
56+
To see our guidelines for contributing, see CONTRIBUTING.md
57+
5158
Getting Started
5259
===============
5360

@@ -76,8 +83,8 @@ the dependencies:
7683
pip3 install -r requirements.txt
7784
```
7885

79-
If you wish to run on GPU you must install CUDA 8.0 or later (see TensorFlow
80-
documentation).
86+
The `requirements.txt` file assumes you'll use a GPU; if you wish to run on GPU
87+
you must install CUDA 8.0 or later (see TensorFlow documentation).
8188

8289
If you don't want to run on GPU or don't have one, you can downgrade:
8390

@@ -124,23 +131,29 @@ All commands are compatible with either Google Cloud Storage as a remote file
124131
system, or your local file system. The examples here use GCS, but local file
125132
paths will work just as well.
126133

127-
To use GCS, set the `BUCKET_NAME` variable and authenticate. Otherwise, all
128-
commands fetching files from GCS will hang.
134+
To use GCS, set the `BUCKET_NAME` variable and authenticate via `gcloud login`.
135+
Otherwise, all commands fetching files from GCS will hang.
129136

137+
For instance, this would set a bucket, authenticate, and then look for the most
138+
recent model.
130139
```bash
131140
export BUCKET_NAME=your_bucket;
132141
gcloud auth application-default login
133142
gsutil ls gs://minigo/models | tail -3
134143
```
135144

136-
Which might look like
145+
Which might look like:
137146

138147
```
139148
gs://$BUCKET_NAME/models/000193-trusty.data-00000-of-00001
140149
gs://$BUCKET_NAME/models/000193-trusty.index
141150
gs://$BUCKET_NAME/models/000193-trusty.meta
142151
```
143152

153+
These three files comprise the model, and commands that take a model as an
154+
argument usually need the path to the model basename, e.g.
155+
`gs://$BUCKET_NAME/models/000193-trusty`
156+
144157
You'll need to copy them to your local disk. This fragment copies the latest
145158
model to the directory specified by `MINIGO_MODELS`
146159

@@ -212,8 +225,8 @@ Overview
212225
--------
213226

214227
The following sequence of commands will allow you to do one iteration of
215-
reinforcement learning on 9x9. These are the basic commands used in the
216-
kubernetified version used to produce the models and games referenced above.
228+
reinforcement learning on 9x9. These are the basic commands used to produce the
229+
models and games referenced above.
217230

218231
The commands are
219232
- bootstrap: initializes a random model
@@ -231,7 +244,7 @@ This command creates a random model, which appears at .
231244

232245
```bash
233246
export MODEL_NAME=000000-bootstrap
234-
python3 main.py bootstrap gs://$BUCKET_NAME/models/$MODEL_NAME -n $BOARD_SIZE
247+
python3 main.py bootstrap gs://$BUCKET_NAME/models/$MODEL_NAME
235248
```
236249

237250
Self-play
@@ -245,29 +258,28 @@ gs://$BUCKET_NAME/data/selfplay/$MODEL_NAME/local_worker/*.tfrecord.zz
245258
gs://$BUCKET_NAME/sgf/$MODEL_NAME/local_worker/*.sgf
246259
```
247260

248-
(-n 9 makes 9x9 games)
249261
```bash
250262
python3 main.py selfplay gs://$BUCKET_NAME/models/$MODEL_NAME \
251263
--readouts 10 \
252-
--games 8 \
253-
-v 3 -n 9 \
264+
-v 3 \
254265
--output-dir=gs://$BUCKET_NAME/data/selfplay/$MODEL_NAME/local_worker \
255266
--output-sgf=gs://$BUCKET_NAME/sgf/$MODEL_NAME/local_worker
256267
```
257-
(-n 9 makes it play 9x9 games)
258268

259269
Gather
260270
------
261271

262-
This command takes multiple tfrecord.zz files (which will probably be KBs in size)
263-
and shuffles them into tfrecord.zz files that are ~100 MB in size.
264-
265272
```
266273
python3 main.py gather
267274
```
268275

276+
This command takes multiple tfrecord.zz files (which will probably be KBs in size)
277+
and shuffles them into tfrecord.zz files that are ~100 MB in size.
278+
269279
Gathering is done according to model numbers, so that games generated by
270-
one model stay together. The output will be in the directories
280+
one model stay together. By default, `rl_loop.py` will use directories
281+
specified by the environment variable `BUCKET_NAME`, set at the top of
282+
`rl_loop.py`
271283

272284
```
273285
gs://$BUCKET_NAME/data/training_chunks/$MODEL_NAME-{chunk_number}.tfrecord.zz
@@ -295,7 +307,6 @@ python3 main.py train gs://$BUCKET_NAME/data/training_chunks \
295307
--load-file=gs://$BUCKET_NAME/models/000000-bootstrap \
296308
--generation-num=1 \
297309
--logdir=path/to/tensorboard/logs \
298-
-n 9
299310
```
300311

301312
The updated model weights will be saved at the end. (TODO: implement some sort
@@ -313,8 +324,7 @@ Running Minigo on a Cluster
313324
As you might notice, playing games is fairly slow. One way to speed up playing
314325
games is to run Minigo on many computers simultaneously. Minigo was originally
315326
trained by containerizing these worker jobs and running them on a Kubernetes
316-
cluster, hosted on the Google Cloud Platform (TODO: links for installing GCP
317-
SDK, kubectl, etc.)
327+
cluster, hosted on the Google Cloud Platform.
318328

319329
*NOTE* These commands will result in VMs being created and will result in
320330
charges to your GCP account! *Proceed with care!*
@@ -371,7 +381,7 @@ Bringing up a cluster
371381
---------------------
372382

373383
0. Switch to the `cluster` directory
374-
1. Set the common environment variables in `common` corresponding to your GCP project and bucket names.
384+
1. Set the common environment variables in `common.sh` corresponding to your GCP project and bucket names.
375385
2. Run `deploy`, which will:
376386
a. Create a bucket
377387
b. Create a service account
@@ -476,8 +486,8 @@ To kill the job,
476486
envsubst < player.yaml | kubectl delete -f -
477487
```
478488

479-
Preflight checks for a training run.
480-
====================================
489+
Preflight checklist for a training run.
490+
=======================================
481491

482492

483493
Setting up the selfplay cluster
@@ -519,7 +529,7 @@ Setting up the selfplay cluster
519529
Useful things for the selfplay cluster
520530
--------------------------------------
521531

522-
* Getting a list of the selfplay games ordered by most recent start
532+
* Getting a list of the selfplay games ordered by start time.
523533
```
524534
kubectl get po --sort-by=.status.startTime
525535
```
@@ -537,13 +547,9 @@ Useful things for the selfplay cluster
537547
```
538548

539549

540-
Setting up logging via stackdriver, plus metrics, bla bla.
541-
542-
543-
If you've run rsync to collect a set of SGF files (cheatsheet: `python3
544-
rl_loop.py smart-rsync --source-dir="gs://$BUCKET_NAME/sgf/" --from-model-num 0
545-
--game-dir=sgf/`), here are some handy
546-
bashisms to run on them:
550+
If you've run rsync to collect a set of SGF files (cheatsheet: `gsutil -m cp -r
551+
gs://$BUCKET_NAME/sgf/$MODEL_NAME sgf/`), here are some handy
552+
bash fragments to run on them:
547553

548554
* Find the proportion of games won by one color:
549555
```
@@ -567,7 +573,5 @@ bashisms to run on them:
567573
\; | ministat
568574
```
569575

570-
571-
etc...
572-
573-
576+
Also check the 'oneoffs' directory for interesting scripts to analyze e.g. the
577+
resignation threshold.

0 commit comments

Comments
 (0)