-
Notifications
You must be signed in to change notification settings - Fork 259
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
[Widgets] Don't call api inference if output exists #1063
Conversation
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.
The logic is not implemented for most widgets. Is that intended?
async function getOutput({ | ||
withModelLoading = false, | ||
isOnLoadCall = false, | ||
exampleOutput = undefined, |
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.
This has no effect in this widget
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.
yes, because widgets such as AudioToAudio or ImageSegmentation are not expected to have example.output
in their model cards
for example here
hub-docs/js/src/lib/components/InferenceWidget/widgets/AudioToAudioWidget/AudioToAudioWidget.svelte
Line 131 in e5cdf0a
function applyInputSample(sample: WidgetExampleAssetInput, opts: ExampleRunOpts = {}) { |
example.output
, the typing would have been sample: WidgetExampleAssetInput<WIDGET OUTPUT TYPE>
docs here for the list of supported output types: https://huggingface.co/docs/hub/models-widgets#example-outputs from #978
@julien-c could you confirm this statement
yes, because widgets such as AudioToAudio or ImageSegmentation are not expected to have
example.output
in their model cards
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 i understand, i'm a bit lost...
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.
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.
Here is what I meant:
At the current state of widgets, uses can supply output
in their modelcard for any widget. However, only subset of widgets will show/use that example output
AudioToAudio or ImageSegmentation should support a file output
But in the current implementation, AudioToAudio or ImageSegmentation do neither validation nor usage of output
Should I open a PR (extend the current PR) to make all the remaining widgets validate and use output
?
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.
As we discussed internally, lets merge this PR without the proposed changes above (remaining widgets validate and use output
). And iterate in subseq PRs
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.
Should I open a PR (extend the current PR) to make all the remaining widgets validate and use
output
?
Yes
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.
that was the goal to support output
for all widgets
Closes #1011
This PR is continuation of #1017
Follow up to #979
#979 correctly implemented behaviour for the previewInputSample function here. Which is: don't call api-inference if
sample.output
existsThe same should be the case for
applyInputSample
(which is this PR). Don't call api-inference ifsample.output
exists. #1011 happened because api-inference was called and there was no cached example althoughsample.output
was in the repoOrder of merge operations