Camais03/Camie-Crafter
3
Camie Crafter World Model
Interactive demo for the Camie Crafter latent world model.
This Space loads a real Crafter clip, encodes the first 32 frames into latent context with an MAE encoder, then rolls the world model forward one action at a time and decodes each predicted latent back into an image.
This is not the real Crafter environment. It is the model’s imagined continuation.
What the app does
At startup the Space downloads and loads these ONNX exports from the repo:
checkpoints/world_model_one_step.onnxcheckpoints/mae_decode_one_frame.onnxcheckpoints/mae_encode.onnx
Then the UI lets you:
- load a built-in demo
.npzclip - upload your own Crafter
.npzepisode - choose a starting frame index
- encode the context window into latents
- step the model forward with discrete Crafter actions
- save the imagined trajectory as a GIF
Model pipeline
For each rollout:
- Encode context The selected context frames are passed through
mae_encode.onnx.
- Predict next latent The encoded context latents and chosen action are passed into
world_model_one_step.onnx.
- Decode predicted frame The predicted latent is rendered with
mae_decode_one_frame.onnx.
- Feed prediction back in The predicted latent is appended back into context for open-loop imagined play.
Controls
Movement
W/ArrowUp→ upA/ArrowLeft→ leftS/ArrowDown→ downD/ArrowRight→ right
Other actions
Space→ doTab→ noopShift→ sleep
Craft / place
1→ place stone2→ place table3→ place furnace4→ place plant5→ make wood pickaxe6→ make stone pickaxe7→ make iron pickaxe8→ make wood sword9→ make stone sword0→ make iron sword
Input format
The app expects a Crafter .npz file containing at least:
image: array of frames with shape[T, H, W, C]- optionally
action: array of integer actions with shape[T]
Expected details
- frames should be RGB
uint8 - resolution should match the model export, typically
64×64 - if
actionis missing, the app fills actions with zeros
Built-in demo clip
By default the app loads the demo file:
demo/1CKFwmfLeb5MzlgFRaIF7M.npz
You can change this with:
CAMIE_DEMO_NPZ
Environment variables
Optional configuration:
CAMIE_CHECKPOINT_SUBDIRdefault:checkpoints
CAMIE_DEMO_NPZdefault:demo/1CKFwmfLeb5MzlgFRaIF7M.npz
CAMIE_N_CTXdefault:32
CAMIE_IMG_SIZEdefault:64
CAMIE_MODEL_NUM_LATENTSdefault:32
CAMIE_MODEL_D_LATdefault:32
CAMIE_SEEDdefault:0
Notes
- The app runs entirely with ONNX Runtime.
- The first load may take a moment because the ONNX files are downloaded at startup.
world_model_one_step.onnxmay not have a separate.datasidecar file, which is fine.- Uploaded clips are used only as starting context; after that, the rollout is purely model-generated.
Requirements
Listed in requirements.txt:
gradioonnxonnxruntimehuggingface_hubnumpypillow
Local run
python app.py