bimanual-pose-vae / load_model.py
WhynotGPT's picture
Release joint_mix40 VAE weights, training and GT neighborhood sampling code
34988af verified
Raw History Blame Contribute Delete
593 Bytes
"""Load the released tensor-only weights and checkpoint metadata."""
import json
from pathlib import Path
from safetensors.torch import load_file
from bimanual_vae import BimanualVAE
def load_model(directory=None, device="cpu"):
directory = Path(directory) if directory else Path(__file__).resolve().parent
config = json.loads((directory / "config.json").read_text())
model = BimanualVAE(**config["architecture"])
model.load_state_dict(load_file(str(directory / "model.safetensors")), strict=True)
model.to(device).eval().requires_grad_(False)
return model, config