mirror of https://github.com/coqui-ai/TTS.git
Add gc.collect()
This commit is contained in:
parent
490af290d3
commit
e9a2c0606a
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
import gc
|
||||||
import torchaudio
|
import torchaudio
|
||||||
import pandas
|
import pandas
|
||||||
from faster_whisper import WhisperModel
|
from faster_whisper import WhisperModel
|
||||||
|
@ -152,7 +153,8 @@ def format_audio_list(audio_files, target_language="en", out_path=None, buffer=0
|
||||||
df_eval = df_eval.sort_values('audio_file')
|
df_eval = df_eval.sort_values('audio_file')
|
||||||
df_eval.to_csv(eval_metadata_path, sep="|", index=False)
|
df_eval.to_csv(eval_metadata_path, sep="|", index=False)
|
||||||
|
|
||||||
# deallocate VRAM
|
# deallocate VRAM and RAM
|
||||||
del asr_model, df_train, df_eval, df, metadata
|
del asr_model, df_train, df_eval, df, metadata
|
||||||
|
gc.collect()
|
||||||
|
|
||||||
return train_metadata_path, eval_metadata_path, audio_total_size
|
return train_metadata_path, eval_metadata_path, audio_total_size
|
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
import gc
|
||||||
|
|
||||||
from trainer import Trainer, TrainerArgs
|
from trainer import Trainer, TrainerArgs
|
||||||
|
|
||||||
|
@ -164,7 +165,8 @@ def train_gpt(language, num_epochs, batch_size, grad_acumm, train_csv, eval_csv,
|
||||||
|
|
||||||
trainer_out_path = trainer.output_path
|
trainer_out_path = trainer.output_path
|
||||||
|
|
||||||
# deallocate VRAM
|
# deallocate VRAM and RAM
|
||||||
del model, trainer, train_samples, eval_samples
|
del model, trainer, train_samples, eval_samples
|
||||||
|
gc.collect()
|
||||||
|
|
||||||
return XTTS_CONFIG_FILE, XTTS_CHECKPOINT, TOKENIZER_FILE, trainer_out_path, speaker_ref
|
return XTTS_CONFIG_FILE, XTTS_CHECKPOINT, TOKENIZER_FILE, trainer_out_path, speaker_ref
|
||||||
|
|
Loading…
Reference in New Issue