From 58241b1d71faa262d22eff80aa8c3979dbf5e665 Mon Sep 17 00:00:00 2001 From: Heyang Qin Date: Mon, 29 Jul 2024 14:18:50 -0700 Subject: [PATCH] fix: handle exception when loading cache file in test_inference.py (#5802) This PR is to fix CI failures such as https://github.com/microsoft/DeepSpeed/actions/runs/10085903860/job/27887546470#step:8:3616 cc @tjruwase Co-authored-by: Logan Adams <114770087+loadams@users.noreply.github.com> --- tests/unit/inference/test_inference.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/unit/inference/test_inference.py b/tests/unit/inference/test_inference.py index 76eb88eea560..eadf670d9328 100644 --- a/tests/unit/inference/test_inference.py +++ b/tests/unit/inference/test_inference.py @@ -94,7 +94,10 @@ def _hf_model_list() -> List[ModelInfo]: model_data = {"cache_time": 0, "model_list": []} if os.path.isfile(cache_file_path): with open(cache_file_path, 'rb') as f: - model_data = pickle.load(f) + try: + model_data = pickle.load(f) + except Exception as e: + print(f"Error loading cache file {cache_file_path}: {e}") current_time = time.time()