Resource manager for MolmoSpaces
Actively maintained. Last release 3 months ago, commits in 8 of the last 26 weeks. A safe choice.
pip install molmospaces-resources
MolmoSpaces-resources
Resource manager for MolmoSpaces. Downloads, caches, and symlinks versioned data archives from remote buckets.
- Versioned, read-only download cache with symlink-based install directories
- Eager or on-demand archive extraction with parallel downloads
- Pluggable archive indexing for fast asset lookup
- Fork-resilient: safe to use across multiprocessing workers
Installation
pip install molmospaces-resources
Setup example
Data is assumed to be served from a gated Hugging Face dataset repo, so we typically need to pass a valid token:
import os
from molmospaces_resources import HFRemoteStorage, setup_resource_manager
source = HFRemoteStorage("allenai/molmospaces", repo_prefix="mujoco", token=os.environ["HF_TOKEN"])
mgr = setup_resource_manager(
source,
symlink_dir=SYMLINK_DIR,
versions=ASSETS_VERSIONS,
cache_dir=CACHE_DIR,
)
Alternatively, we can use R2RemoteStorage for direct bucket access, including "mujoco-thor-resources", "isaac-thor-resources", and "mujoco-thor-training-data" (also available for Google Cloud Storage via GCRemoteStorage with "molmospaces-isaac", "molmospaces-mujoco", and "molmobot-data" buckets):
from molmospaces_resources import R2RemoteStorage, setup_resource_manager
source = R2RemoteStorage("mujoco-thor-resources") # known bucket name or full URL
mgr = setup_resource_manager(
source,
symlink_dir=SYMLINK_DIR,
versions=ASSETS_VERSIONS,
cache_dir=CACHE_DIR,
)
Optionally, run project-specific logic after setup via post_setup:
def my_post_setup(manager):
## Install all scenes (while skipping per-file symlinking):
# manager.install_all_for_data_type("scenes", skip_linking=True)
## Install all objects (with per-dataset symlinking):
# manager.install_all_for_data_type("objects")
pass
mgr = setup_resource_manager(
source,
symlink_dir=SYMLINK_DIR,
versions=ASSETS_VERSIONS,
cache_dir=CACHE_DIR,
post_setup=my_post_setup,
force_post_setup=True, # run post_setup even if all data sources are configured
)
Logging
By default, Python's logging shows and above, so the library will be quiet. To see detailed progress messages, either configure the root logger: