Spaces:
Sleeping
Sleeping
downloading model manual
Browse files- app.py +21 -1
- download_model.py +7 -0
app.py
CHANGED
@@ -4,9 +4,29 @@ from langchain.chains import LLMChain
|
|
4 |
from langchain.prompts import PromptTemplate
|
5 |
from langchain_community.llms import LlamaCpp
|
6 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
MODEL_PATH = "llama-2-7b-chat.Q5_K_M.gguf"
|
9 |
|
|
|
|
|
|
|
10 |
TEMPLATE = """
|
11 |
|
12 |
You are a helpful AI Assistant created by Mohammed Vasim. Mohammed Vasim is an AI Engineer.
|
@@ -40,7 +60,7 @@ title = "Welcome to Open Source LLM"
|
|
40 |
description = "This is a Llama-2-GGUF"
|
41 |
|
42 |
def answer_query(message, history):
|
43 |
-
message = llm_chain.
|
44 |
return message
|
45 |
|
46 |
# Gradio chat interface
|
|
|
4 |
from langchain.prompts import PromptTemplate
|
5 |
from langchain_community.llms import LlamaCpp
|
6 |
import gradio as gr
|
7 |
+
import os
|
8 |
+
|
9 |
+
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
|
10 |
+
|
11 |
+
REPO = "TheBloke/Llama-2-7B-Chat-GGUF"
|
12 |
+
MODEL_NAME = "llama-2-7b-chat.Q5_K_M.gguf"
|
13 |
+
|
14 |
+
DOWNLOAD_MODEL = f"huggingface-cli download {REPO} {MODEL_NAME} --local-dir . --local-dir-use-symlinks False"
|
15 |
+
|
16 |
+
"""
|
17 |
+
huggingface-cli download \
|
18 |
+
${REPO} \
|
19 |
+
${MODEL_NAME} \
|
20 |
+
--local-dir . \
|
21 |
+
--local-dir-use-symlinks False
|
22 |
+
"""
|
23 |
+
|
24 |
|
25 |
MODEL_PATH = "llama-2-7b-chat.Q5_K_M.gguf"
|
26 |
|
27 |
+
if not os.path.exists(MODEL_PATH):
|
28 |
+
os.system(DOWNLOAD_MODEL)
|
29 |
+
|
30 |
TEMPLATE = """
|
31 |
|
32 |
You are a helpful AI Assistant created by Mohammed Vasim. Mohammed Vasim is an AI Engineer.
|
|
|
60 |
description = "This is a Llama-2-GGUF"
|
61 |
|
62 |
def answer_query(message, history):
|
63 |
+
message = llm_chain.invoke(message)
|
64 |
return message
|
65 |
|
66 |
# Gradio chat interface
|
download_model.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from huggingface_hub import hf_hub_download
|
2 |
+
|
3 |
+
REPO_ID = "TheBloke/Llama-2-7B-Chat-GGUF"
|
4 |
+
FILENAME = "llama-2-7b-chat.Q5_K_M.gguf"
|
5 |
+
|
6 |
+
hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
|
7 |
+
|