Spaces:
Sleeping
Sleeping
xavierbarbier
commited on
Commit
•
1dbb9f0
1
Parent(s):
daf2060
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
from gpt4all import GPT4All
|
3 |
from huggingface_hub import hf_hub_download
|
|
|
|
|
4 |
|
5 |
title = "Mistral-7B-Instruct-GGUF Run On CPU-Basic Free Hardware"
|
6 |
|
@@ -30,6 +32,14 @@ model._is_chat_session_activated = False
|
|
30 |
|
31 |
max_new_tokens = 2048
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
def generater(message, history, temperature, top_p, top_k):
|
34 |
prompt = "<s>"
|
35 |
for user_message, assistant_message in history:
|
|
|
1 |
import gradio as gr
|
2 |
from gpt4all import GPT4All
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
+
import faiss
|
5 |
+
from langchain_community.embeddings import HuggingFaceEmbeddings
|
6 |
|
7 |
title = "Mistral-7B-Instruct-GGUF Run On CPU-Basic Free Hardware"
|
8 |
|
|
|
32 |
|
33 |
max_new_tokens = 2048
|
34 |
|
35 |
+
model_kwargs = {'device': 'cpu'}
|
36 |
+
encode_kwargs = {'normalize_embeddings': False}
|
37 |
+
embeddings = HuggingFaceEmbeddings(
|
38 |
+
|
39 |
+
model_kwargs=model_kwargs,
|
40 |
+
encode_kwargs=encode_kwargs
|
41 |
+
)
|
42 |
+
|
43 |
def generater(message, history, temperature, top_p, top_k):
|
44 |
prompt = "<s>"
|
45 |
for user_message, assistant_message in history:
|