Skip to main content

NNUE Trainer

Installation

To install the library, use the following command:

pip install nnue-trainer

Additionally, the nnue-parser library is required for parsing training data:

pip install nnue-parser

Usage

A simple example for training an NNUE model:

from nnue_trainer import train_nnue

if __name__ == "__main__":
    train_nnue(
        train_file="train.bin",
        val_file="val.bin",
        epochs=10,
        batch_size=4096,
        device="gpu",
        num_workers=5,
        quantize=True
    )

Parameter Description:

Parameter Description
train_file Path to the training file in .bin format
val_file Path to the validation file in .bin format
epochs Number of training iterations
batch_size Batch size for processing
device Choose "cpu" or "gpu" to specify the device
num_workers Number of parallel processes for data loading
quantize If True, the model will be quantized

Creating .bin Training Files

The .bin training files can be generated using the following tool:
FireFather/sf-nnue-aio

Use the following command:

gensfen depth 8 loop 100000

This command generates SFEN data with a search depth of 8 over 100,000 iterations.

Parsing the .jnn File

After training, the final .jnn model file can be parsed using the nnue-parser library:

from nnue_parser import parse_nnue

parsed_data = parse_nnue("model.jnn")

This allows you to inspect and analyze the trained NNUE model.

Troubleshooting / Common Errors

TypeError: devices selected with CPUAccelerator should be an int > 0.

Solution: Ensure that devices in train_nnue() is not None or 0. If training on CPU, explicitly set:

train_nnue(..., device="cpu", num_workers=1)

RuntimeError: CUDA out of memory

Solution: If your GPU memory is insufficient, reduce the batch_size:

train_nnue(..., batch_size=1024)

Acknowledgments

A big thank you to the repository TensorFlowNNUE for the model.

License

This project is released under an open-source license. See the LICENSE file for more details.

Release Information

This is the first and final release of NNUE Trainer.

Metadata

Release files for nnue-trainer 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for nnue-trainer 0.1.1
File Interpreter ABI Platform Actions
nnue_trainer-0.1.1-py3-none-any.whl Python 3 none any Details for nnue_trainer-0.1.1-py3-none-any.whl

Release files / nnue_trainer-0.1.1-py3-none-any.whl

Download URL nnue_trainer-0.1.1-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2cd6875ec23d443cbe3e7eca4c3e0782692f566ffd5072cc046b7fe17c977a5
BLAKE2b-256 checksum
How to use checksums
c77f46466b31e9b29aed6768f11a004c164c4404bf80b34afd532aa8eb521914
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Security for nnue-trainer 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page