Skip to content

Commit cfbc975

Browse files
authored
Merge pull request official-stockfish#265 from Sopel97/trainreadme
Update readme on training.
2 parents 7d87703 + a3bd41f commit cfbc975

File tree

1 file changed

+7
-62
lines changed

1 file changed

+7
-62
lines changed

README.md

Lines changed: 7 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -37,80 +37,25 @@ Linux/Mac:
3737
sh compile_data_loader.bat
3838
```
3939

40-
# Train a network
41-
42-
```
43-
source env/bin/activate
44-
python train.py --gpus 1 train_data.bin val_data.bin
45-
```
46-
47-
## Resuming from a checkpoint
48-
```
49-
python train.py --gpus 1 --resume_from_checkpoint <path> ...
50-
```
51-
52-
## Feature set selection
53-
By default the trainer uses a factorized HalfKAv2_hm feature set (named "HalfKAv2_hm^")
54-
If you wish to change the feature set used then you can use the `--features=NAME` option. For the list of available features see `--help`
55-
The default is:
56-
```
57-
python train.py ... --features="HalfKAv2_hm^"
58-
```
59-
60-
## Skipping certain fens in the training
61-
62-
`--smart-fen-skipping` currently skips over moves where the king is in check, or where the bestMove is a capture (typical of non-quiet positions).
63-
`--random-fen-skipping N` skip N fens on average before using one. Uses fewer fens per game, useful with large data sets.
64-
65-
## Current recommended training invocation
66-
67-
```
68-
python train.py --smart-fen-skipping --random-fen-skipping 3 --batch-size 16384 --threads 2 --num-workers 2 --gpus 1 trainingdata validationdata
69-
```
70-
best nets have been trained with 16B d9-scored nets, training runs >200 epochs
71-
40+
# Network training and management
7241

42+
Hard way: [wiki](https://github.com/official-stockfish/nnue-pytorch/wiki/Basic-training-procedure-(train.py))
7343

74-
# Export a network
75-
76-
Using either a checkpoint (`.ckpt`) or serialized model (`.pt`),
77-
you can export to SF NNUE format. This will convert `last.ckpt`
78-
to `nn.nnue`, which you can load directly in SF.
79-
```
80-
python serialize.py last.ckpt nn.nnue
81-
```
82-
83-
# Import a network
84-
85-
Import an existing SF NNUE network to the pytorch network format.
86-
```
87-
python serialize.py nn.nnue converted.pt
88-
```
89-
90-
# Visualize a network
91-
92-
Visualize a network from either a checkpoint (`.ckpt`), a serialized model (`.pt`)
93-
or a SF NNUE file (`.nnue`).
94-
```
95-
python visualize.py nn.nnue --features="HalfKAv2_hm"
96-
```
97-
98-
Visualize the difference between two networks from either a checkpoint (`.ckpt`), a serialized model (`.pt`)
99-
or a SF NNUE file (`.nnue`).
100-
```
101-
python visualize.py nn.nnue --features="HalfKAv2_hm" --ref-model nn.cpkt --ref-features="HalfKAv2_hm^"
102-
```
44+
Easier way: [wiki](https://github.com/official-stockfish/nnue-pytorch/wiki/Basic-training-procedure-(easy_train.py))
10345

10446
# Logging
10547

48+
TODO: Move to wiki. Add setup for easy_train.py
49+
10650
```
107-
pip install tensorboard
10851
tensorboard --logdir=logs
10952
```
11053
Then, go to http://localhost:6006/
11154

11255
# Automatically run matches to determine the best net generated by a (running) training
11356

57+
TODO: Move to wiki
58+
11459
```
11560
python run_games.py --concurrency 16 --stockfish_exe ./stockfish.master --c_chess_exe ./c-chess-cli --ordo_exe ./ordo --book_file_name ./noob_3moves.epd run96
11661
```

0 commit comments

Comments
 (0)