From 0d2769d2d4df79cb22d7e69e4babd4278ca49a12 Mon Sep 17 00:00:00 2001 From: liuyuang Date: Tue, 7 Jun 2022 11:26:15 +0800 Subject: [PATCH] handle index error for dataloader --- .gitignore | 1 + ppcls/static/program.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index d8f8bca6ec..f1e7651dab 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ build/ log/ nohup.out .DS_Store +.idea diff --git a/ppcls/static/program.py b/ppcls/static/program.py index 7f2313a58f..a6a80f13e0 100644 --- a/ppcls/static/program.py +++ b/ppcls/static/program.py @@ -371,6 +371,11 @@ def run(dataloader, "Except RuntimeError when reading data from dataloader, try to read once again..." ) continue + except IndexError: + logger.warning( + "Except IndexError when reading data from dataloader, try to read once again..." + ) + continue idx += 1 # ignore the warmup iters if idx == 5: