image = latents_to_rgb(latents[0])
image.save(f"{step}.png")

return callback_kwargs
```  
3. Pass the `decode_tensors` function to the `callback_on_step_end` parameter to decode the tensors after each step. You also need to specify what you want to modify in the `callback_on_step_end_tensor_inputs` parameter, which in this case are the latents.  
```py
from diffusers import AutoPipelineForText2Image
import torch
from PIL import Image