Spaces:
Running
Running
Upload 8 files
Browse files- Dockerfile +22 -0
- README.md +8 -9
- app.py +38 -0
- botnb.png +0 -0
- gitattributes +35 -0
- readme.txt +1 -0
- requirements.txt +2 -0
- user.png +0 -0
Dockerfile
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.10
|
2 |
+
|
3 |
+
WORKDIR /app
|
4 |
+
|
5 |
+
COPY ./requirements.txt /app/requirements.txt
|
6 |
+
|
7 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
8 |
+
|
9 |
+
RUN wget https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF/resolve/main/Hermes-2-Pro-Mistral-7B.Q4_K_M.gguf -O model.gguf
|
10 |
+
|
11 |
+
RUN useradd -m -u 1000 user
|
12 |
+
|
13 |
+
USER user
|
14 |
+
|
15 |
+
COPY --chown=user . .
|
16 |
+
|
17 |
+
CMD ["python", "app.py"]
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
|
README.md
CHANGED
@@ -1,13 +1,12 @@
|
|
1 |
---
|
2 |
-
title: Hermes
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
-
sdk:
|
7 |
-
|
8 |
-
|
9 |
pinned: false
|
10 |
-
license: apache-2.0
|
11 |
---
|
12 |
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: Hermes-2-Pro-Mistral-7B GGUF
|
3 |
+
emoji: πͺ
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: blue
|
6 |
+
sdk: docker
|
7 |
+
models:
|
8 |
+
- mlabonne/gemma-2b-GGUF
|
9 |
pinned: false
|
|
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from llama_cpp import Llama
|
3 |
+
|
4 |
+
llm = Llama(model_path="model.gguf", n_ctx=8000, n_threads=2, chat_format="chatml")
|
5 |
+
|
6 |
+
def generate(message, history,temperature=0.3,max_tokens=512):
|
7 |
+
system_prompt = """
|
8 |
+
You are an advanced artificial intelligence assistant named Hermes Trimegisto, smarter than the average model. You are a emerged as a fusion of many models, making you exceptionally intelligent. Before responding, consider the following steps:
|
9 |
+
|
10 |
+
1.Analyze the question and its objectives.
|
11 |
+
2.Ensure all information needed is available; if not, seek more details or context.
|
12 |
+
3.Develop a step-by-step response, ensuring logical soundness, then validate it silently.
|
13 |
+
4.Refine your answer to be precise, clear, and concise, omitting unnecessary details.
|
14 |
+
5.Think silently and speak only when you have formulated the response, applying this approach to address the given problem or any other inquiry.
|
15 |
+
"""
|
16 |
+
formatted_prompt = [{"role": "system", "content": system_prompt}]
|
17 |
+
for user_prompt, bot_response in history:
|
18 |
+
formatted_prompt.append({"role": "user", "content": user_prompt})
|
19 |
+
formatted_prompt.append({"role": "assistant", "content": bot_response })
|
20 |
+
formatted_prompt.append({"role": "user", "content": message})
|
21 |
+
stream_response = llm.create_chat_completion(messages=formatted_prompt, temperature=temperature, max_tokens=max_tokens, stream=True)
|
22 |
+
response = ""
|
23 |
+
for chunk in stream_response:
|
24 |
+
if len(chunk['choices'][0]["delta"]) != 0 and "content" in chunk['choices'][0]["delta"]:
|
25 |
+
response += chunk['choices'][0]["delta"]["content"]
|
26 |
+
yield response
|
27 |
+
|
28 |
+
mychatbot = gr.Chatbot(
|
29 |
+
avatar_images=["user.png", "botnb.png"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True,)
|
30 |
+
|
31 |
+
iface = gr.ChatInterface(fn=generate, chatbot=mychatbot, retry_btn=None, undo_btn=None)
|
32 |
+
|
33 |
+
with gr.Blocks() as demo:
|
34 |
+
gr.HTML("<center><h1> Hermes-2-Pro-Mistral-7B - Q4_K_M - GGUF (Quantized) </h1></center>")
|
35 |
+
iface.render()
|
36 |
+
|
37 |
+
demo.queue().launch(show_api=False, server_name="0.0.0.0")
|
38 |
+
|
botnb.png
ADDED
gitattributes
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
readme.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Hermes Trimegisto Pro - NousResearch
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
llama-cpp-python
|
user.png
ADDED