Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

[TGA] Factual Nucleus Sampling #4890

Merged
merged 4 commits into from
Nov 29, 2022
Merged

[TGA] Factual Nucleus Sampling #4890

merged 4 commits into from
Nov 29, 2022

Conversation

klshuster
Copy link
Contributor

Patch description
Factual nucleus is a decoding method that decays the nucleus sampling p value over time according to a constant factor lambda_decay. The p value resets when encountering a full-stop (when p_reset is True), and there is a lower bound of omega_bound to what p can decay to.

Testing steps
Added Factual Nucleus to the existing tree search tests.

@@ -1777,7 +1817,7 @@ def __init__(self, *args, **kwargs):
raise ValueError('Greedy search can only be run with beam size 1.')

def select_paths(self, logprobs, prior_scores, current_length) -> _PathSelection:
tok_scores, tok_ids = logprobs.max(1)
tok_scores, tok_ids = logprobs
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know this code well. I don't understand why did you have to change this part? isn't this for greedy? And I don't find any indication that the general code was changed to justify changing this part.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, this is an artifact, will fix

Copy link
Contributor

@mojtaba-komeili mojtaba-komeili left a comment

Choose a reason for hiding this comment

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

Seems good to me. Thanks for adding.

device=device,
verbose=verbose,
dict=self.dict,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

is gpu_beam_blocking needed as in other sampling methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, will add thanks

@klshuster klshuster merged commit 07ba788 into main Nov 29, 2022
@klshuster klshuster deleted the factual_nucleus branch November 29, 2022 20:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants