Skip to content

stepledger: a step ledger on each side of the boundary - #1

Merged
tactino merged 1 commit into
mainfrom
init
Oct 27, 2026
Merged

tactino merged 1 commit into
mainfrom
init

Conversation

@tactino

@tactino tactino commented Oct 27, 2026

Copy link
Copy Markdown
Member

The package stepledger (distribution name plugrl-stepledger; the PyPI name stepledger belongs to an unrelated project).

  • LedgerEnv: env side, outermost wrapper in the environment's own process.
  • LedgerVectorEnv: trainer side for Gymnasium vector envs (NextStep and SameStep autoreset; Disabled refused).
  • stepledger.sb3.LedgerVecEnv: trainer side for Stable-Baselines3 (DummyVecEnv, SubprocVecEnv).
  • compare and stepledger compare ENV_DIR TRAINER_FILE: exit 0 when clean, 1 on a difference, 2 when it cannot compare.

Tests: 58 pass locally without SB3 (67 with SB3's vec_env modules); CI installs CPU torch and SB3 and also runs both examples, checking that the injected fault is reported. Cost on 16 Pendulum envs: about 5 us per env step on the env side and 4 us on the trainer side; about 20 bytes per event on disk.

The repository is private. Make it public when you want to announce it.

…ndary

LedgerEnv records what each environment took and gave; LedgerVectorEnv (Gymnasium,
NextStep and SameStep autoreset) and LedgerVecEnv (Stable-Baselines3) record what the
trainer sent and received; compare / `stepledger compare` finds the first difference per
env and names the episode, step and field. Values are cast to the declared spaces and
hashed; rewards are kept as exact bits. Tests cover clean sync and async runs and five
injected faults (float16 observation, stale reward, time limit sent as termination,
changed action, skipped step); CI runs them with SB3 and both examples.
@tactino
tactino merged commit b8d65e2 into main Oct 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant