Skip to content

Commit

Permalink
Save batch to disk on exception. (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored May 6, 2022
1 parent 00c48ec commit 32f05c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions egs/librispeech/ASR/pruned_transducer_stateless2/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ def scan_pessimistic_batches_for_oom(
loss.backward()
optimizer.step()
optimizer.zero_grad()
except RuntimeError as e:
except Exception as e:
if "CUDA out of memory" in str(e):
logging.error(
"Your GPU ran out of memory with the current "
Expand All @@ -1010,7 +1010,7 @@ def scan_pessimistic_batches_for_oom(
f"Failing criterion: {criterion} "
f"(={crit_values[criterion]}) ..."
)
display_and_save_batch(batch, params=params, sp=sp)
display_and_save_batch(batch, params=params, sp=sp)
raise


Expand Down

0 comments on commit 32f05c0

Please sign in to comment.