-
Notifications
You must be signed in to change notification settings - Fork 266
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] Enable streaming in the conversational widget #486
Changes from 7 commits
bb2eba4
79fcfa3
679e367
e4961b8
b271568
cda8353
1576a53
83dba35
119114b
f23e873
b0a4b26
98b8229
350f69e
0b708f2
72340e9
55b73a3
d369c83
77e3880
1bbdaea
471a2b1
78196e5
28f1b8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||
<script lang="ts"> | ||||||
import { updateWidgetState } from "../../stores.js"; | ||||||
import { tgiSupportedModels, updateWidgetState } from "../../stores.js"; | ||||||
import { TASKS_DATA } from "@huggingface/tasks"; | ||||||
import type { WidgetExample, WidgetExampleAttribute } from "@huggingface/tasks"; | ||||||
import type { WidgetProps, ExampleRunOpts } from "../types.js"; | ||||||
|
@@ -66,15 +66,23 @@ | |||||
</div> | ||||||
<div class="mb-0.5 flex w-full max-w-full flex-wrap items-center justify-between text-sm text-gray-500"> | ||||||
{#if pipeline && task} | ||||||
<a | ||||||
class={TASKS_DATA[task] ? "hover:underline" : undefined} | ||||||
href={TASKS_DATA[task] ? `/tasks/${task}` : undefined} | ||||||
target="_blank" | ||||||
title={TASKS_DATA[task] ? `Learn more about ${task}` : undefined} | ||||||
> | ||||||
<PipelineTag classNames="mr-2 mb-1.5" {pipeline} /> | ||||||
</a> | ||||||
<div class="flex gap-4 items-center mb-1.5"> | ||||||
<a | ||||||
class={TASKS_DATA[task] ? "hover:underline" : undefined} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
didn't test. Can we use the new svelte syntax? |
||||||
href={TASKS_DATA[task] ? `/tasks/${task}` : undefined} | ||||||
target="_blank" | ||||||
title={TASKS_DATA[task] ? `Learn more about ${task}` : undefined} | ||||||
> | ||||||
<PipelineTag {pipeline} /> | ||||||
</a> | ||||||
{#if $tgiSupportedModels?.has(model.id)} | ||||||
<p class="text-xs text-gray-400"> | ||||||
Streaming with <a href="https://huggingface.co/docs/text-generation-inference" class="underline">TGI</a> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
made it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @gary149 |
||||||
</p> | ||||||
SBrandeis marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
{/if} | ||||||
</div> | ||||||
{/if} | ||||||
|
||||||
{#if validExamples.length && applyWidgetExample} | ||||||
<WidgetExamples {validExamples} {isLoading} {applyWidgetExample} {callApiOnMount} {exampleQueryParams} /> | ||||||
{/if} | ||||||
|
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
TextGenerationStreamOutput
live in@huggingface/tasks/src/tasks/text-generation/inference
just likeTextGenerationInput
&TextGenerationOutput
?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.
Good question - cc @Wauplin with whom we discussed that previously
The current philosophy is to not type the streaming mode because it's transfer-specific, not inference-specific
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.
Indeed, we mentioned it here once: #468 (comment).
As a matter of fact, I came to the conclusion today that we should specify the
stream
parameter and the streamed output in our JS specs. I am currently starting to use the generated types in Python (see ongoing PR) and for now I've kepttext_generation
apart since I'm missingTextGenerationStreamResponse
(defined here but I don't want to mix the auto-generated types with previous definitions). Agree it's more "transfer-specific" rather than "inference-specific" but the thing is that settingstream=True
is modifying the output format so we need to document that somewhere.