快捷方式

HDemucs

class torchaudio.models.HDemucs(sources: List[str], audio_channels: int = 2, channels: int = 48, growth: int = 2, nfft: int = 4096, depth: int = 6, freq_emb: float = 0.2, emb_scale: int = 10, emb_smooth: bool = True, kernel_size: int = 8, time_stride: int = 2, stride: int = 4, context: int = 1, context_enc: int = 0, norm_starts: int = 4, norm_groups: int = 4, dconv_depth: int = 2, dconv_comp: int = 4, dconv_attn: int = 4, dconv_lstm: int = 4, dconv_init: float = 0.0001)[source]

來自 Hybrid Spectrogram and Waveform Source Separation [Défossez, 2021] 的 Hybrid Demucs 模型。

另請參閱

引數:
  • sources (List[str]) – 源名稱列表。列表可包含以下源選項:["bass", "drums", "other", "mixture", "vocals"]。

  • audio_channels (int, optional) – 輸入/輸出音訊通道數。(預設值: 2)

  • channels (int, optional) – 初始隱藏通道數。(預設值: 48)

  • growth (int, optional) – 在每個層增加隱藏通道數的因子。(預設值: 2)

  • nfft (int, optional) – FFT bins 的數量。請注意,更改此值需要仔細計算各種形狀引數,對於混合模型,這不會直接生效。(預設值: 4096)

  • depth (int, optional) – 編碼器和解碼器中的層數。(預設值: 6)

  • freq_emb (float, optional) – 如果大於 0,則在第一個頻率層後新增頻率嵌入,實際值控制嵌入的權重。(預設值: 0.2)

  • emb_scale (int, optional) – 相當於縮放嵌入學習率。(預設值: 10)

  • emb_smooth (bool, optional) – 使用平滑嵌入(相對於頻率)初始化嵌入。(預設值: True)

  • kernel_size (int, optional) – 編碼器和解碼器層的 kernel_size。(預設值: 8)

  • time_stride (int, optional) – 合併後的最終時間層的 stride。(預設值: 2)

  • stride (int, optional) – 編碼器和解碼器層的 stride。(預設值: 4)

  • context (int, optional) – 解碼器中 1x1 卷積的上下文。(預設值: 4)

  • context_enc (int, optional) – 編碼器中 1x1 卷積的上下文。(預設值: 0)

  • norm_starts (int, optional) – 開始使用組歸一化的層。解碼器層按相反順序編號。(預設值: 4)

  • norm_groups (int, optional) – 組歸一化的組數。(預設值: 4)

  • dconv_depth (int, optional) – 殘差 DConv 分支的深度。(預設值: 2)

  • dconv_comp (int, optional) – DConv 分支的壓縮因子。(預設值: 4)

  • dconv_attn (int, optional) – 從此層開始在 DConv 分支中添加註意力層。(預設值: 4)

  • dconv_lstm (int, optional) – 從此層開始在 DConv 分支中新增一個 LSTM 層。(預設值: 4)

  • dconv_init (float, optional) – DConv 分支 LayerScale 的初始比例。(預設值: 1e-4)

使用 HDemucs 的教程
Music Source Separation with Hybrid Demucs

使用 Hybrid Demucs 進行音樂源分離

使用 Hybrid Demucs 進行音樂源分離

方法

forward

HDemucs.forward(input: Tensor)[source]

HDemucs 前向傳播呼叫

引數:

input (torch.Tensor) – 輸入混合張量,形狀為 (batch_size, channel, num_frames)

返回:

張量

輸出張量,拆分為源,形狀為 (batch_size, num_sources, channel, num_frames)

工廠函式

hdemucs_low

構建低 nfft (1024) 版本的 HDemucs,適用於大約 8 kHz 的取樣率。

hdemucs_medium

構建中等 nfft (2048) 版本的 HDemucs,適用於 16-32 kHz 的取樣率。

hdemucs_high

構建高 nfft (4096) 版本的 HDemucs,適用於 44.1-48 kHz 的取樣率。

文件

訪問 PyTorch 全面開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源