INNER CODE UNIT · Python
next_token_logits
FoundationVision/Liquid · evaluation/app.py:241
next_token_logits = outputs.logits[:, -1:, :]
if guidance_scale>1:
cond_logits, uncond_logits = torch.split(next_token_logits, len(next_token_logits) // 2, dim=0)
cfg_logits = uncond_logits + (cond_logits - uncond_logits) * guidance_scale
half_next_token, _ = sample(cfg_logits, **sampling_kwargs)
pred_tokens.append(half_next_token)
next_token = torch.cat([half_next_token,half_next_token])
else:
next_token, next_prob = sample(next_token_logits, **sampling_kwargs)
pred_tokens.append(next_token)
# update generated ids, model inputs, and length for next step
input_ids = torch.cat([input_ids, next_token], dim=-1)
model_kwargs = vqllm._update_model_kwargs_for_generation(
outputs,