def _generate(self, prepared_inputs: Dict[str, Any]) -> str:
        """
        Generates text based on prepared inputs. The text is decoded from token IDs generated by the model.
        """
        inputs = prepared_inputs["inputs"]
        image_size = prepared_inputs["image_size"]
        task = prepared_inputs["prompt"]

        generated_ids = self._model.generate(
            input_ids=inputs["input_ids"],
            pixel_values=inputs["pixel_values"],
            max_new_tokens=self.max_new_tokens,
            num_beams=3,
            do_sample=False,
        )

        generated_text = self._processor.batch_decode(
            generated_ids, skip_special_tokens=False
        )[0]

        # Use image_size from prepared_inputs to avoid storing self.image
        parsed_answer = self._processor.post_process_generation(
            generated_text, task=task, image_size=image_size
        )
        return parsed_answer[task]

        Generates text based on prepared inputs. The text is decoded from token IDs generated by the model.
        
llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-huggingface/llama_index/multi_modal_llms/huggingface/base.py