Metadata-Version: 2.4
Name: lockstep-train
Version: 1.0.1
Requires-Dist: numpy>=1.26
Requires-Dist: gymnasium>=1.0
Requires-Dist: pytest>=8 ; extra == 'dev'
Provides-Extra: dev
Summary: Train a policy locally against a Lockstep environment's real engine: Gymnasium environments whose spaces are the ONNX shell's.
Requires-Python: >=3.11
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://lockstep.it

# lockstep-train

Train a policy on your own machine against a [Lockstep](https://lockstep.it)
environment's real engine.

```
pip install lockstep-train
```

In the folder `lockstep invite get` (or `lockstep training get`) wrote:

```python
import lockstep_train

env = lockstep_train.make(".")                       # a Gymnasium environment
obs, info = env.reset(seed=7)                        # the match `lockstep run --seed 7` plays
obs, reward, terminated, truncated, info = env.step(env.action_space.sample())

vec = lockstep_train.make_vec(".", 8)                # 8 matches at once, one thread each
```

- **Every step is a turn of the real match**: the same engine, rules and
  opponents as `lockstep run`, deterministic for the same seed and actions.
- **The spaces are the ONNX shell's**: one observation per declared input,
  one action per tensor the shell reads (an f32 output in [-1, 1], a
  discrete head per coded output). Export your network with one ONNX
  output per action entry, put it in a `policy` bundle, and `lockstep check
  --agent <bundle>` plays it exactly as Lockstep will.
- **Reward**: the environment's own per-turn training reward (or a series
  you name, `reward="series:<key>"`, or the score at the end, `"score"`); `info` carries every declared series and, at
  the end, the score and the ending.
- `LabelledStream` turns an environment's delayed feedback into
  `(observation, label)` pairs for supervised training.

Python 3.11 or later; wheels for macOS (Apple silicon), Linux (x86_64,
arm64) and Windows (x86_64).

