Upload eduport_tts_mal.py with huggingface_hub
Browse files- eduport_tts_mal.py +2 -1
eduport_tts_mal.py
CHANGED
@@ -6,6 +6,7 @@ from transformers import Wav2Vec2Processor, Wav2Vec2Model
|
|
6 |
import torchaudio
|
7 |
from sklearn.model_selection import train_test_split
|
8 |
from torchaudio.transforms import Resample
|
|
|
9 |
|
10 |
# Compute max audio length from the training dataset
|
11 |
def compute_max_audio_length(audio_files, resampler, target_sampling_rate):
|
@@ -210,4 +211,4 @@ def train_model(num_epochs=10):
|
|
210 |
print(f'Epoch {epoch}: Train Loss: {train_loss / len(train_loader)}, Val Loss: {val_loss / len(val_loader)}')
|
211 |
|
212 |
# Run the training
|
213 |
-
train_model()
|
|
|
6 |
import torchaudio
|
7 |
from sklearn.model_selection import train_test_split
|
8 |
from torchaudio.transforms import Resample
|
9 |
+
from torch.amp import GradScaler, autocast
|
10 |
|
11 |
# Compute max audio length from the training dataset
|
12 |
def compute_max_audio_length(audio_files, resampler, target_sampling_rate):
|
|
|
211 |
print(f'Epoch {epoch}: Train Loss: {train_loss / len(train_loader)}, Val Loss: {val_loss / len(val_loader)}')
|
212 |
|
213 |
# Run the training
|
214 |
+
train_model()
|