rl-mind¶
rl_mind is the small, typed reinforcement-learning toolkit used by the
Master MIND RL practicals. Everything an agent exchanges with its environment
is a frozen dataclass of torch.Tensors — no untyped string dictionaries —
and the action type flows through the whole API, so an editor can autocomplete
field names and a type checker can catch a missing log_prob.
pip install rl-mind
import rl_mind.envs # registers CartPoleContinuous-v1 (explicit opt-in)
from rl_mind import VecEnv, ReplayBuffer, TransitionCollector, Evaluator
env = VecEnv("CartPoleContinuous-v1", num_envs=1, seed=1)
collector = TransitionCollector(env, actor)
buffer = ReplayBuffer(200_000)
while collector.steps < 30_000:
buffer.add(collector.collect(1))
batch = buffer.sample(64) # Transitions[Action]
...
Importing the package has no side effect: the extra gymnasium
environments are registered only by an explicit import rl_mind.envs or
import rl_mind.mazemdp_env.
Two ways in:
the guide walks through the design — what each building block is for, how the three collectors map onto the three families of algorithms, and why
terminatedandtruncatedmust not be confused;the API reference documents every class, method and function, straight from the docstrings, one page per area: actors & actions, environments, data, collectors, evaluation, rendering, utilities, extra environments.