@@ -221,8 +221,9 @@ def build_llamacpp():
221
221
222
222
def run_inference ():
223
223
build_dir = get_llamacpp_build_dir ()
224
- model_name = f"{ os .path .split (FLAGS .model_dir )[- 1 ]} .{ str (FLAGS .inference_type ).upper ()} .gguf"
225
- out_path = os .path .join (FLAGS .model_dir , model_name )
224
+ model_dir = str (FLAGS .model_dir ).rstrip ('\\ ' ).rstrip ('/' )
225
+ model_name = f"{ os .path .split (model_dir )[- 1 ]} .{ str (FLAGS .inference_type ).upper ()} .gguf"
226
+ out_path = os .path .join (model_dir , model_name )
226
227
if is_win ():
227
228
main_path = os .path .join (build_dir , "bin" , "Release" , "llama-cli.exe" )
228
229
if not os .path .exists (main_path ):
@@ -240,7 +241,7 @@ def run_inference():
240
241
run_adb_command (command , build_dir )
241
242
remote_out_path = os .path .join (
242
243
FLAGS .remote_dir ,
243
- f"{ os .path .basename (FLAGS . model_dir )} -{ os .path .basename (out_path )} " ,
244
+ f"{ os .path .basename (model_dir )} -{ os .path .basename (out_path )} " ,
244
245
)
245
246
if not FLAGS .skip_push_model :
246
247
command = ['push' , out_path , remote_out_path ]
@@ -277,8 +278,9 @@ def run_inference():
277
278
278
279
def run_llama_bench ():
279
280
build_dir = get_llamacpp_build_dir ()
280
- model_name = f"{ os .path .split (FLAGS .model_dir )[- 1 ]} .{ str (FLAGS .inference_type ).upper ()} .gguf"
281
- out_path = os .path .join (FLAGS .model_dir , model_name )
281
+ model_dir = str (FLAGS .model_dir ).rstrip ('\\ ' ).rstrip ('/' )
282
+ model_name = f"{ os .path .split (model_dir )[- 1 ]} .{ str (FLAGS .inference_type ).upper ()} .gguf"
283
+ out_path = os .path .join (model_dir , model_name )
282
284
if is_win ():
283
285
main_path = os .path .join (build_dir , "bin" , "Release" , "llama-bench.exe" )
284
286
if not os .path .exists (main_path ):
@@ -296,7 +298,7 @@ def run_llama_bench():
296
298
run_adb_command (command , build_dir )
297
299
remote_out_path = os .path .join (
298
300
FLAGS .remote_dir ,
299
- f"{ os .path .basename (FLAGS . model_dir )} -{ os .path .basename (out_path )} " ,
301
+ f"{ os .path .basename (model_dir )} -{ os .path .basename (out_path )} " ,
300
302
)
301
303
if not FLAGS .skip_push_model :
302
304
command = ['push' , out_path , remote_out_path ]
0 commit comments