Spaces:
Sleeping
Sleeping
include deepsparse
Browse files- app.py +8 -0
- requirements.txt +2 -1
app.py
CHANGED
@@ -5,6 +5,7 @@ import time
|
|
5 |
from langchain.chains import LLMChain
|
6 |
from langchain.memory import ConversationBufferMemory
|
7 |
from langchain_community.llms import LlamaCpp
|
|
|
8 |
from langchain_experimental.chat_models import Llama2Chat
|
9 |
|
10 |
from langchain.prompts.chat import (
|
@@ -35,6 +36,13 @@ llm = LlamaCpp(
|
|
35 |
temperature=0.75,
|
36 |
max_tokens=64
|
37 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
model = Llama2Chat(llm=llm)
|
39 |
|
40 |
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
|
|
|
5 |
from langchain.chains import LLMChain
|
6 |
from langchain.memory import ConversationBufferMemory
|
7 |
from langchain_community.llms import LlamaCpp
|
8 |
+
from langchain.llms import DeepSparse
|
9 |
from langchain_experimental.chat_models import Llama2Chat
|
10 |
|
11 |
from langchain.prompts.chat import (
|
|
|
36 |
temperature=0.75,
|
37 |
max_tokens=64
|
38 |
)
|
39 |
+
|
40 |
+
llm = DeepSparse(
|
41 |
+
model="zoo:llama2-7b-llama2_chat_llama2_pretrain-base_quantized",
|
42 |
+
model_config={"sequence_length": 2048},
|
43 |
+
stop=["<|im_end|>", "<|endoftext|>"]
|
44 |
+
)
|
45 |
+
|
46 |
model = Llama2Chat(llm=llm)
|
47 |
|
48 |
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
|
requirements.txt
CHANGED
@@ -7,4 +7,5 @@ langchain_community
|
|
7 |
langchain_experimental
|
8 |
llama-cpp-python
|
9 |
unstructured
|
10 |
-
unstructured[local-inference]
|
|
|
|
7 |
langchain_experimental
|
8 |
llama-cpp-python
|
9 |
unstructured
|
10 |
+
unstructured[local-inference]
|
11 |
+
deepsparse-nightly[llm]
|