Spaces:
Running
Running
minor
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ import uuid
|
|
11 |
import json
|
12 |
|
13 |
# Constants
|
14 |
-
SYSTEM_PROMPT = """You are a helpful assistant."""
|
15 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
TITLE = "<h1><center>SmallThinker-3B Chat</center></h1>"
|
17 |
MODEL_PATH = "PowerInfer/SmallThinker-3B-Preview"
|
@@ -64,8 +64,8 @@ logs_file = Path("logs/") / f"data_{uuid.uuid4()}.json"
|
|
64 |
logs_folder = logs_file.parent
|
65 |
|
66 |
# scheduler = CommitScheduler(
|
67 |
-
# repo_id=
|
68 |
-
# repo_type="
|
69 |
# folder_path=logs_folder,
|
70 |
# path_in_repo="data",
|
71 |
# every=5,
|
@@ -81,7 +81,7 @@ def stream_chat(
|
|
81 |
max_new_tokens: int = 1024,
|
82 |
top_p: float = 1.0,
|
83 |
top_k: int = 20,
|
84 |
-
repetition_penalty: float = 1.
|
85 |
):
|
86 |
# Create new history list with current message
|
87 |
new_history = history + [[message, ""]]
|
@@ -156,8 +156,8 @@ def main():
|
|
156 |
)
|
157 |
|
158 |
with gr.Accordion(label="⚙️ Parameters", open=False):
|
159 |
-
temperature = gr.Slider(minimum=0, maximum=1, step=0.1, value=0.
|
160 |
-
max_new_tokens = gr.Slider(minimum=128, maximum=32768, step=128, value=
|
161 |
top_p = gr.Slider(minimum=0.0, maximum=1.0, step=0.1, value=0.8, label="Top-p")
|
162 |
top_k = gr.Slider(minimum=1, maximum=100, step=1, value=20, label="Top-k")
|
163 |
repetition_penalty = gr.Slider(minimum=1.0, maximum=2.0, step=0.1, value=1.1, label="Repetition penalty")
|
|
|
11 |
import json
|
12 |
|
13 |
# Constants
|
14 |
+
SYSTEM_PROMPT = """You are SmallThinker-3B, a helpful AI assistant. You try to follow instructions as much as possible while being accurate and brief."""
|
15 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
TITLE = "<h1><center>SmallThinker-3B Chat</center></h1>"
|
17 |
MODEL_PATH = "PowerInfer/SmallThinker-3B-Preview"
|
|
|
64 |
logs_folder = logs_file.parent
|
65 |
|
66 |
# scheduler = CommitScheduler(
|
67 |
+
# repo_id=logs_id,
|
68 |
+
# repo_type="dataset",
|
69 |
# folder_path=logs_folder,
|
70 |
# path_in_repo="data",
|
71 |
# every=5,
|
|
|
81 |
max_new_tokens: int = 1024,
|
82 |
top_p: float = 1.0,
|
83 |
top_k: int = 20,
|
84 |
+
repetition_penalty: float = 1.1,
|
85 |
):
|
86 |
# Create new history list with current message
|
87 |
new_history = history + [[message, ""]]
|
|
|
156 |
)
|
157 |
|
158 |
with gr.Accordion(label="⚙️ Parameters", open=False):
|
159 |
+
temperature = gr.Slider(minimum=0, maximum=1, step=0.1, value=0.3, label="Temperature")
|
160 |
+
max_new_tokens = gr.Slider(minimum=128, maximum=32768, step=128, value=1024, label="Max new tokens")
|
161 |
top_p = gr.Slider(minimum=0.0, maximum=1.0, step=0.1, value=0.8, label="Top-p")
|
162 |
top_k = gr.Slider(minimum=1, maximum=100, step=1, value=20, label="Top-k")
|
163 |
repetition_penalty = gr.Slider(minimum=1.0, maximum=2.0, step=0.1, value=1.1, label="Repetition penalty")
|