元編程參考文件

語音模型

5 個節點

本頁內容 5

載入語音識別器

函數

Loads a speech recognizer, its feature extractor and its tokenizer from a Hub repository or a folder.

簽名
載入語音識別器 -> Speech Recognizer
    模型: 文字
    裝置: Compute Device
    精度: Precision
    後端: Model Backend
SpeechRecognizer LoadSpeechRecognizer(
    string model,
    ComputeDevice device = ComputeDevice.Auto,
    Precision precision = Precision.Auto,
    ModelBackend backend = ModelBackend.TorchSharp)

參數

名稱型別預設值說明
模型文字—A repository id such as openai/whisper-tiny or facebook/wav2vec2-base-960h, or for the ONNX backend onnx-community/whisper-tiny (onnx-community/whisper-tiny_timestamped for word times) or Xenova/wav2vec2-base-960h; or a folder.
裝置Compute Device自動Where it runs on TorchSharp.
精度Precision自動The number format of its weights on TorchSharp.
後端Model BackendTorchSharpWhat runs it: TorchSharp, or the ONNX backend on the CPU, which reads the repository's ONNX files or builds a graph from its checkpoint.

返回

識別器Speech Recognizer
所屬發行版
元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
語音模型
所屬包
機器學習

轉寫

函數

What is said in a clip, as text.

簽名
轉寫 -> 文字
    識別器: Speech Recognizer
    音訊: WAVAudioPayload
    語言: 文字
    設定: Transcription Settings
string Transcribe(
    SpeechRecognizer recognizer,
    WAVAudioPayload audio,
    string language,
    TranscriptionSettings settings)

參數

名稱型別預設值說明
識別器Speech Recognizer—A speech recognizer.
音訊WAVAudioPayload—The clip, at the recognizer's sample rate (16000 Hz for Whisper); Resample converts one that is not. Stereo is mixed to mono.
語言文字—For Whisper, the language spoken, such as en or english; empty to let it tell.
設定Transcription Settings—For Whisper, a prompt and temperature fallback, from Make Transcription Settings.

返回

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

轉寫檔案

函數

What is said in a WAV file, as text.

簽名
轉寫檔案 -> 文字
    識別器: Speech Recognizer
    路徑: 文字
    語言: 文字
    設定: Transcription Settings
string TranscribeFile(
    SpeechRecognizer recognizer,
    string path,
    string language,
    TranscriptionSettings settings)

參數

名稱型別預設值說明
識別器Speech Recognizer—A speech recognizer.
路徑文字—A WAV file at the recognizer's sample rate.
語言文字—For Whisper, the language spoken; empty to let it tell.
設定Transcription Settings—For Whisper, a prompt and temperature fallback, from Make Transcription Settings.

返回

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

帶時間轉寫

函數

What is said in a clip, in the segments the recognizer heard, with when each starts and ends.

簽名
帶時間轉寫 -> (片段: 文字陣列, 起始: 數字陣列, 結束: 數字陣列)
    識別器: Speech Recognizer
    音訊: WAVAudioPayload
    語言: 文字
    設定: Transcription Settings
string[] TranscribeWithTimes(
    SpeechRecognizer recognizer,
    WAVAudioPayload audio,
    string language,
    out double[] starts,
    out double[] ends,
    TranscriptionSettings settings)

參數

名稱型別預設值說明
識別器Speech Recognizer—A speech recognizer.
音訊WAVAudioPayload—The clip, at the recognizer's sample rate.
語言文字—For Whisper, the language spoken; empty to let it tell.
設定Transcription Settings—For Whisper, a prompt and temperature fallback, from Make Transcription Settings.

返回

片段文字陣列
起始數字陣列
結束數字陣列
所屬發行版
元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
語音模型
所屬包
機器學習

逐詞轉寫

函數

What is said in a clip, word by word, with when each word starts and ends: for subtitles that follow the voice, or to find where a word was said.

簽名
逐詞轉寫 -> (詞語: 文字陣列, 起始: 數字陣列, 結束: 數字陣列)
    識別器: Speech Recognizer
    音訊: WAVAudioPayload
    語言: 文字
    設定: Transcription Settings
string[] TranscribeWords(
    SpeechRecognizer recognizer,
    WAVAudioPayload audio,
    string language,
    TranscriptionSettings settings,
    out double[] starts,
    out double[] ends)

參數

名稱型別預設值說明
識別器Speech Recognizer—A speech recognizer. Whisper on the ONNX backend needs files with cross-attention outputs, such as onnx-community/whisper-tiny_timestamped.
音訊WAVAudioPayload—The clip, at the recognizer's sample rate.
語言文字—For Whisper, the language spoken; empty to let it tell.
設定Transcription Settings—For Whisper, a prompt and temperature fallback, from Make Transcription Settings.

返回

詞語文字陣列
起始數字陣列
結束數字陣列
所屬發行版
元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
語音模型
所屬包
機器學習