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

Support LMContext with temperature=0 #25

Open
gabegrand opened this issue Jan 10, 2025 · 0 comments
Open

Support LMContext with temperature=0 #25

gabegrand opened this issue Jan 10, 2025 · 0 comments
Assignees

Comments

@gabegrand
Copy link
Collaborator

There are cases (e.g., testing / debugging) where it's useful to sample with temperature=0.

However, currently, LMContext requires 0 < temperature < infinity:

temp (float): temeprature for next-token distribution (0 < temp < float('inf'))

Setting it to 0 results in a zero-division error:

self.next_token_logprobs = log_softmax(
lm.next_token_logprobs_unbatched(self.tokens) / temp
)

Is there a reason why in principle we can't support temperature=0?

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