kieranadair commited on
Commit
55695f2
·
verified ·
1 Parent(s): aad96ec

Update gigscan/server.py

Browse files
Files changed (1) hide show
  1. gigscan/server.py +9 -2
gigscan/server.py CHANGED
@@ -2,6 +2,7 @@ import subprocess
2
  import threading
3
  import time
4
  from pathlib import Path
 
5
 
6
  import requests
7
  from huggingface_hub import hf_hub_download
@@ -75,6 +76,8 @@ def start_llama_server():
75
  paths, download_s = timed("Model download", download_model_files)
76
  model_path, mmproj_path = paths
77
 
 
 
78
  cmd = [
79
  LLAMA_SERVER,
80
  "-m",
@@ -83,8 +86,6 @@ def start_llama_server():
83
  mmproj_path,
84
  "-c",
85
  "4096",
86
- "-ngl",
87
- "999",
88
  "--reasoning-budget",
89
  "0",
90
  "--host",
@@ -93,6 +94,12 @@ def start_llama_server():
93
  PORT,
94
  ]
95
 
 
 
 
 
 
 
96
  log("Starting llama-server")
97
  log(" ".join(cmd))
98
 
 
2
  import threading
3
  import time
4
  from pathlib import Path
5
+ import os
6
 
7
  import requests
8
  from huggingface_hub import hf_hub_download
 
76
  paths, download_s = timed("Model download", download_model_files)
77
  model_path, mmproj_path = paths
78
 
79
+ use_gpu = os.environ.get("GIGSCAN_USE_GPU", "0") == "1"
80
+
81
  cmd = [
82
  LLAMA_SERVER,
83
  "-m",
 
86
  mmproj_path,
87
  "-c",
88
  "4096",
 
 
89
  "--reasoning-budget",
90
  "0",
91
  "--host",
 
94
  PORT,
95
  ]
96
 
97
+ if use_gpu:
98
+ cmd.extend(["-ngl", "999"])
99
+ log("GPU offload enabled")
100
+ else:
101
+ log("GPU offload disabled; running on CPU")
102
+
103
  log("Starting llama-server")
104
  log(" ".join(cmd))
105