Skip to content

lit_sb3.huggingface

source package lit_sb3.huggingface

HuggingFace Hub integration for lit-sb3.

Integrates code from:

  • https://github.com/huggingface/huggingface_sb3/tree/main/huggingface_sb3
  • https://github.com/DLR-RM/rl-baselines3-zoo/blob/master/rl_zoo3/

All imports adapted to use lit_sb3 instead of stable_baselines3.

Classes

  • EnvironmentName — A normalized environment name safe for use in file paths and URLs.

  • ModelName — A model name derived from algorithm and environment.

  • ModelRepoId — The name of a HuggingFace repository.

source class EnvironmentName()

Bases : str

A normalized environment name safe for use in file paths and URLs.

Slashes are replaced by dashes, and namespace:EnvName style ids are stripped of their namespace prefix so that:

EnvironmentName("ALE/Pong-v5")  # → "ALE-Pong-v5"
EnvironmentName("ns:CartPole-v1")  # → "CartPole-v1"

The original gym id (to pass to gym.make) is available via the :attr:gym_id property.

Attributes

  • gym_id : str — The original gym id to pass to gym.make.

source property EnvironmentName.gym_id: str

The original gym id to pass to gym.make.

source class ModelName()

Bases : str

A model name derived from algorithm and environment.

Safe to use in file paths and URLs because a normalized :class:EnvironmentName is used.

ModelName("ppo", EnvironmentName("CartPole-v1"))  # → "ppo-CartPole-v1"

Attributes

  • filename : str — The filename under which the model is stored when calling model.save.

source property ModelName.filename: str

The filename under which the model is stored when calling model.save.

source class ModelRepoId()

Bases : str

The name of a HuggingFace repository.

Derived from the associated organization and the model name.

ModelRepoId("sb3", ModelName("ppo", EnvironmentName("CartPole-v1")))
# → "sb3/ppo-CartPole-v1"