pabloce commited on
Commit
8034baa
·
verified ·
1 Parent(s): 22ca4ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -17
app.py CHANGED
@@ -30,11 +30,11 @@ hf_hub_download(
30
  filename="Mistral-7B-Instruct-v0.3-Q6_K.gguf",
31
  local_dir="./models"
32
  )
33
- hf_hub_download(
34
- repo_id="bartowski/Meta-Llama-3-8B-Instruct-GGUF",
35
- filename="Meta-Llama-3-8B-Instruct-Q6_K.gguf",
36
- local_dir="./models"
37
- )
38
 
39
  css = """
40
  .message-row {
@@ -54,6 +54,9 @@ css = """
54
  }
55
  """
56
 
 
 
 
57
  PLACEHOLDER = """
58
  <div class="message-bubble-border" style="display:flex; max-width: 600px; border-width: 1px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px);">
59
  <figure style="margin: 0;">
@@ -67,9 +70,6 @@ PLACEHOLDER = """
67
  <span style="display: inline-flex; align-items: center; border-radius: 0.375rem; background-color: rgba(229, 70, 77, 0.1); padding: 0.1rem 0.75rem; font-size: 0.75rem; font-weight: 500; color: #f88181; margin-bottom: 2.5px;">
68
  Mistral 7B Instruct v0.3
69
  </span>
70
- <span style="display: inline-flex; align-items: center; border-radius: 0.375rem; background-color: rgba(79, 70, 229, 0.1); padding: 0.1rem 0.75rem; font-size: 0.75rem; font-weight: 500; color: #60a5fa; margin-top: 2.5px;">
71
- Meta Llama 3 8B Instruct
72
- </span>
73
  </div>
74
  <div style="display: flex; justify-content: flex-end; align-items: center;">
75
  <a href="https://discord.gg/sRMvWKrh" target="_blank" rel="noreferrer" style="padding: .5rem;">
@@ -122,7 +122,6 @@ def write_message_to_user():
122
  def respond(
123
  message,
124
  history: list[tuple[str, str]],
125
- model,
126
  system_message,
127
  max_tokens,
128
  temperature,
@@ -132,7 +131,7 @@ def respond(
132
  ):
133
  chat_template = get_messages_formatter_type(model)
134
  llm = Llama(
135
- model_path=f"models/{model}",
136
  flash_attn=True,
137
  n_threads=40,
138
  n_gpu_layers=81,
@@ -230,13 +229,13 @@ def respond(
230
  demo = gr.ChatInterface(
231
  respond,
232
  additional_inputs=[
233
- gr.Dropdown([
234
- 'Mistral-7B-Instruct-v0.3-Q6_K.gguf',
235
- 'Meta-Llama-3-8B-Instruct-Q6_K.gguf'
236
- ],
237
- value="Mistral-7B-Instruct-v0.3-Q6_K.gguf",
238
- label="Model"
239
- ),
240
  gr.Textbox(value=web_search_system_prompt, label="System message"),
241
  gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="Max tokens"),
242
  gr.Slider(minimum=0.1, maximum=1.0, value=0.45, step=0.1, label="Temperature"),
 
30
  filename="Mistral-7B-Instruct-v0.3-Q6_K.gguf",
31
  local_dir="./models"
32
  )
33
+ # hf_hub_download(
34
+ # repo_id="bartowski/Meta-Llama-3-8B-Instruct-GGUF",
35
+ # filename="Meta-Llama-3-8B-Instruct-Q6_K.gguf",
36
+ # local_dir="./models"
37
+ # )
38
 
39
  css = """
40
  .message-row {
 
54
  }
55
  """
56
 
57
+ # <span style="display: inline-flex; align-items: center; border-radius: 0.375rem; background-color: rgba(79, 70, 229, 0.1); padding: 0.1rem 0.75rem; font-size: 0.75rem; font-weight: 500; color: #60a5fa; margin-top: 2.5px;">
58
+ # Meta Llama 3 8B Instruct
59
+ # </span>
60
  PLACEHOLDER = """
61
  <div class="message-bubble-border" style="display:flex; max-width: 600px; border-width: 1px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px);">
62
  <figure style="margin: 0;">
 
70
  <span style="display: inline-flex; align-items: center; border-radius: 0.375rem; background-color: rgba(229, 70, 77, 0.1); padding: 0.1rem 0.75rem; font-size: 0.75rem; font-weight: 500; color: #f88181; margin-bottom: 2.5px;">
71
  Mistral 7B Instruct v0.3
72
  </span>
 
 
 
73
  </div>
74
  <div style="display: flex; justify-content: flex-end; align-items: center;">
75
  <a href="https://discord.gg/sRMvWKrh" target="_blank" rel="noreferrer" style="padding: .5rem;">
 
122
  def respond(
123
  message,
124
  history: list[tuple[str, str]],
 
125
  system_message,
126
  max_tokens,
127
  temperature,
 
131
  ):
132
  chat_template = get_messages_formatter_type(model)
133
  llm = Llama(
134
+ model_path=f"models/{model_selected}",
135
  flash_attn=True,
136
  n_threads=40,
137
  n_gpu_layers=81,
 
229
  demo = gr.ChatInterface(
230
  respond,
231
  additional_inputs=[
232
+ # gr.Dropdown([
233
+ # 'Mistral-7B-Instruct-v0.3-Q6_K.gguf',
234
+ # 'Meta-Llama-3-8B-Instruct-Q6_K.gguf'
235
+ # ],
236
+ # value="Mistral-7B-Instruct-v0.3-Q6_K.gguf",
237
+ # label="Model"
238
+ # ),
239
  gr.Textbox(value=web_search_system_prompt, label="System message"),
240
  gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="Max tokens"),
241
  gr.Slider(minimum=0.1, maximum=1.0, value=0.45, step=0.1, label="Temperature"),