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

Stop generating text after period #211

Open
rmallick6806 opened this issue Feb 18, 2023 · 1 comment
Open

Stop generating text after period #211

rmallick6806 opened this issue Feb 18, 2023 · 1 comment

Comments

@rmallick6806
Copy link

How do I get it to stop generating any more text after a marker like a period? Would be super helpful since it generates lots of incomplete sentences currently.

@Vectorrent
Copy link
Contributor

eos = ai.tokenizer.convert_tokens_to_ids(ai.tokenizer.tokenize('.')[0])
completion = ai.generate(
    eos_token_id=eos,
)

That will stop generation immediately upon hitting the eos (end-of-sentence) token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants