Spaces:
Sleeping
Sleeping
izammohammed
commited on
Commit
•
47f5c71
1
Parent(s):
80f8d1a
Update src/llama_call.py
Browse files- src/llama_call.py +10 -6
src/llama_call.py
CHANGED
@@ -27,13 +27,17 @@ PROMPT = PromptTemplate(
|
|
27 |
chain_type_kwargs = {"prompt": PROMPT}
|
28 |
|
29 |
current_dir = os.getcwd()
|
30 |
-
llm = CTransformers(
|
31 |
-
model=os.path.join(current_dir, "saved_models/llama-2-7b-chat.ggmlv3.q4_0.bin"),
|
32 |
-
model_type="llama",
|
33 |
-
streaming=True,
|
34 |
-
config={"max_new_tokens": 256, "temperature": 0.6, "context_length": -1},
|
35 |
-
)
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
qa = RetrievalQA.from_chain_type(
|
39 |
llm=llm,
|
|
|
27 |
chain_type_kwargs = {"prompt": PROMPT}
|
28 |
|
29 |
current_dir = os.getcwd()
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
+
def load_llm():
|
32 |
+
llm = CTransformers(
|
33 |
+
model="TheBloke/Llama-2-7B-Chat-GGML",
|
34 |
+
model_type="llama",
|
35 |
+
max_new_tokens=512,
|
36 |
+
temperature=0.5
|
37 |
+
)
|
38 |
+
return llm
|
39 |
+
|
40 |
+
llm = load_llm()
|
41 |
|
42 |
qa = RetrievalQA.from_chain_type(
|
43 |
llm=llm,
|