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

Define non-positive temperature behavior #720

Merged
merged 1 commit into from
Apr 3, 2023

Conversation

ivanstepanovftw
Copy link
Collaborator

Fixes #684.

@ivanstepanovftw
Copy link
Collaborator Author

Original LLaMA's generate defines temperature like so:

        if temperature > 0:
            probs = torch.softmax(logits / temperature, dim=-1)
            next_token = sample(probs, top_p=top_p, top_k=top_k)
        else:
            next_token = torch.argmax(logits, dim=-1)

@prusnak
Copy link
Collaborator

prusnak commented Apr 2, 2023

@abetlen can you please also test this one?

@abetlen
Copy link
Collaborator

abetlen commented Apr 2, 2023

@prusnak tested and can confirm this works as well.

@prusnak prusnak merged commit cd7fa95 into ggml-org:master Apr 3, 2023
Copy link
Contributor

@Fabio3rs Fabio3rs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This alternative seems to me to harmonize better with the rest of the code

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

Successfully merging this pull request may close these issues.

Setting temp=0 does not work as expected
4 participants