Use Token Critic for improved generation
mainYou can improve generation quality by using a TokenCritic. This involves training an extra critic to decide which tokens to iteratively mask during sampling.
Alternatively, you can use MaskGit itself as a self-critic by setting self_token_critic = True when initializing Phenaki.
from phenaki_pytorch import CViViT, MaskGit, TokenCritic, Phenaki
# ... setup cvivit and maskgit ...
# 1. Define the critic
critic = TokenCritic(
num_tokens = 65536,
max_seq_len = 1024,
dim = 512,
dim_context = 768,
depth = 6,
has_cross_attn = True
)
# 2. Pass critic into Phenaki
trainer = Phenaki(
maskgit = maskgit,
cvivit = cvivit,
critic = critic
).cuda()
# OR: Use MaskGit as a self-critic
# phenaki = Phenaki(cvivit=cvivit, maskgit=maskgit, self_token_critic=True)