Skip to main content

Stable Library for evaluate and conduct world model research

Project description

PyTorch Ruff Testing Python 3.10 License

stable-worldmodel logo

A stable library for world model research and evaluation, providing unified interfaces for data collection, model training, and policy evaluation.

Features

  • 🧑‍🔬 Controlled Factors of Variation: Manage and track environmental factors with extended Gymnasium spaces
  • 🎯 Complete Solver Support: Multiple planning algorithms (CEM, Gradient Descent, MPPI, Random)
  • High Test Coverage: Comprehensive test suite ensuring reliability and correctness

Installation

Quick Start

  1. Install uv (fast Python package manager):
pip install uv
  1. Clone and install the package:
git clone https://github.com/rbalestr-lab/stable-worldmodel.git
cd stable-worldmodel
uv pip install -e .

Development Installation

For development with testing and documentation tools:

uv pip install -e . --group dev --group doc

Quick Example

import stable_worldmodel as swm
import torch

# Create environment
world = swm.World(
    "swm/SimplePointMaze-v0",
    num_envs=7,
    image_shape=(224, 224),
    render_mode="rgb_array",
)

# Collect training data
world.set_policy(swm.policy.RandomPolicy())
world.record_dataset("simple-pointmaze", episodes=10, seed=2347)

# Train world model
swm.pretraining(
    "scripts/train/dummy.py",
    "++dump_object=True dataset_name=simple-pointmaze output_model_name=dummy_test"
)

# Load and evaluate
action_dim = world.envs.single_action_space.shape[0]
world_model = swm.wm.DummyWorldModel((224, 224, 3), action_dim)
solver = swm.solver.RandomSolver(
    horizon=5,
    action_dim=action_dim,
    cost_fn=torch.nn.functional.mse_loss
)
policy = swm.policy.WorldModelPolicy(
    world_model, solver,
    horizon=10, action_block=5, receding_horizon=5
)
world.set_policy(policy)

results = world.evaluate(episodes=2, seed=2347)
print(results)

Project Structure

stable_worldmodel/
├── envs/          # Custom Gymnasium environments
├── solver/        # Planning algorithms (CEM, GD, MPPI, Random)
├── wm/            # World model implementations
├── tests/         # Test suite
├── policy.py      # Policy implementations
├── spaces.py      # Extended Gymnasium spaces with state tracking
├── world.py       # Main World interface
└── utils.py       # Utility functions

Testing

Run tests with coverage:

pytest --cov=stable_worldmodel --cov-report=term-missing

Contributors

License

MIT License - see LICENSE file for details.

Citation

@inproceedings{tbd, title = "TBD", author = "", booktitle = "", }

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stable_worldmodel-0.0.1a0.tar.gz (291.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stable_worldmodel-0.0.1a0-py3-none-any.whl (97.7 kB view details)

Uploaded Python 3

File details

Details for the file stable_worldmodel-0.0.1a0.tar.gz.

File metadata

  • Download URL: stable_worldmodel-0.0.1a0.tar.gz
  • Upload date:
  • Size: 291.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.23

File hashes

Hashes for stable_worldmodel-0.0.1a0.tar.gz
Algorithm Hash digest
SHA256 a4488c097243527ed8925c07fd846accc5398904ff4b77c55c669cbf09b3520c
MD5 1daed88dbf9f00305a06eae61d933986
BLAKE2b-256 67b1062f1dc7296ed16d11e3f46735f79e51f6478be6b8410b47bf73fb8dcf59

See more details on using hashes here.

File details

Details for the file stable_worldmodel-0.0.1a0-py3-none-any.whl.

File metadata

File hashes

Hashes for stable_worldmodel-0.0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d008d23b82e4ca7dd01046558f87d7e40bc882c865b245e5cc8f85ee34b707f
MD5 154aac077135329e059dcac448ec3625
BLAKE2b-256 13c9a1648a4c21bfc24c811eeaf6d636d499e1173b6c0d9ed1f677133f08419e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page