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

select - Multiple Selection #301

Open
albernar opened this issue Jul 4, 2023 · 4 comments
Open

select - Multiple Selection #301

albernar opened this issue Jul 4, 2023 · 4 comments

Comments

@albernar
Copy link

albernar commented Jul 4, 2023

Would it be possible to extend select so that it can return the top_n best options out of a list of options instead of only returning the best one?

A cumbersome alternative is to wrap the selection within #geneach and use a function remove_option that removes the selected answer from the list of options after each selection:

"""
{{#geneach 'item' num_iterations=top_n join=', '}}
{{select 'ans' options=valid_options}}
{{~#block hidden=True}}{{remove_option ans valid_options}}{{~/block}}
{{/geneach}}
"""

However, this is highly inefficient, as it does not leverage the fact that, if the current best option shares the initial part of the encoding with other words, in future iterations it does make sense to focus only on the words sharing that part of the encoding.
For example, say we have 'airplane' encoded by [200, 203], 'aircraft' by [200, 206] and 'boat' by [99, 100]. 'airplane' is selected as the best option. At this point, we know that token 200 is better than 99, so during the next selection, it does not make sense to check again whether 'boat' could be the best option, because we already know that the first token to be selected would be 200.

@tepesalexandru
Copy link

I also need this feature in the project I'm currently working on.

@MichaelOwenDyer
Copy link

Agree, would like to see this added

@NickSmet
Copy link

I suppose it would make sense to have 2 modes:

  • top N options;
  • all options based on a logprob threshold value.

@fangpings
Copy link

This would be very useful for our use case

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

5 participants