clementsan
commited on
Commit
•
88fa380
1
Parent(s):
1e93bea
Add Mixtral-8x7B-Instruct-v0.1 model
Browse files
app.py
CHANGED
@@ -20,6 +20,7 @@ import accelerate
|
|
20 |
|
21 |
# default_persist_directory = './chroma_HF/'
|
22 |
|
|
|
23 |
llm_name1 = "mistralai/Mistral-7B-Instruct-v0.2"
|
24 |
llm_name2 = "mistralai/Mistral-7B-Instruct-v0.1"
|
25 |
llm_name3 = "meta-llama/Llama-2-7b-chat-hf"
|
@@ -27,7 +28,7 @@ llm_name4 = "microsoft/phi-2"
|
|
27 |
llm_name5 = "mosaicml/mpt-7b-instruct"
|
28 |
llm_name6 = "tiiuae/falcon-7b-instruct"
|
29 |
llm_name7 = "google/flan-t5-xxl"
|
30 |
-
list_llm = [llm_name1, llm_name2, llm_name3, llm_name4, llm_name5, llm_name6, llm_name7]
|
31 |
list_llm_simple = [os.path.basename(llm) for llm in list_llm]
|
32 |
|
33 |
# Load PDF document and create doc splits
|
@@ -62,7 +63,7 @@ def create_db(splits):
|
|
62 |
def load_db():
|
63 |
embedding = HuggingFaceEmbeddings()
|
64 |
vectordb = Chroma(
|
65 |
-
persist_directory=default_persist_directory,
|
66 |
embedding_function=embedding)
|
67 |
return vectordb
|
68 |
|
@@ -95,7 +96,12 @@ def initialize_llmchain(llm_model, temperature, max_tokens, top_k, vector_db, pr
|
|
95 |
# Use of trust_remote_code as model_kwargs
|
96 |
# Warning: langchain issue
|
97 |
# URL: https://github.com/langchain-ai/langchain/issues/6080
|
98 |
-
if llm_model == "
|
|
|
|
|
|
|
|
|
|
|
99 |
llm = HuggingFaceHub(
|
100 |
repo_id=llm_model,
|
101 |
model_kwargs={"temperature": temperature, "max_new_tokens": max_tokens, "top_k": top_k, "trust_remote_code": True, "torch_dtype": "auto"}
|
|
|
20 |
|
21 |
# default_persist_directory = './chroma_HF/'
|
22 |
|
23 |
+
llm_name0 = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
24 |
llm_name1 = "mistralai/Mistral-7B-Instruct-v0.2"
|
25 |
llm_name2 = "mistralai/Mistral-7B-Instruct-v0.1"
|
26 |
llm_name3 = "meta-llama/Llama-2-7b-chat-hf"
|
|
|
28 |
llm_name5 = "mosaicml/mpt-7b-instruct"
|
29 |
llm_name6 = "tiiuae/falcon-7b-instruct"
|
30 |
llm_name7 = "google/flan-t5-xxl"
|
31 |
+
list_llm = [llm_name0, llm_name1, llm_name2, llm_name3, llm_name4, llm_name5, llm_name6, llm_name7]
|
32 |
list_llm_simple = [os.path.basename(llm) for llm in list_llm]
|
33 |
|
34 |
# Load PDF document and create doc splits
|
|
|
63 |
def load_db():
|
64 |
embedding = HuggingFaceEmbeddings()
|
65 |
vectordb = Chroma(
|
66 |
+
# persist_directory=default_persist_directory,
|
67 |
embedding_function=embedding)
|
68 |
return vectordb
|
69 |
|
|
|
96 |
# Use of trust_remote_code as model_kwargs
|
97 |
# Warning: langchain issue
|
98 |
# URL: https://github.com/langchain-ai/langchain/issues/6080
|
99 |
+
if llm_model == "mistralai/Mixtral-8x7B-Instruct-v0.1":
|
100 |
+
llm = HuggingFaceHub(
|
101 |
+
repo_id=llm_model,
|
102 |
+
model_kwargs={"temperature": temperature, "max_new_tokens": max_tokens, "top_k": top_k, "load_in_8bit": True}
|
103 |
+
)
|
104 |
+
elif llm_model == "microsoft/phi-2":
|
105 |
llm = HuggingFaceHub(
|
106 |
repo_id=llm_model,
|
107 |
model_kwargs={"temperature": temperature, "max_new_tokens": max_tokens, "top_k": top_k, "trust_remote_code": True, "torch_dtype": "auto"}
|