-
Notifications
You must be signed in to change notification settings - Fork 5k
Adding in NewContextWithStrategy for go binding #2948
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
Conversation
Adding in NewContextWithStrategy, a function to allow you to specify the strategy when initializing the context. NewContext will use this "helper" function so that users don't need to think about what strategy they're specifying by default. I'm also doing it this way (instead of a function that sets the strategy) because the basis of what parameters we populate the context with is determined by the strategy we are using, so it needs to be done in the beginning of creating the context.
|
I'm not sure if you want this, but I need to swap what strategy we use easily and figured it was useful, so I'd push it up and let you decide. |
danbev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about these changes but perhaps we need to make the API more flexible. One thing I noticed is that Whisper_init does not take a whisper.Params which the java binding does. Perhaps that would be an option here as well.
| return model.NewContextWithStrategy(SAMPLING_GREEDY) | ||
| } | ||
|
|
||
| func (model *model) NewContextWithStrategy(strategy SamplingStrategy) (Context, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps instead of passing in just the strategy to this function, it could accepts a parameter of type whisper.Params?
| // Make sure model adheres to the interface | ||
| var _ Model = (*model)(nil) | ||
|
|
||
| type SamplingStrategy whisper.SamplingStrategy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having this and the globals might be a little confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the other option was to have clients import both versions, but figured that'd be more of a headache. Alright, no worries!
|
Closing this for now as I'm not sure about adding this at the moment, but feel free to re-open. |
Adding in NewContextWithStrategy, a function to allow you to specify the strategy when initializing the context. NewContext will use this "helper" function so that users don't need to think about what strategy they're specifying by default. I'm also doing it this way (instead of a function that sets the strategy) because the basis of what parameters we populate the context with is determined by the strategy we are using, so it needs to be done in the beginning of creating the context.