Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output with higher max_length is repetition of base text #19

Open
azrael05 opened this issue Feb 23, 2024 · 6 comments
Open

Output with higher max_length is repetition of base text #19

azrael05 opened this issue Feb 23, 2024 · 6 comments
Labels
type:support Support issues

Comments

@azrael05
Copy link

While generating any text with a specified value of max_length, the generated text keeps repeating several times until the output spans the value of max_length. An example of the above is using the following code

gemma_lm = keras_nlp.models.GemmaCausalLM.from_preset("gemma_2b_en")
single_prompt_result = gemma_lm.generate("Keras is a", max_length=4096)
print(single_prompt_result)

As you can observe the sentence keeps repeating to span the max_length while it should ideally stop once it has written the base text.
image

The code was run on Kaggle with "gemma_2b_en" model
GPU - P100
To recreate the issue you can run the given code.

@pengchongjin
Copy link
Collaborator

Could you please try the instruction-tuned model instead? It should give you better results.

@azrael05
Copy link
Author

Could you please try the instruction-tuned model instead? It should give you better results.

Thanks, With the instruct tuned model the output is perfect.

Btw is there any reason why the gemma_2b_en model produced repetitive output instead ks stopping ?.

@pengchongjin
Copy link
Collaborator

pengchongjin commented Feb 24, 2024

It's kind of expected that the pre-trained models only try to complete text. Maybe one way you could try is to tune the sampling parameters to see if you can get a bit diversity in the output.

@AbhishekJ24
Copy link

I am just happy to be a part of this chat

@azrael05
Copy link
Author

azrael05 commented Feb 25, 2024

It's kind of expected that the pre-trained models only try to complete text. Maybe one way you could try is to tune the sampling parameters to see if you can get a bit diversity in the output.

Yeah, Its expected of it to complete the text but still shouldn't repeat its text right?
Example the other text generation models might produce half ending sentence outputs depending on the max_length size but they don't producr repeating ouputs.

@Ittiz
Copy link

Ittiz commented Feb 27, 2024

I've noticed the 2b model repeating itself as well. Although, I found it does it when the context of my prompt would be hard even for a human to figure out.

@tilakrayal tilakrayal added the type:support Support issues label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:support Support issues
Projects
None yet
Development

No branches or pull requests

5 participants