Skip to content

Commit 70b36f8

Browse files
Enable llama-tornado python script to automatically find gpu-llama3.jar version
1 parent b05a075 commit 70b36f8

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

llama-tornado

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Run LLM models using either OpenCL or PTX backends.
55
"""
66

77
import argparse
8+
import glob
89
import os
910
import subprocess
1011
import sys
@@ -171,14 +172,32 @@ class LlamaRunner:
171172
module_config.extend(
172173
[
173174
"-cp",
174-
f"{self.llama_root}/target/gpu-llama3-2.1.0-SNAPSHOT.jar",
175+
self._find_llama_jar(),
175176
"org.beehive.gpullama3.LlamaApp",
176177
]
177178
)
178179
cmd.extend(module_config)
179180

180181
return cmd
181182

183+
def _find_llama_jar(self) -> str:
184+
"""Find the LLaMA JAR file automatically using glob pattern."""
185+
target_dir = f"{self.llama_root}/target"
186+
jar_pattern = f"{target_dir}/gpu-llama3-*-SNAPSHOT.jar"
187+
jar_files = glob.glob(jar_pattern)
188+
189+
if not jar_files:
190+
# Fallback: try any gpu-llama3 jar
191+
jar_pattern = f"{target_dir}/gpu-llama3-*.jar"
192+
jar_files = glob.glob(jar_pattern)
193+
194+
if not jar_files:
195+
raise FileNotFoundError(f"No gpu-llama3 JAR file found in {target_dir}")
196+
197+
# Sort to get the latest version if multiple exist
198+
jar_files.sort(reverse=True)
199+
return jar_files[0]
200+
182201
def _add_llama_args(self, cmd: List[str], args: argparse.Namespace) -> List[str]:
183202
"""Add LLaMA-specific arguments to the command."""
184203
llama_args = [

0 commit comments

Comments
 (0)