From 32441bf207e1ab1585285a7a8635246de1fd501f Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 6 Mar 2026 11:53:40 +0100 Subject: [PATCH 1/2] fix: explicitly stop models to prevent concurrent loading errors Explicitly calls ollama stop after each run to ensure memory is freed. This prevents the benchmark from failing on systems where Ollama attempts to load multiple models simultaneously, which otherwise leads to resource exhaustion and prevents completion. --- llm_benchmark/run_benchmark.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/llm_benchmark/run_benchmark.py b/llm_benchmark/run_benchmark.py index 7f49e70..bc05c6d 100644 --- a/llm_benchmark/run_benchmark.py +++ b/llm_benchmark/run_benchmark.py @@ -116,7 +116,8 @@ def run_benchmark(models_file_path, benchmark_file_path, type, ollamabin: str = print("-"*40) file1.write("\n"+"-"*40) file1.close() - + print (f"Stopping model {model_name}") + subprocess.run([ollamabin, 'stop', model_name], capture_output=False, text=True, check=True, encoding='utf-8') return ans if __name__ == "__main__": @@ -126,4 +127,5 @@ def run_benchmark(models_file_path, benchmark_file_path, type, ollamabin: str = run_benchmark(args.models, args.benchmark, args.type, args.ollamabin) print('-'*40) - \ No newline at end of file + + From fb7326ee7ea1e9dd917df0262e35ae885bdae81b Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 10 Mar 2026 22:32:54 +0100 Subject: [PATCH 2/2] Refactor run_benchmark.py for improved readability --- llm_benchmark/run_benchmark.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llm_benchmark/run_benchmark.py b/llm_benchmark/run_benchmark.py index bc05c6d..6e95d06 100644 --- a/llm_benchmark/run_benchmark.py +++ b/llm_benchmark/run_benchmark.py @@ -117,7 +117,7 @@ def run_benchmark(models_file_path, benchmark_file_path, type, ollamabin: str = file1.write("\n"+"-"*40) file1.close() print (f"Stopping model {model_name}") - subprocess.run([ollamabin, 'stop', model_name], capture_output=False, text=True, check=True, encoding='utf-8') + subprocess.run([ollamabin, 'stop', model_name], capture_output=False, text=True, check=False, encoding='utf-8') return ans if __name__ == "__main__": @@ -129,3 +129,4 @@ def run_benchmark(models_file_path, benchmark_file_path, type, ollamabin: str = +