The Genie2 class is the main entry point for the world model. It is a transformer-based model designed for video generation conditioned on actions. It uses a Vector Quantized (VQ) latent space and can optionally support multiple simultaneous actions.
Key initialization parameters:
dim: Dimension of the transformer tokens.dim_latent: Dimension of the latent space.num_actions: Total number of possible discrete actions. If provided, the model will learn to condition on actions.allow_multiple_actions: If True, allows the model to handle multiple actions per timestep (e.g., multiple keys pressed).max_num_actions: Maximum number of simultaneous actions allowed if allow_multiple_actions is True.vq_kwargs: Dictionary of arguments passed to the VectorQuantize module.encoder / decoder: Custom modules for encoding/decoding states. Defaults to nn.Identity().action_autoregressive_loss_weight: Weight for the loss used to predict future actions.
from genie2_pytorch import Genie
import torch
from torch import nn
model = Genie(
dim = 1024,
dim_latent = 512,
num_actions = 100,
allow_multiple_actions = True,
max_num_actions = 5,
vq_kwargs = dict(
codebook_size = 4096,
)
)