Spaces:
NLPark
/
Runtime error

Cran-May commited on
Commit
558a253
1 Parent(s): 614ec62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -2,23 +2,25 @@ import gradio as gr
2
  from gpt4all import GPT4All
3
  from huggingface_hub import hf_hub_download
4
 
5
- title = "S O L A R"
6
  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/openchat-3.5-0106-GGUF"
11
- model_name = "openchat-3.5-0106.Q4_K_M.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
@@ -27,7 +29,7 @@ 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):
 
2
  from gpt4all import GPT4All
3
  from huggingface_hub import hf_hub_download
4
 
5
+ title = "安风"
6
  description = """
7
+ Infer service
8
  """
9
 
10
+ model_path = "tastypear/CausalLM-7B-DPO-alpha-GGUF"
11
+ model_name = "causallm_7b-dpo-alpha.Q4_K_M.gguf"
12
+ hf_hub_download(repo_id="tastypear/CausalLM-7B-DPO-alpha-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"] = '''<|im_start|>user
19
+ {0}<|im_end|>
20
+ <|im_start|>assistant
21
 
22
  '''
23
+ model.config["systemPrompt"] = "You are a helpful assistant named 安风."
24
  model._is_chat_session_activated = True
25
 
26
  max_new_tokens = 2048
 
29
  prompt = ""
30
  for user_message, assistant_message in history:
31
  prompt += model.config["promptTemplate"].format(user_message)
32
+ prompt += assistant_message + "<|im_end|>"
33
  prompt += model.config["promptTemplate"].format(message)
34
  outputs = []
35
  for token in model.generate(prompt=prompt, temp=temperature, top_k = top_k, top_p = top_p, max_tokens = max_new_tokens, streaming=True):