Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,9 +15,9 @@ today_date = datetime.today().strftime("%B %-d, %Y") # noqa: DTZ002
|
|
15 |
|
16 |
SYS_PROMPT = f"""Today's Date: {today_date}.
|
17 |
You are Granite, developed by IBM. You are a helpful AI assistant"""
|
18 |
-
TITLE = "IBM Granite
|
19 |
DESCRIPTION = """
|
20 |
-
<p>Granite
|
21 |
<span class="gr_docs_link">
|
22 |
<a href="https://www.ibm.com/granite/docs/">View Documentation <i class="fa fa-external-link"></i></a>
|
23 |
</span>
|
@@ -30,16 +30,30 @@ TOP_P = 0.85
|
|
30 |
TOP_K = 50
|
31 |
REPETITION_PENALTY = 1.05
|
32 |
|
33 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
gguf_path = hf_hub_download(
|
35 |
-
repo_id="
|
36 |
-
filename=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
local_dir="."
|
38 |
-
|
39 |
|
40 |
# start llama-server
|
41 |
-
subprocess.run(["chmod", "+x",
|
42 |
-
command = ["./
|
43 |
process = subprocess.Popen(command)
|
44 |
print(f"Llama-server process started with PID {process.pid}")
|
45 |
|
|
|
15 |
|
16 |
SYS_PROMPT = f"""Today's Date: {today_date}.
|
17 |
You are Granite, developed by IBM. You are a helpful AI assistant"""
|
18 |
+
TITLE = "IBM Granite 4 Tiny Preview served from local GGUF server"
|
19 |
DESCRIPTION = """
|
20 |
+
<p>Granite 4 Tiny is an open-source LLM supporting a 128k context window. This demo uses only 2K context.
|
21 |
<span class="gr_docs_link">
|
22 |
<a href="https://www.ibm.com/granite/docs/">View Documentation <i class="fa fa-external-link"></i></a>
|
23 |
</span>
|
|
|
30 |
TOP_K = 50
|
31 |
REPETITION_PENALTY = 1.05
|
32 |
|
33 |
+
# TODO: determine platform: CUDA or CPU
|
34 |
+
platform = "CPU"
|
35 |
+
|
36 |
+
# login to HF with space secret and download gguf and executable
|
37 |
+
# huggingface-cli login --token hf_xyzxyz
|
38 |
+
|
39 |
+
gguf_name = "SmartQuant-granite-3.3-8b-instruct.gguf"
|
40 |
gguf_path = hf_hub_download(
|
41 |
+
repo_id="TobDeBer/SmartQuant",
|
42 |
+
filename=gguf_name,
|
43 |
+
local_dir="."
|
44 |
+
)
|
45 |
+
|
46 |
+
# TODO: set exe_name depending on platform
|
47 |
+
exe_name = "llama-server-6343-cuda"
|
48 |
+
exe_path = hf_hub_download(
|
49 |
+
repo_id="TobDeBer/SmartQuant",
|
50 |
+
filename=exe_name,
|
51 |
local_dir="."
|
52 |
+
)
|
53 |
|
54 |
# start llama-server
|
55 |
+
subprocess.run(["chmod", "+x", exe_name])
|
56 |
+
command = ["./"+exe_name, "-m", gguf_name, "--temp", "0.0", "-c", "2048", "-t", "8", "--port", "8081"]
|
57 |
process = subprocess.Popen(command)
|
58 |
print(f"Llama-server process started with PID {process.pid}")
|
59 |
|