Spaces:
Running
Running
prep gguf
Browse files
app.py
CHANGED
@@ -1,13 +1,9 @@
|
|
1 |
-
"""Template Demo for IBM Granite Hugging Face spaces."""
|
2 |
-
|
3 |
from collections.abc import Iterator
|
4 |
from datetime import datetime
|
5 |
from pathlib import Path
|
6 |
from threading import Thread
|
7 |
|
8 |
import gradio as gr
|
9 |
-
import torch
|
10 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
11 |
|
12 |
from themes.research_monochrome import theme
|
13 |
|
@@ -16,7 +12,7 @@ today_date = datetime.today().strftime("%B %-d, %Y") # noqa: DTZ002
|
|
16 |
SYS_PROMPT = f"""Knowledge Cutoff Date: April 2024.
|
17 |
Today's Date: {today_date}.
|
18 |
You are Granite, developed by IBM. You are a helpful AI assistant"""
|
19 |
-
TITLE = "IBM Granite 3.1 8b Instruct"
|
20 |
DESCRIPTION = """
|
21 |
<p>Granite 3.1 8b instruct is an open-source LLM supporting a 128k context window. Start with one of the sample prompts
|
22 |
or enter your own. Keep in mind that AI can occasionally make mistakes.
|
@@ -32,12 +28,10 @@ TOP_P = 0.85
|
|
32 |
TOP_K = 50
|
33 |
REPETITION_PENALTY = 1.05
|
34 |
|
35 |
-
#
|
36 |
-
# "ibm-granite/granite-3.1-8b-instruct", torch_dtype=torch.float16, device_map="auto"
|
37 |
-
#)
|
38 |
-
#tokenizer = AutoTokenizer.from_pretrained("ibm-granite/granite-3.1-8b-instruct")
|
39 |
-
#tokenizer.use_default_system_prompt = False
|
40 |
|
|
|
|
|
41 |
|
42 |
def generate(
|
43 |
message: str,
|
@@ -88,7 +82,6 @@ def generate(
|
|
88 |
|
89 |
|
90 |
css_file_path = Path(Path(__file__).parent / "app.css")
|
91 |
-
head_file_path = Path(Path(__file__).parent / "app_head.html")
|
92 |
|
93 |
# advanced settings (displayed in Accordion)
|
94 |
temperature_slider = gr.Slider(
|
|
|
|
|
|
|
1 |
from collections.abc import Iterator
|
2 |
from datetime import datetime
|
3 |
from pathlib import Path
|
4 |
from threading import Thread
|
5 |
|
6 |
import gradio as gr
|
|
|
|
|
7 |
|
8 |
from themes.research_monochrome import theme
|
9 |
|
|
|
12 |
SYS_PROMPT = f"""Knowledge Cutoff Date: April 2024.
|
13 |
Today's Date: {today_date}.
|
14 |
You are Granite, developed by IBM. You are a helpful AI assistant"""
|
15 |
+
TITLE = "IBM Granite 3.1 8b Instruct from local GGUF server"
|
16 |
DESCRIPTION = """
|
17 |
<p>Granite 3.1 8b instruct is an open-source LLM supporting a 128k context window. Start with one of the sample prompts
|
18 |
or enter your own. Keep in mind that AI can occasionally make mistakes.
|
|
|
28 |
TOP_K = 50
|
29 |
REPETITION_PENALTY = 1.05
|
30 |
|
31 |
+
# download GGUF into local directory
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
# chmod llama-server
|
34 |
+
# start llama-server
|
35 |
|
36 |
def generate(
|
37 |
message: str,
|
|
|
82 |
|
83 |
|
84 |
css_file_path = Path(Path(__file__).parent / "app.css")
|
|
|
85 |
|
86 |
# advanced settings (displayed in Accordion)
|
87 |
temperature_slider = gr.Slider(
|