元编程参考文档

文本到文本模型

4 个节点

本页内容 4

加载文本到文本模型

函数

Loads a text-to-text model and its tokenizer from a Hub repository or a folder.

签名
加载文本到文本模型 -> Text To Text Model
    模型: 文本
    设备: Compute Device
    精度: Precision
TextToTextModel LoadTextToTextModel(
    string model,
    ComputeDevice device = ComputeDevice.Auto,
    Precision precision = Precision.Auto)

参数

名称类型默认值说明
模型文本—A repository id such as google-t5/t5-small or google/flan-t5-small, or a folder.
设备Compute Device自动Where it runs.
精度Precision自动The number format of its weights.

返回

模型Text To Text Model
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本到文本模型
所属包
机器学习

摘要

函数

A shorter text saying what a longer one says.

签名
摘要 -> 文本
    模型: Text To Text Model
    文本: 文本
    设置: Generation Settings
    清理空格: 真否
string Summarize(
    TextToTextModel model,
    string text,
    GenerationSettings settings,
    bool cleanUpSpaces = true)

参数

名称类型默认值说明
模型Text To Text Model—A text-to-text model trained to summarize, such as T5 or BART-CNN.
文本文本—The text to summarize.
设置Generation Settings—How it chooses its words; empty for the model's summarization settings.
清理空格真否TrueRemove 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.

返回

摘要文本
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本到文本模型
所属包
机器学习

转换文本

函数

The model's answer to a text as it is, with no task prefix: what instruction-tuned models such as Flan-T5 are asked with.

签名
转换文本 -> 文本
    模型: Text To Text Model
    输入: 文本
    设置: Generation Settings
    清理空格: 真否
string TransformText(
    TextToTextModel model,
    string input,
    GenerationSettings settings,
    bool cleanUpSpaces = true)

参数

名称类型默认值说明
模型Text To Text Model—A text-to-text model.
输入文本—The instruction or text.
设置Generation Settings—How it chooses its words; empty for the model's own defaults.
清理空格真否TrueRemove 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.

返回

输出文本
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本到文本模型
所属包
机器学习

翻译

函数

Translates a text from one language to another, asked as T5 is asked: "translate English to German: ".

签名
翻译 -> 文本
    模型: Text To Text Model
    文本: 文本
    源语言: 文本
    目标语言: 文本
    设置: Generation Settings
    清理空格: 真否
string Translate(
    TextToTextModel model,
    string text,
    string from = "English",
    string to = "German",
    GenerationSettings settings,
    bool cleanUpSpaces = true)

参数

名称类型默认值说明
模型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.
文本文本—The text to translate.
源语言文本EnglishThe language it is in, in English: English, German...
目标语言文本GermanThe language to translate it to.
设置Generation Settings—How it chooses its words; empty for the model's translation settings.
清理空格真否TrueRemove 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.

返回

译文文本
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本到文本模型
所属包
机器学习