Relation between logit value and generated ids

from matplotlib import pyplot as plt

fig = plt.figure(figsize=(18, 14))

prepare image for the model

for i, example in enumerate(dataset):
image = example[“image”]
inputs = processor(images=image, return_tensors=“pt”).to(device)
pixel_values = inputs.pixel_values

# Generate captions
generated_ids = model.generate(pixel_values=pixel_values, max_length=50)

# Adjust logits before decoding
outputs = model(input_ids=generated_ids, pixel_values=pixel_values)
logits = outputs.logits
logits += 0.01  # Adding 0.01 to logits

# Re-generate captions with adjusted logits
adjusted_generated_ids = model.generate(pixel_values=pixel_values, logits=logits, max_length=50)
generated_caption = processor.decode(adjusted_generated_ids[0], skip_special_tokens=True)

fig.add_subplot(2, 3, i+1)
plt.title(f"Generated caption: {generated_caption}")

“If I change the logit value, does this alter my caption and generated IDs? If yes, how can I update the generated IDs after modifying the logit value?”