{"id":15974403,"url":"https://github.com/patwie/tfgo","last_synced_at":"2025-08-09T01:37:43.024Z","repository":{"id":81506135,"uuid":"94706531","full_name":"PatWie/tfGo","owner":"PatWie","description":"Independent efficient re-Implementation AlphaGo SL policy network","archived":false,"fork":false,"pushed_at":"2017-07-03T21:08:26.000Z","size":475,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-22T11:43:35.261Z","etag":null,"topics":["alphago","deep-learning","swig","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PatWie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-18T18:50:50.000Z","updated_at":"2018-02-08T08:54:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"f68c7e40-9f5e-41fe-9231-d78bb144ab46","html_url":"https://github.com/PatWie/tfGo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatWie%2FtfGo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatWie%2FtfGo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatWie%2FtfGo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatWie%2FtfGo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PatWie","download_url":"https://codeload.github.com/PatWie/tfGo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245731538,"owners_count":20663202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alphago","deep-learning","swig","tensorflow"],"created_at":"2024-10-07T21:41:20.131Z","updated_at":"2025-03-26T20:31:43.025Z","avatar_url":"https://github.com/PatWie.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Policy-Network (SL) from AlphaGO in TensorFlow\n\nYet another re-implementation of the policy-network (supervised) from Deepmind's AlphaGo. This implementations uses a C++ backend to compute the feature planes presented in the [Nature-Paper](https://gogameguru.com/i/2016/03/deepmind-mastering-go.pdf) and a custom fileformat for efficient storage. To train the network it uses the dataflow and multi-GPU setup of [TensorPack](https://github.com/ppwwyyxx/tensorpack).\n\n\n# Data + Features\nSee [here](https://u-go.net/gamerecords/) or [here](https://www.u-go.net/gamerecords-4d/) to get a database of GO games in the SGF fileformat. It is also possible to buy a database `GoGoD`. This database consists of `89942` (without the games before 1800). Some statistics about this database are\n\n        - 2052 out of 89942 games are corrupt ~2.281470%\n        - 2908 out of 89942 games are amateur ~3.233195%\n        - total moves 17 676 038 (games with professional)\n        - average moves 207 per game\n        - u-go.net provides 1681414 files including some amateur games.\n\nTo handle these games efficiently, we convert them to binary by\n\n        python reader.py --action convert --pattern \"/tmp/godb/Database/*/*.sgf\"\n\nNow, to merge all games within a single file, we dump these games to an LMDB file (train/val/test split of the games):\n\n        python go_db.py --lmdb \"/tmp/godb/\" --pattern \"/tmp/godb/Database/*/*.sgfbin\" --action create\n\nI do not split the positions into train/val/test, I split the games to makes sure they are totally independent. All training data can be compressed to just (1.1GB/55M) and validation data is just (120MB/6.2MB) for u-go.net/GoGoD databases. \nTo simulate the board position from the encoded moves, we setup the SWIG-Python binding `goplanes` of the C++ implementation by:\n\n        cd go-engine \u0026\u0026 python setup.py install --user\n\nThis generates all feature-planes from positions randomly extracted from the db including all rotations (12x8 inputs /sec). On a 6-core this gives araound 100x8 positions per second. I verified this implementation along all final positions from GoGoD simulated in GnuGo and GoPlane.\n\n        python go_db.py --lmdb \"/home/patwie/godb/go_train.lmdb\" --action benchmark\n\n# Training \n\nTo train the version with `128` filters just fire up. \n\n        python tfgo.py --gpu 0,1 --k 128 --path /tmp # or --gpu 0 for single gpu\n\nI saw no big different on a small number of GPUS, this uses the Sync-Training rather than any Async-Training. It will also create checkpoints for the best performing models from the validation phase.\n\nTensorboard should show something like\n\n![sample](tb.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatwie%2Ftfgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatwie%2Ftfgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatwie%2Ftfgo/lists"}