Modeling Specifics
Warning
The components documented on this page are internal model implementations and are subject to change between versions. These are advanced, under-the-hood components of World Engine. You should only interact with these directly if you are savvy and curious about the internal workings of the model architecture.
For normal usage, please refer to the main API Reference.
Internal Model Components
world_engine.model.base_model
world_engine.model.world_model
- class world_engine.model.world_model.PromptEncoder(*args: Any, **kwargs: Any)[source]
Bases:
Module- os = <module 'os' (frozen)>
- encode(inputs)
- forward(texts)
- class world_engine.model.world_model.ControllerInputEmbedding(*args: Any, **kwargs: Any)[source]
Bases:
Module
- class world_engine.model.world_model.MLPFusion(*args: Any, **kwargs: Any)[source]
Bases:
ModuleFuses per-group conditioning into tokens by applying an MLP to cat([x, cond])
- class world_engine.model.world_model.CondHead(*args: Any, **kwargs: Any)[source]
Bases:
ModulePer-layer conditioning head: bias_in → SiLU → Linear → chunk(n_cond).
- n_cond = 6
- class world_engine.model.world_model.WorldDiTBlock(*args: Any, **kwargs: Any)[source]
Bases:
Module
- class world_engine.model.world_model.WorldModel(*args: Any, **kwargs: Any)[source]
Bases:
BaseModelWORLD: Wayfarer Operator-driven Rectified-flow Long-context Diffuser
Denoise a frame given - All previous frames - The prompt embedding - The controller input embedding - The current noise level
- forward(x, sigma, frame_timestamp, prompt_emb=None, prompt_pad_mask=None, mouse=None, button=None, scroll=None, kv_cache=None, ctrl_cond=None, prompt_cond=None)[source]
x: [B, N, C, H, W], sigma: [B, N] frame_timestamp: [B, N] prompt_emb: [B, P, D] controller_inputs: [B, N, I] ctrl_cond: Inference only, whether to apply controller conditioning
world_engine.model.nn
world_engine.model.attn
- class world_engine.model.attn.RoPE(*args: Any, **kwargs: Any)[source]
Bases:
NoCastModule- forward(x, pos_ids)
- class world_engine.model.attn.OrthoRoPE(*args: Any, **kwargs: Any)[source]
Bases:
RoPERoPE for rotation across orthogonal axes: time, height, and width Time: Geometric Spectrum – rotates 1/2 of head dim Height / Width: Linear Spectrum – rotates 1/4th of head dim each (1/2 combined)
world_engine.model.kv_cache
- world_engine.model.kv_cache.make_block_mask(T, L, written)[source]
T: Q length for this frame L: KV capacity == written.numel() written: [L] bool, True where there is valid KV data
- Return type:
BlockMask
Patch Model
world_engine.patch_model
- class world_engine.patch_model.CachedDenoiseStepEmb(base, sigmas)[source]
Bases:
Modulebf16 sigma -> bf16 embedding via 64k LUT; invalid sigma => OOB index error (no silent wrong).
- class world_engine.patch_model.CachedCondHead(base, cached_denoise_step_emb, max_key_dims=8)[source]
Bases:
Modulebf16 cond -> cached (s0,b0,g0,s1,b1,g1); invalid cond => OOB index error (no silent wrong).
Autoencoder Neural Network Components
world_engine.ae_nn
- class world_engine.ae_nn.ResBlock(ch)[source]
Bases:
Module- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class world_engine.ae_nn.LandscapeToSquare(ch_in, ch_out)[source]
Bases:
Module- __init__(ch_in, ch_out)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class world_engine.ae_nn.Downsample(ch_in, ch_out)[source]
Bases:
Module- __init__(ch_in, ch_out)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class world_engine.ae_nn.DownBlock(ch_in, ch_out, num_res=1)[source]
Bases:
Module- __init__(ch_in, ch_out, num_res=1)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class world_engine.ae_nn.SpaceToChannel(ch_in, ch_out)[source]
Bases:
Module- __init__(ch_in, ch_out)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class world_engine.ae_nn.ChannelAverage(ch_in, ch_out)[source]
Bases:
Module- __init__(ch_in, ch_out)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class world_engine.ae_nn.SquareToLandscape(ch_in, ch_out)[source]
Bases:
Module- __init__(ch_in, ch_out)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class world_engine.ae_nn.Upsample(ch_in, ch_out)[source]
Bases:
Module- __init__(ch_in, ch_out)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class world_engine.ae_nn.UpBlock(ch_in, ch_out, num_res=1)[source]
Bases:
Module- __init__(ch_in, ch_out, num_res=1)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class world_engine.ae_nn.ChannelToSpace(ch_in, ch_out)[source]
Bases:
Module- __init__(ch_in, ch_out)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class world_engine.ae_nn.ChannelDuplication(ch_in, ch_out)[source]
Bases:
Module- __init__(ch_in, ch_out)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class world_engine.ae_nn.Encoder(config)[source]
Bases:
Module- __init__(config)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class world_engine.ae_nn.Decoder(config)[source]
Bases:
Module- __init__(config)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class world_engine.ae_nn.AutoEncoder(encoder_config, decoder_config=None)[source]
Bases:
Module- __init__(encoder_config, decoder_config=None)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.