Unverified Commit 3f96e0b4 authored by Joao Gante's avatar Joao Gante Committed by GitHub
Browse files

Generate: add API warning to streamers (#22659)

add API warning
parent f3341926
...@@ -145,6 +145,12 @@ The `generate()` supports streaming, through its `streamer` input. The `streamer ...@@ -145,6 +145,12 @@ The `generate()` supports streaming, through its `streamer` input. The `streamer
from a class that has the following methods: `put()` and `end()`. Internally, `put()` is used to push new tokens and from a class that has the following methods: `put()` and `end()`. Internally, `put()` is used to push new tokens and
`end()` is used to flag the end of text generation. `end()` is used to flag the end of text generation.
<Tip warning={true}>
The API for the streamer classes is still under development and may change in the future.
</Tip>
In practice, you can craft your own streaming class for all sorts of purposes! We also have basic streaming classes In practice, you can craft your own streaming class for all sorts of purposes! We also have basic streaming classes
ready for you to use. For example, you can use the [`TextStreamer`] class to stream the output of `generate()` into ready for you to use. For example, you can use the [`TextStreamer`] class to stream the output of `generate()` into
your screen, one word at a time: your screen, one word at a time:
......
...@@ -39,6 +39,12 @@ class TextStreamer(BaseStreamer): ...@@ -39,6 +39,12 @@ class TextStreamer(BaseStreamer):
""" """
Simple text streamer that prints the token(s) to stdout as soon as entire words are formed. Simple text streamer that prints the token(s) to stdout as soon as entire words are formed.
<Tip warning={true}>
The API for the streamer classes is still under development and may change in the future.
</Tip>
Parameters: Parameters:
tokenizer (`AutoTokenizer`): tokenizer (`AutoTokenizer`):
The tokenized used to decode the tokens. The tokenized used to decode the tokens.
...@@ -128,6 +134,12 @@ class TextIteratorStreamer(TextStreamer): ...@@ -128,6 +134,12 @@ class TextIteratorStreamer(TextStreamer):
useful for applications that benefit from acessing the generated text in a non-blocking way (e.g. in an interactive useful for applications that benefit from acessing the generated text in a non-blocking way (e.g. in an interactive
Gradio demo). Gradio demo).
<Tip warning={true}>
The API for the streamer classes is still under development and may change in the future.
</Tip>
Parameters: Parameters:
tokenizer (`AutoTokenizer`): tokenizer (`AutoTokenizer`):
The tokenized used to decode the tokens. The tokenized used to decode the tokens.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment