danidanidani commited on
Commit
e78ae74
·
1 Parent(s): 003d8ec

Update src/backend/chatbot.py

Browse files
Files changed (1) hide show
  1. src/backend/chatbot.py +22 -21
src/backend/chatbot.py CHANGED
@@ -26,27 +26,28 @@ model = 'Llama2-7B_CPP'
26
 
27
 
28
  # initialize model
29
- if model == 'Llama2-7B_CPP':
30
- model_path = "/Users/dheym/Library/CloudStorage/OneDrive-Personal/Documents/side_projects/GRDN/src/models/llama-2-7b-chat.Q4_K_M.gguf"
31
- llm = LlamaCPP(
32
- # You can pass in the URL to a GGML model to download it automatically
33
- #model_url=model_url,
34
- # optionally, you can set the path to a pre-downloaded model instead of model_url
35
- model_path=model_path,
36
- temperature=0.1,
37
- max_new_tokens=1000,
38
- # llama2 has a context window of 4096 tokens, but we set it lower to allow for some wiggle room
39
- context_window=3000,
40
- # kwargs to pass to __call__()
41
- generate_kwargs={},
42
- # kwargs to pass to __init__()
43
- # set to at least 1 to use GPU
44
- model_kwargs={"n_gpu_layers": 1},
45
- # transform inputs into Llama2 format
46
- messages_to_prompt=messages_to_prompt,
47
- completion_to_prompt=completion_to_prompt,
48
- verbose=True,
49
- )
 
50
 
51
  def parse_and_evaluate_text(text):
52
  # Find the indices of the opening and closing brackets
 
26
 
27
 
28
  # initialize model
29
+ if st.session_state.demo_lite = False:
30
+ if model == 'Llama2-7B_CPP':
31
+ model_path = "/Users/dheym/Library/CloudStorage/OneDrive-Personal/Documents/side_projects/GRDN/src/models/llama-2-7b-chat.Q4_K_M.gguf"
32
+ llm = LlamaCPP(
33
+ # You can pass in the URL to a GGML model to download it automatically
34
+ #model_url=model_url,
35
+ # optionally, you can set the path to a pre-downloaded model instead of model_url
36
+ model_path=model_path,
37
+ temperature=0.1,
38
+ max_new_tokens=1000,
39
+ # llama2 has a context window of 4096 tokens, but we set it lower to allow for some wiggle room
40
+ context_window=3000,
41
+ # kwargs to pass to __call__()
42
+ generate_kwargs={},
43
+ # kwargs to pass to __init__()
44
+ # set to at least 1 to use GPU
45
+ model_kwargs={"n_gpu_layers": 1},
46
+ # transform inputs into Llama2 format
47
+ messages_to_prompt=messages_to_prompt,
48
+ completion_to_prompt=completion_to_prompt,
49
+ verbose=True,
50
+ )
51
 
52
  def parse_and_evaluate_text(text):
53
  # Find the indices of the opening and closing brackets