Unlike autoregressive models (GPT-style) that generate left-to-right, Crimson-LaDa uses iterative denoising: starting from fully masked text, it progressively recovers tokens over multiple steps, allowing the model to revise earlier decisions.
1import torch
2import json
3from model import MDLM, generate
4
5# Load
6model = MDLM()
7ckpt = torch.load("model_final.pt", map_location="cpu")
8model.load_state_dict(ckpt, strict=False)
9model.eval()
10
11# Generate
12output = generate(
13 model, tokenizer,
14 prompt="user: What is the capital of France?\n\nassistant:",
15 max_len=96, steps=64, temperature=0.8
16)
17print(output)