From f7111b62db4c9c4b9ca22ec183b0258febe60a7f Mon Sep 17 00:00:00 2001 From: Bo Li Date: Thu, 5 Sep 2024 16:22:02 +0000 Subject: [PATCH] chore: Remove unused LM object if model is not an instance of LM --- lmms_eval/evaluator.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lmms_eval/evaluator.py b/lmms_eval/evaluator.py index 05735c79..e177c885 100755 --- a/lmms_eval/evaluator.py +++ b/lmms_eval/evaluator.py @@ -609,6 +609,10 @@ def evaluate( if hasattr(lm, "accelerator"): lm.accelerator.wait_for_everyone() + + if not isinstance(model, lm_eval.api.model.LM): + del lm + return results_dict