元編程參考文件

文字到文字模型

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.

返回

譯文文字
所屬發行版
元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
文字到文字模型
所屬包
機器學習