Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

oom fix

游雁001a66bbfe80
diff --git a/funasr/bin/train.py b/funasr/bin/train.py
index b2b1dcdb2..45e23a8c6 100644
--- a/funasr/bin/train.py
+++ b/funasr/bin/train.py
@@ -221,10 +221,10 @@ def main(**kwargs):
)
trainer.start_step = 0
- device = next(model.parameters()).device
- if device.type == 'cuda':
- with torch.cuda.device():
- torch.cuda.empty_cache()
+ # device = next(model.parameters()).device
+ # if device.type == 'cuda':
+ # with torch.cuda.device():
+ # torch.cuda.empty_cache()
time_escaped = (time.perf_counter() - time_slice_i) / 3600.0
logging.info(
diff --git a/funasr/bin/train_ds.py b/funasr/bin/train_ds.py
index bfa1dff94..b28752ba8 100644
--- a/funasr/bin/train_ds.py
+++ b/funasr/bin/train_ds.py
@@ -184,10 +184,10 @@ def main(**kwargs):
)
trainer.start_step = 0
- device = next(model.parameters()).device
- if device.type == 'cuda':
- with torch.cuda.device():
- torch.cuda.empty_cache()
+ # device = next(model.parameters()).device
+ # if device.type == 'cuda':
+ # with torch.cuda.device():
+ # torch.cuda.empty_cache()
time_escaped = (time.perf_counter() - time_slice_i) / 3600.0
logging.info(