Extract output

#49
by tkaintura - opened

Hi,

I ran the Gemma Model and I use tokenizer.decode(outputs[0]) and it give me the with the input text I have given to the tokenizer and then the output followed by an . Is there any way that I can just get the output as a string without the input text in the generated output?

Google org

Hi @tkaintura , Models will give input text in generated output. To skip it Please follow below solutions:

  1. Use the length of the input tokens to determine where the generated tokens start.
  2. Decode the tokens that follow the input length.

Kindly find the below screenshot for more reference. Thank you.
image (1).png

Sign up or log in to comment