<commit_before># MiniGo

This folder is the Swift ([S4TF]) verison of the [MiniGo] game. It has been
reimplemented from the MLPerf reference model.

> Note: Due to temporary limitations, we only support inference (self-play)
> for now. We hope to soon lift these restrictions.

In order to use this code, first download a pre-trained set of weights from
the MiniGo project. Then compile the code and run it locally! You can change
around parameters like the board size, and the number of simulations per
move by modifying constants at the top of `Sources/MiniGo/main.swift`.

## To Get a MiniGo Checkpoint

Currently the inference uses a pre-trained checkpoint. To get it, run

    mkdir -p MiniGo
    gsutil cp gs://minigo-pub/v15-19x19/models/000939-heron.* MiniGo/

## To Compile and Run

To compile and run the code, make sure you have the latest S4TF toolchain (see
next section).

Then, follow the following steps:

    swift test
    swift run

## Swift for TensorFlow Toolchain

In order to use [Swift Package Manager][SwiftPM], a toolchain is required. You
can

1. download the pre-built package from [official
   site](https://github.com/tensorflow/swift/blob/master/Installation.md)
2. [compile the toolchain](https://github.com/apple/swift/tree/tensorflow#building-swift-for-tensorflow)
   on your own


[S4TF]: https://www.tensorflow.org/swift/
[SwiftPM]: https://swift.org/package-manager/
[MiniGo]: https://github.com/mlperf/training/blob/master/reinforcement/tensorflow/minigo
<commit_msg>Update MiniGo documentation. (#55)<commit_after># MiniGo

This is an implementation of [MiniGo] using [Swift for TensorFlow].
The implementation is adapted from the
[MLPerf reference model](https://github.com/mlperf/training/tree/master/reinforcement).

> Note: Due to temporary limitations, we only support inference (self-play)
> for now. We hope to soon lift these restrictions.

In order to run this code, first download a pre-trained checkpoint from the
MiniGo project. Then, compile the code and run it locally. Parameters like
"board size" and "simulations per move" are defined as constants at the top of
[`Sources/MiniGo/main.swift`](https://github.com/tensorflow/swift-models/blob/stable/MiniGo/Sources/MiniGo/main.swift)
and can be modified.

## Getting started

### Install Swift for TensorFlow

Building MiniGo requires a Swift for TensorFlow toolchain.
To get a toolchain, you can:

1. [Download a pre-built package](https://github.com/tensorflow/swift/blob/master/Installation.md).
2. [Compile a toolchain from source](https://github.com/apple/swift/tree/tensorflow#building-swift-for-tensorflow).

### Restore a MiniGo checkpoint

Currently, inference uses a pre-trained checkpoint. To download it, please
install [`gsutil`](https://cloud.google.com/storage/docs/gsutil_install) and run
the following:

```sh
mkdir -p MiniGo
gsutil cp 'gs://minigo-pub/v15-19x19/models/000939-heron.*' MiniGo/
```

### Usage

```sh
# Run inference (self-play).
swift run -Xlinker -ltensorflow
# Run unit tests.
swift test -Xlinker -ltensorflow
```

[Swift for TensorFlow]: https://www.tensorflow.org/swift
[MiniGo]: https://github.com/mlperf/training/blob/master/reinforcement/tensorflow/minigo

{'fraction_non_alphanumeric': 0.10346983432322601, 'fraction_numerical': 0.01031572366364489, 'mean_word_length': 4.460750853242321, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 12, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5648504', 'n_tokens_mistral': 1019, 'n_tokens_neox': 944, 'n_words': 349}