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

Add per request sampling support. #195

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add per request sampling support. #195

wants to merge 4 commits into from

Conversation

wang2yn84
Copy link
Collaborator

@wang2yn84 wang2yn84 commented Oct 21, 2024

Supports sampling from request. When user set sampling_algorithm to '', each request can send the sampler config which contains algorithm, temperature, topk, nucleus to enable different sampling strategy. We don't have a good way to support random user provided sampling function yet due to the limitation of Jit compilation.

There will be a coming PR to enable it from JetStream side for the e2e workflow to work.

@wang2yn84 wang2yn84 requested a review from qihqi October 21, 2024 20:53
def _weighted_sampling(self, logits, rng, temperature):
return jax.random.categorical(rng, logits / temperature)

def _nucleus_sampling(self, logits, rng, temperature, nucleus_topp):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we replace 'nucleus sampling' with 'top-p sampling'? The latter is easier to understand because the name clearly refers the top p.

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.

3 participants