pabloce commited on
Commit
b3a6cb3
·
verified ·
1 Parent(s): edc2ab6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -13
app.py CHANGED
@@ -17,14 +17,6 @@ from llama_cpp_agent.prompt_templates import web_search_system_prompt, research_
17
  from style import css, PLACEHOLDER
18
  from utils import CitingSources
19
 
20
- model_selected = "Mistral-7B-Instruct-v0.3-Q6_K.gguf"
21
- examples = [
22
- ["latest news about Yann LeCun"],
23
- ["Latest news site:github.blog"],
24
- ["Where I can find best hotel in Galapagos, Ecuador intitle:hotel"],
25
- ["filetype:pdf intitle:python"]
26
- ]
27
-
28
  hf_hub_download(
29
  repo_id="bartowski/Mistral-7B-Instruct-v0.3-GGUF",
30
  filename="Mistral-7B-Instruct-v0.3-Q6_K.gguf",
@@ -35,6 +27,18 @@ hf_hub_download(
35
  filename="Meta-Llama-3-8B-Instruct-Q6_K.gguf",
36
  local_dir="./models"
37
  )
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  css = """
40
  .message-row {
@@ -98,19 +102,20 @@ PLACEHOLDER = """
98
  def get_context_by_model(model_name):
99
  model_context_limits = {
100
  "Mistral-7B-Instruct-v0.3-Q6_K.gguf": 32768,
 
101
  "Meta-Llama-3-8B-Instruct-Q6_K.gguf": 8192
102
  }
103
  return model_context_limits.get(model_name, None)
104
 
105
  def get_messages_formatter_type(model_name):
106
- from llama_cpp_agent import MessagesFormatterType
107
- if "Meta" in model_name or "aya" in model_name:
108
  return MessagesFormatterType.LLAMA_3
109
- elif "Mistral" in model_name:
110
  return MessagesFormatterType.MISTRAL
111
- elif "Einstein-v6-7B" in model_name or "dolphin" in model_name:
112
  return MessagesFormatterType.CHATML
113
- elif "Phi" in model_name:
114
  return MessagesFormatterType.PHI_3
115
  else:
116
  return MessagesFormatterType.CHATML
@@ -236,6 +241,7 @@ demo = gr.ChatInterface(
236
  additional_inputs=[
237
  gr.Dropdown([
238
  'Mistral-7B-Instruct-v0.3-Q6_K.gguf',
 
239
  'Meta-Llama-3-8B-Instruct-Q6_K.gguf'
240
  ],
241
  value="Mistral-7B-Instruct-v0.3-Q6_K.gguf",
 
17
  from style import css, PLACEHOLDER
18
  from utils import CitingSources
19
 
 
 
 
 
 
 
 
 
20
  hf_hub_download(
21
  repo_id="bartowski/Mistral-7B-Instruct-v0.3-GGUF",
22
  filename="Mistral-7B-Instruct-v0.3-Q6_K.gguf",
 
27
  filename="Meta-Llama-3-8B-Instruct-Q6_K.gguf",
28
  local_dir="./models"
29
  )
30
+ hf_hub_download(
31
+ repo_id="TheBloke/Mixtral-8x7B-Instruct-v0.1-GGUF",
32
+ filename="mixtral-8x7b-instruct-v0.1.Q5_K_M.gguf",
33
+ local_dir="./models"
34
+ )
35
+
36
+ examples = [
37
+ ["latest news about Yann LeCun"],
38
+ ["Latest news site:github.blog"],
39
+ ["Where I can find best hotel in Galapagos, Ecuador intitle:hotel"],
40
+ ["filetype:pdf intitle:python"]
41
+ ]
42
 
43
  css = """
44
  .message-row {
 
102
  def get_context_by_model(model_name):
103
  model_context_limits = {
104
  "Mistral-7B-Instruct-v0.3-Q6_K.gguf": 32768,
105
+ "mixtral-8x7b-instruct-v0.1.Q5_K_M.gguf": 32768,
106
  "Meta-Llama-3-8B-Instruct-Q6_K.gguf": 8192
107
  }
108
  return model_context_limits.get(model_name, None)
109
 
110
  def get_messages_formatter_type(model_name):
111
+ model_name = model_name.lower()
112
+ if any(keyword in model_name for keyword in ["meta", "aya"]):
113
  return MessagesFormatterType.LLAMA_3
114
+ elif any(keyword in model_name for keyword in ["mistral", "mixtral"]):
115
  return MessagesFormatterType.MISTRAL
116
+ elif any(keyword in model_name for keyword in ["einstein", "dolphin"]):
117
  return MessagesFormatterType.CHATML
118
+ elif "phi" in model_name:
119
  return MessagesFormatterType.PHI_3
120
  else:
121
  return MessagesFormatterType.CHATML
 
241
  additional_inputs=[
242
  gr.Dropdown([
243
  'Mistral-7B-Instruct-v0.3-Q6_K.gguf',
244
+ 'mixtral-8x7b-instruct-v0.1.Q5_K_M.gguf',
245
  'Meta-Llama-3-8B-Instruct-Q6_K.gguf'
246
  ],
247
  value="Mistral-7B-Instruct-v0.3-Q6_K.gguf",