Text-to-Text Models
4 nodes
On this page 4
Load Text-to-Text Model
FunctionLoads a text-to-text model and its tokenizer from a Hub repository or a folder.
Signature
LoadTextToTextModel -> Text To Text Model
model: Text
device: Compute Device
precision: PrecisionTextToTextModel LoadTextToTextModel(
string model,
ComputeDevice device = ComputeDevice.Auto,
Precision precision = Precision.Auto)Parameters
| name | type | default | description |
|---|---|---|---|
| model | Text | — | A repository id such as google-t5/t5-small or google/flan-t5-small, or a folder. |
| device | Compute Device | Auto | Where it runs. |
| precision | Precision | Auto | The number format of its weights. |
Returns
| Model | Text To Text Model |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text-to-Text Models
- Package
- Machine Learning
Summarize
FunctionA shorter text saying what a longer one says.
Signature
Summarize -> Text
model: Text To Text Model
text: Text
settings: Generation Settings
cleanUpSpaces: Truthstring Summarize(
TextToTextModel model,
string text,
GenerationSettings settings,
bool cleanUpSpaces = true)Parameters
| name | type | default | description |
|---|---|---|---|
| model | Text To Text Model | — | A text-to-text model trained to summarize, such as T5 or BART-CNN. |
| text | Text | — | The text to summarize. |
| settings | Generation Settings | — | How it chooses its words; empty for the model's summarization settings. |
| cleanUpSpaces | Truth | True | Remove the spaces the tokenizer leaves before punctuation and in contractions ("building . it" becomes "building. it"), as transformers' clean_up_tokenization does; off for the text byte for byte as transformers' pipeline gives it. |
Returns
| Summary | Text |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text-to-Text Models
- Package
- Machine Learning
Transform Text
FunctionThe model's answer to a text as it is, with no task prefix: what instruction-tuned models such as Flan-T5 are asked with.
Signature
TransformText -> Text
model: Text To Text Model
input: Text
settings: Generation Settings
cleanUpSpaces: Truthstring TransformText(
TextToTextModel model,
string input,
GenerationSettings settings,
bool cleanUpSpaces = true)Parameters
| name | type | default | description |
|---|---|---|---|
| model | Text To Text Model | — | A text-to-text model. |
| input | Text | — | The instruction or text. |
| settings | Generation Settings | — | How it chooses its words; empty for the model's own defaults. |
| cleanUpSpaces | Truth | True | Remove the spaces the tokenizer leaves before punctuation and in contractions ("building . it" becomes "building. it"), as transformers' clean_up_tokenization does; off for the text byte for byte as transformers' pipeline gives it. |
Returns
| Output | Text |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text-to-Text Models
- Package
- Machine Learning
Translate
FunctionTranslates a text from one language to another, asked as T5 is asked: "translate English to German: ".
Signature
Translate -> Text
model: Text To Text Model
text: Text
from: Text
to: Text
settings: Generation Settings
cleanUpSpaces: Truthstring Translate(
TextToTextModel model,
string text,
string from = "English",
string to = "German",
GenerationSettings settings,
bool cleanUpSpaces = true)Parameters
| name | type | default | description |
|---|---|---|---|
| model | Text To Text Model | — | A text-to-text model that translates between the two languages, such as T5 (English to German, French or Romanian) or Flan-T5. |
| text | Text | — | The text to translate. |
| from | Text | English | The language it is in, in English: English, German... |
| to | Text | German | The language to translate it to. |
| settings | Generation Settings | — | How it chooses its words; empty for the model's translation settings. |
| cleanUpSpaces | Truth | True | Remove the spaces the tokenizer leaves before punctuation and in contractions ("building . it" becomes "building. it"), as transformers' clean_up_tokenization does; off for the text byte for byte as transformers' pipeline gives it. |
Returns
| Translation | Text |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text-to-Text Models
- Package
- Machine Learning