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

Added temperature argument to the Contrastive Sampler #997

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

TheAthleticCoder
Copy link
Contributor

Partially Resolves #987,
I had to change the name of a comment in the documentation from Top-K to Contrastive.
Also, which tests should we add to this sampler? Should I try and add a high temperature versus low temperature based test?

@mattdangerw
Copy link
Member

/gcbrun

@mattdangerw
Copy link
Member

Also, which tests should we add to this sampler? Should I try and add a high temperature versus low temperature based test?

I don't have any bright ideas here, so I think what you have is sufficient. The temperature would harden/soften the probability distribution, which would affect how it plays with the cosine similarity penalty. But I suspect people will tune the alpha parameter rather than this one. "Correctness" in this case seems hard to test.

The main thing we accomplish here is adding universal support for the temperature parameter. So you don't have to worry about one of our samplers erroring out if you are switching sampler methods quickly.

Let's see if @chenmoneygithub has any thoughts, but this LGTM as is.

Copy link
Member

@mattdangerw mattdangerw left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@chenmoneygithub chenmoneygithub left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@chenmoneygithub chenmoneygithub merged commit ac2ce45 into keras-team:master Apr 20, 2023
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.

Add a temperature argument to the Contrastive Sampler
3 participants