Spaces:
NLPark
/
Runtime error

Cran-May commited on
Commit
72e002c
1 Parent(s): 609a1aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -7,25 +7,27 @@ description = """
7
  Is it really that good? Let's see... (Note: This is a Q4 gguf so thst I can run it on the free cpu. Clone and upgrade for a getter version)
8
  """
9
 
10
- model_path = "TheBloke/SOLAR-10.7B-Instruct-v1.0-GGUF"
11
- model_name = "solar-10.7b-instruct-v1.0.Q4_0.gguf"
12
- hf_hub_download(repo_id="TheBloke/SOLAR-10.7B-Instruct-v1.0-GGUF", filename=model_name, local_dir=model_path, local_dir_use_symlinks=True)
13
 
14
  print("Start the model init process")
15
  model = model = GPT4All(model_name, model_path, allow_download = True, device="cpu")
16
  print("Finish the model init process")
17
 
18
- model.config["promptTemplate"] = "[INST] {0} [/INST]"
19
- model.config["systemPrompt"] = "You are a helpful assistant named SOLAR."
 
 
20
  model._is_chat_session_activated = True
21
 
22
  max_new_tokens = 2048
23
 
24
  def generater(message, history, temperature, top_p, top_k):
25
- prompt = "<s>"
26
  for user_message, assistant_message in history:
27
  prompt += model.config["promptTemplate"].format(user_message)
28
- prompt += assistant_message + "</s>"
29
  prompt += model.config["promptTemplate"].format(message)
30
  outputs = []
31
  for token in model.generate(prompt=prompt, temp=temperature, top_k = top_k, top_p = top_p, max_tokens = max_new_tokens, streaming=True):
 
7
  Is it really that good? Let's see... (Note: This is a Q4 gguf so thst I can run it on the free cpu. Clone and upgrade for a getter version)
8
  """
9
 
10
+ model_path = "TheBloke/openchat-3.5-0106-GGUF"
11
+ model_name = "openchat-3.5-0106.Q4_K_S.gguf"
12
+ hf_hub_download(repo_id="TheBloke/openchat-3.5-0106-GGUF", filename=model_name, local_dir=model_path, local_dir_use_symlinks=True)
13
 
14
  print("Start the model init process")
15
  model = model = GPT4All(model_name, model_path, allow_download = True, device="cpu")
16
  print("Finish the model init process")
17
 
18
+ model.config["promptTemplate"] = "GPT4 Correct User: {0}<|end_of_turn|>GPT4 Correct Assistant:
19
+
20
+ "
21
+ model.config["systemPrompt"] = "You are a helpful assistant named 兮辞."
22
  model._is_chat_session_activated = True
23
 
24
  max_new_tokens = 2048
25
 
26
  def generater(message, history, temperature, top_p, top_k):
27
+ prompt = ""
28
  for user_message, assistant_message in history:
29
  prompt += model.config["promptTemplate"].format(user_message)
30
+ prompt += assistant_message + "<|end_of_turn|>"
31
  prompt += model.config["promptTemplate"].format(message)
32
  outputs = []
33
  for token in model.generate(prompt=prompt, temp=temperature, top_k = top_k, top_p = top_p, max_tokens = max_new_tokens, streaming=True):