molbal commited on
Commit
312ff65
·
1 Parent(s): 90002cf

Update to use the proper model

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +12 -8
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Cra V1 7b
3
  emoji: 💬
4
  colorFrom: yellow
5
  colorTo: purple
 
1
  ---
2
+ title: CRA-v1-7B (on CPU)
3
  emoji: 💬
4
  colorFrom: yellow
5
  colorTo: purple
app.py CHANGED
@@ -4,8 +4,7 @@ from huggingface_hub import InferenceClient
4
  """
5
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
  """
7
- client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
-
9
 
10
  def respond(
11
  message,
@@ -15,7 +14,10 @@ def respond(
15
  temperature,
16
  top_p,
17
  ):
18
- messages = [{"role": "system", "content": system_message}]
 
 
 
19
 
20
  for val in history:
21
  if val[0]:
@@ -33,32 +35,34 @@ def respond(
33
  stream=True,
34
  temperature=temperature,
35
  top_p=top_p,
 
 
36
  ):
37
  token = message.choices[0].delta.content
38
 
39
  response += token
40
  yield response
41
 
42
-
43
  """
44
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
45
  """
46
  demo = gr.ChatInterface(
47
  respond,
48
  additional_inputs=[
49
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
50
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
51
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
52
  gr.Slider(
53
  minimum=0.1,
54
  maximum=1.0,
55
- value=0.95,
56
  step=0.05,
57
  label="Top-p (nucleus sampling)",
58
  ),
59
  ],
60
  )
61
 
 
62
 
63
- if __name__ == "__main__":
64
- demo.launch()
 
4
  """
5
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
  """
7
+ client = InferenceClient("molbal/CRA-v1-7B")
 
8
 
9
  def respond(
10
  message,
 
14
  temperature,
15
  top_p,
16
  ):
17
+ messages = [
18
+ {"role": "system", "content": "You are a writer’s assistant."},
19
+ {"role": "system", "content": system_message},
20
+ ]
21
 
22
  for val in history:
23
  if val[0]:
 
35
  stream=True,
36
  temperature=temperature,
37
  top_p=top_p,
38
+ num_ctx=16384,
39
+ repeat_penalty=1.05,
40
  ):
41
  token = message.choices[0].delta.content
42
 
43
  response += token
44
  yield response
45
 
 
46
  """
47
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
48
  """
49
  demo = gr.ChatInterface(
50
  respond,
51
  additional_inputs=[
52
+ gr.Textbox(value="Understand how the story flows, what motivations the characters have and how they will interact with each other and the world as a step by step thought process before continuing the story.", label="System message"),
53
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
54
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
55
  gr.Slider(
56
  minimum=0.1,
57
  maximum=1.0,
58
+ value=0.8,
59
  step=0.05,
60
  label="Top-p (nucleus sampling)",
61
  ),
62
  ],
63
  )
64
 
65
+ demo.launch()
66
 
67
+ # Add an alert to mention that this runs on CPU
68
+ gr.Markdown("**Note: This model runs on CPU, so it will be slow.**")