Remove warnings and add some warnings (#1408)

This commit is contained in:
XXXXRT666
2024-08-06 18:37:55 +08:00
committed by GitHub
parent 2196b2bfc6
commit 805dbd7ff2
5 changed files with 61 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ import librosa
import torch
import torch.nn.functional as F
import soundfile as sf
import os
from transformers import logging as tf_logging
tf_logging.set_verbosity_error()
@@ -24,9 +25,11 @@ cnhubert_base_path = None
class CNHubert(nn.Module):
def __init__(self):
super().__init__()
self.model = HubertModel.from_pretrained(cnhubert_base_path)
if os.path.exists(cnhubert_base_path):...
else:raise FileNotFoundError(cnhubert_base_path)
self.model = HubertModel.from_pretrained(cnhubert_base_path, local_files_only=True)
self.feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(
cnhubert_base_path
cnhubert_base_path, local_files_only=True
)
def forward(self, x):