Out of View, Still in Motion:
Dynamic Entity Re-entry in Video World Models
🌐 Project Page | 🤗 Model | License
ReentryMem is a self-localized framework for dynamic entity re-entry in video world models. It reads entity regions directly from noisy video latents and uses the same localization mechanism to guide training and sampling, improving recovery when a moving subject leaves the camera's view and later returns.
This repository provides inference code and the trained single-entity Wan2.2-TI2V-5B checkpoint.
ReentryMem-inline.mp4
Visit the project page for the method, synchronized comparisons, and more qualitative results.
ReentryMem connects three components:
- Self-localized entity regions. Text cross-attention provides separate signals for entity presence and spatial shape during denoising.
- Entity-weighted training. The predicted regions emphasize the entity in the flow-matching objective.
- Localized sampling. Overshooting and re-noising correct the predicted entity region while the background follows the standard Euler update.
The localization mechanism operates on noisy latents without intermediate RGB decoding or an external segmentation model. Ordinary Euler sampling and localized sampling use the same trained checkpoint.
The controlled comparison reported on the project page:
| Method | Rea-Score (%) ↑ | SC ↑ | TCM ↑ |
|---|---|---|---|
| Baseline | 96.1 | 0.8204 | 0.9154 |
| ReentryMem-Train | 99.2 | 0.8380 | 0.9231 |
| ReentryMem | 97.2 | 0.8378 | 0.9318 |
Rea-Score measures entity reappearance, SC measures subject consistency, and TCM measures temporal consistency match. ReentryMem-Train uses Euler sampling; ReentryMem adds localized sampling to the same weights. See the project page for the evaluation protocol and comparisons with other world models.
Use Python 3.10 or later with CUDA-enabled PyTorch. FlashAttention is optional; fused PyTorch attention is used when it is unavailable.
git clone https://github.com/LynnReal-AI/ReentryMem.git
cd ReentryMem
conda create -n reentrymem python=3.11 -y
conda activate reentrymem
pip install -r requirements.txt| Model | Backbone | Precision | Resolution | Download |
|---|---|---|---|---|
| ReentryMem | Wan2.2-TI2V-5B | BF16 | 832×480 | Hugging Face |
python tools/download_models.py \
--repo-id larry077/ReentryMem \
--checkpoint-dir checkpoints/ReentryMemThis downloads the complete ReentryMem DiT checkpoint and the tokenizer, text encoder, and VAE from the official Wan2.2 base model.
Provide a 77-frame observed clip at 15 fps, a caption, the subject phrase to track, and planned camera controls. The subject phrase must occur in the caption. Generation produces 76 future frames at 832×480.
Create an input case with a turn-and-return camera preset:
python tools/create_case.py \
--video /path/to/observed.mp4 \
--prompt "A girl walks through a stylized town." \
--subjects "girl" \
--preset turn-return \
--output examples/case.jsonRun inference on a CUDA GPU:
python infer.py \
--case examples/case.json \
--checkpoint checkpoints/ReentryMem \
--base-model pretrained/Wan2.2-TI2V-5B \
--output-dir outputs/demoOutputs are video.mp4 (observed prefix and continuation), continuation.mp4 (generated segment), and receipt.json (settings and runtime measurements).
Camera controls and sampling options
Use --camera-json camera.json instead of --preset for planned camera-to-world poses, or --actions-json actions.json for 39 latent-frame action labels. Each label is translation * 9 + rotation, with nine translation and nine rotation actions.
| Option | Behavior |
|---|---|
--sampler localized |
Default ReentryMem sampling |
--sampler euler |
Ordinary sampling with the same checkpoint |
--save-masks |
Save the entity-region fields |
--dry-run --verify-checkpoint |
Check the case manifest, model files, and checksums without generation |
Defaults are 50 steps, CFG 5, sigma shift 5, generation seed 42, correction seed 0, correction strength 8, and noise gate 0.92. See the example case for the input schema.
python -m unittest discover -s tests -vSee maintenance notes for checkpoint export, model-card updates, release tools, and the standalone release's validation status.
Code and released weights are distributed under Apache-2.0. The backbone and camera-conditioning implementation build on Wan2.2 and BiWM. Sampling provenance and upstream notices are preserved in NOTICE.
