Feature Extraction
Transformers
Safetensors
English
usad2
automatic-speech-recognition
audio-classification
audio
speech
music
custom_code
Instructions to use MIT-SLS/USAD2-Large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MIT-SLS/USAD2-Large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="MIT-SLS/USAD2-Large", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("MIT-SLS/USAD2-Large", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
fix `self.pe` init issue
Browse files- usad_modules.py +7 -0
usad_modules.py
CHANGED
|
@@ -367,6 +367,13 @@ class RelPositionalEncoding(nn.Module):
|
|
| 367 |
self.pe = None
|
| 368 |
|
| 369 |
def extend_pe(self, x: torch.Tensor) -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
if self.pe is not None:
|
| 371 |
if self.pe.size(1) >= x.size(1) * 2 - 1:
|
| 372 |
if self.pe.dtype != x.dtype or self.pe.device != x.device:
|
|
|
|
| 367 |
self.pe = None
|
| 368 |
|
| 369 |
def extend_pe(self, x: torch.Tensor) -> None:
|
| 370 |
+
# ``from_pretrained`` can initialize modules on the meta device while it
|
| 371 |
+
# streams checkpoint weights. This runtime cache is not checkpoint
|
| 372 |
+
# state, so a meta tensor cannot be materialized with ``Tensor.to``.
|
| 373 |
+
# Drop it and rebuild it below for the actual input device instead.
|
| 374 |
+
if self.pe is not None and self.pe.is_meta:
|
| 375 |
+
self.pe = None
|
| 376 |
+
|
| 377 |
if self.pe is not None:
|
| 378 |
if self.pe.size(1) >= x.size(1) * 2 - 1:
|
| 379 |
if self.pe.dtype != x.dtype or self.pe.device != x.device:
|