Instructions to use Travor278/putcab-sequential-diffusion-train50-10k-e248 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LeRobot
How to use Travor278/putcab-sequential-diffusion-train50-10k-e248 with LeRobot:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download load_policy.py from Travor278/putcab-sequential-diffusion-train50-10k-e248: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/Travor278/putcab-sequential-diffusion-train50-10k-e248/resolve/main/load_policy.py
- Command line
-
hf download hf://Travor278/putcab-sequential-diffusion-train50-10k-e248/load_policy.py
-
curl -L -o load_policy.py https://huggingface.co/Travor278/putcab-sequential-diffusion-train50-10k-e248/resolve/main/load_policy.py
1.32 kB
| """Load this repository offline after snapshot_download, using official LeRobot.""" | |
| from pathlib import Path | |
| def load_policy(checkpoint_dir, device="cpu"): | |
| from lerobot.configs.policies import PreTrainedConfig | |
| from lerobot.policies.factory import get_policy_class, make_pre_post_processors | |
| root = Path(checkpoint_dir).resolve() | |
| config = PreTrainedConfig.from_pretrained(root) | |
| config.device = device | |
| config.pretrained_path = root | |
| overrides = {"device_processor": {"device": device}} | |
| if config.type == "smolvla": | |
| assets = root / "vlm_assets" | |
| config.vlm_model_name = str(assets) | |
| config.load_vlm_weights = False | |
| overrides["tokenizer_processor"] = {"tokenizer_name": str(assets)} | |
| elif config.type == "act": | |
| # The full trained backbone is in model.safetensors; avoid fetching its | |
| # initialization weights before restoring that complete state dictionary. | |
| config.pretrained_backbone_weights = None | |
| policy = get_policy_class(config.type).from_pretrained(root, config=config).eval().to(device) | |
| pre, post = make_pre_post_processors( | |
| config, | |
| pretrained_path=root, | |
| preprocessor_overrides=overrides, | |
| postprocessor_overrides={"device_processor": {"device": "cpu"}}, | |
| ) | |
| return policy, pre, post | |