phyloforfun commited on
Commit
c47d7dd
1 Parent(s): f5215c3

GPT4o, fix UM GPT sunset

Browse files
api_cost/api_cost.yaml CHANGED
@@ -10,6 +10,12 @@ GPT_4:
10
  # GPT_4_TURBO: ###############
11
  # in: 0.01
12
  # out: 0.03
 
 
 
 
 
 
13
  GPT_4_TURBO_0125:
14
  in: 0.01
15
  out: 0.03
@@ -93,5 +99,8 @@ LOCAL_MISTRAL_7B_INSTRUCT_V02:
93
  in: 0.0
94
  out: 0.0
95
  LOCAL_CPU_MISTRAL_7B_INSTRUCT_V02_GGUF:
 
 
 
96
  in: 0.0
97
  out: 0.0
 
10
  # GPT_4_TURBO: ###############
11
  # in: 0.01
12
  # out: 0.03
13
+ GPT_4o_2024_05_13:
14
+ in: 0.005
15
+ out: 0.015
16
+ GPT_4_TURBO_2024_04_09:
17
+ in: 0.01
18
+ out: 0.03
19
  GPT_4_TURBO_0125:
20
  in: 0.01
21
  out: 0.03
 
99
  in: 0.0
100
  out: 0.0
101
  LOCAL_CPU_MISTRAL_7B_INSTRUCT_V02_GGUF:
102
+ in: 0.0
103
+ out: 0.0
104
+ phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05:
105
  in: 0.0
106
  out: 0.0
app.py CHANGED
@@ -1730,7 +1730,7 @@ Based on preliminary results, the following models perform the best. We are curr
1730
  - `LOCAL Mixtral 7Bx8 Instruct`
1731
  - `LOCAL Mixtral 7B Instruct`
1732
 
1733
- Larger models (e.g., `GPT 4`, `GPT 4 32k`, `Gemini Pro`) do not necessarily perform better for these tasks. MistralAI models exceeded our expectations and perform extremely well. PaLM 2 text-bison@001 also seems to consistently out-perform Gemini Pro.
1734
 
1735
  The `SLTPvA_short.yaml` prompt also seems to work better with smaller LLMs (e.g., Mistral Tiny). Alternatively, enable double OCR to help the LLM focus on the OCR text given a longer prompt.
1736
 
 
1730
  - `LOCAL Mixtral 7Bx8 Instruct`
1731
  - `LOCAL Mixtral 7B Instruct`
1732
 
1733
+ Larger models (e.g., `GPT 4`, `Gemini Pro`) do not necessarily perform better for these tasks. MistralAI models exceeded our expectations and perform extremely well. PaLM 2 text-bison@001 also seems to consistently out-perform Gemini Pro.
1734
 
1735
  The `SLTPvA_short.yaml` prompt also seems to work better with smaller LLMs (e.g., Mistral Tiny). Alternatively, enable double OCR to help the LLM focus on the OCR text given a longer prompt.
1736
 
vouchervision/VoucherVision_Config_Builder.py CHANGED
@@ -49,7 +49,7 @@ def build_VV_config(loaded_cfg=None):
49
 
50
  check_for_illegal_filenames = False
51
 
52
- LLM_version_user = 'Azure GPT 3.5 Turbo' #'Azure GPT 4 Turbo 1106-preview'
53
  prompt_version = 'SLTPvA_long.yaml' # from ["Version 1", "Version 1 No Domain Knowledge", "Version 2"]
54
  use_LeafMachine2_collage_images = True # Use LeafMachine2 collage images
55
  do_create_OCR_helper_image = True
 
49
 
50
  check_for_illegal_filenames = False
51
 
52
+ LLM_version_user = 'Azure GPT 4' #'Azure GPT 4 Turbo 1106-preview'
53
  prompt_version = 'SLTPvA_long.yaml' # from ["Version 1", "Version 1 No Domain Knowledge", "Version 2"]
54
  use_LeafMachine2_collage_images = True # Use LeafMachine2 collage images
55
  do_create_OCR_helper_image = True
vouchervision/model_maps.py CHANGED
@@ -3,6 +3,8 @@ class ModelMaps:
3
  COLORS_EXPENSE_REPORT = {
4
  'GPT_4': '#32CD32', # Lime Green
5
  'GPT_3_5': '#008000', # Green
 
 
6
  'GPT_3_5_INSTRUCT': '#3CB371', # Medium Sea Green
7
  'GPT_4_TURBO_1106': '#228B22', # Forest Green
8
  'GPT_4_TURBO_0125': '#228B22', # Forest Green
@@ -14,11 +16,11 @@ class ModelMaps:
14
  'GEMINI_PRO': '#1E00FF', #
15
 
16
  'AZURE_GPT_4': '#800080', # Purple
17
- 'AZURE_GPT_4_TURBO_1106': '#9370DB', # Medium Purple
18
- 'AZURE_GPT_4_TURBO_0125': '#9370DB', # Medium Purple
19
- 'AZURE_GPT_4_32K': '#8A2BE2', # Blue Violet
20
- 'AZURE_GPT_3_5_INSTRUCT': '#9400D3', # Dark Violet
21
- 'AZURE_GPT_3_5': '#9932CC', # Dark Orchid
22
 
23
  'OPEN_MISTRAL_7B': '#FFA07A', # Light Salmon
24
  'OPEN_MIXTRAL_8X7B': '#FF8C00', # Dark Orange
@@ -30,21 +32,26 @@ class ModelMaps:
30
  'LOCAL_MISTRAL_7B_INSTRUCT_V02': '#4a4a4a', # Gray
31
 
32
  'LOCAL_CPU_MISTRAL_7B_INSTRUCT_V02_GGUF': '#bababa', # Gray
 
 
33
  }
34
 
35
  MODELS_OPENAI = ["GPT 4",
36
  "GPT 4 32k",
 
 
37
  "GPT 4 Turbo 0125-preview",
38
  "GPT 4 Turbo 1106-preview",
39
  "GPT 3.5 Turbo",
40
  "GPT 3.5 Instruct",
41
 
42
  "Azure GPT 4",
43
- "Azure GPT 4 32k",
44
- "Azure GPT 4 Turbo 0125-preview",
45
- "Azure GPT 4 Turbo 1106-preview",
46
- "Azure GPT 3.5 Turbo",
47
- "Azure GPT 3.5 Instruct",]
 
48
 
49
  MODELS_GOOGLE = ["PaLM 2 text-bison@001",
50
  "PaLM 2 text-bison@002",
@@ -60,24 +67,27 @@ class ModelMaps:
60
 
61
  MODELS_LOCAL = ["LOCAL Mixtral 8x7B Instruct v0.1",
62
  "LOCAL Mistral 7B Instruct v0.2",
63
- "LOCAL CPU Mistral 7B Instruct v0.2 GGUF",]
 
64
 
65
- MODELS_GUI_DEFAULT = "Azure GPT 3.5 Turbo" # "GPT 4 Turbo 1106-preview"
66
 
67
  version_mapping_cost = {
68
  'GPT 4 32k': 'GPT_4_32K',
69
  'GPT 4': 'GPT_4',
 
 
70
  'GPT 4 Turbo 0125-preview': 'GPT_4_TURBO_0125',
71
  'GPT 4 Turbo 1106-preview': 'GPT_4_TURBO_1106',
72
  'GPT 3.5 Instruct': 'GPT_3_5_INSTRUCT',
73
  'GPT 3.5 Turbo': 'GPT_3_5',
74
 
75
- 'Azure GPT 4 32k': 'AZURE_GPT_4_32K',
76
  'Azure GPT 4': 'AZURE_GPT_4',
77
- 'Azure GPT 4 Turbo 0125-preview': 'AZURE_GPT_4_TURBO_0125',
78
- 'Azure GPT 4 Turbo 1106-preview': 'AZURE_GPT_4_TURBO_1106',
79
- 'Azure GPT 3.5 Instruct': 'AZURE_GPT_3_5_INSTRUCT',
80
- 'Azure GPT 3.5 Turbo': 'AZURE_GPT_3_5',
81
 
82
  'Gemini Pro': 'GEMINI_PRO',
83
  'PaLM 2 text-unicorn@001': 'PALM2_TU_1',
@@ -94,25 +104,29 @@ class ModelMaps:
94
  'LOCAL Mistral 7B Instruct v0.2': 'LOCAL_MISTRAL_7B_INSTRUCT_V02',
95
 
96
  'LOCAL CPU Mistral 7B Instruct v0.2 GGUF': 'LOCAL_CPU_MISTRAL_7B_INSTRUCT_V02_GGUF',
 
 
97
  }
98
 
99
  @classmethod
100
  def get_version_has_key(cls, key, has_key_openai, has_key_azure_openai, has_key_google_application_credentials, has_key_mistral):
101
  # Define the mapping for 'has_key' values
102
  version_has_key = {
 
103
  'GPT 4 Turbo 1106-preview': has_key_openai,
104
  'GPT 4 Turbo 0125-preview': has_key_openai,
105
  'GPT 4': has_key_openai,
 
106
  'GPT 4 32k': has_key_openai,
107
  'GPT 3.5 Turbo': has_key_openai,
108
  'GPT 3.5 Instruct': has_key_openai,
109
 
110
- 'Azure GPT 3.5 Turbo': has_key_azure_openai,
111
- 'Azure GPT 3.5 Instruct': has_key_azure_openai,
112
  'Azure GPT 4': has_key_azure_openai,
113
- 'Azure GPT 4 Turbo 1106-preview': has_key_azure_openai,
114
- 'Azure GPT 4 Turbo 0125-preview': has_key_azure_openai,
115
- 'Azure GPT 4 32k': has_key_azure_openai,
116
 
117
  'PaLM 2 text-bison@001': has_key_google_application_credentials,
118
  'PaLM 2 text-bison@002': has_key_google_application_credentials,
@@ -129,12 +143,16 @@ class ModelMaps:
129
  'LOCAL Mistral 7B Instruct v0.2': True,
130
 
131
  'LOCAL CPU Mistral 7B Instruct v0.2 GGUF': True,
 
 
132
  }
133
  return version_has_key.get(key)
134
 
135
  @classmethod
136
  def get_version_mapping_is_azure(cls, key):
137
  version_mapping_is_azure = {
 
 
138
  "GPT 4 Turbo 1106-preview": False,
139
  "GPT 4 Turbo 0125-preview": False,
140
  'GPT 4': False,
@@ -142,12 +160,12 @@ class ModelMaps:
142
  'GPT 3.5 Turbo': False,
143
  'GPT 3.5 Instruct': False,
144
 
145
- 'Azure GPT 3.5 Turbo': True,
146
- 'Azure GPT 3.5 Instruct': True,
147
  'Azure GPT 4': True,
148
- 'Azure GPT 4 Turbo 1106-preview': True,
149
- 'Azure GPT 4 Turbo 0125-preview': True,
150
- 'Azure GPT 4 32k': True,
151
 
152
  'PaLM 2 text-bison@001': False,
153
  'PaLM 2 text-bison@002': False,
@@ -164,6 +182,8 @@ class ModelMaps:
164
  'LOCAL Mistral 7B Instruct v0.2': False,
165
 
166
  'LOCAL CPU Mistral 7B Instruct v0.2 GGUF': False,
 
 
167
  }
168
  return version_mapping_is_azure.get(key)
169
 
@@ -182,7 +202,13 @@ class ModelMaps:
182
 
183
  elif key == 'GPT_4_32K':
184
  return 'gpt-4-32k'
 
 
 
185
 
 
 
 
186
  elif key == 'GPT_4_TURBO_1106':
187
  return 'gpt-4-1106-preview'
188
 
@@ -190,23 +216,23 @@ class ModelMaps:
190
  return 'gpt-4-0125-preview'
191
 
192
  ### Azure
193
- elif key == 'AZURE_GPT_3_5':
194
- return 'gpt-35-turbo-0125'
195
 
196
- elif key == 'AZURE_GPT_3_5_INSTRUCT':
197
- return 'gpt-35-turbo-instruct'
198
 
199
  elif key == 'AZURE_GPT_4':
200
  return "gpt-4"
201
 
202
- elif key == 'AZURE_GPT_4_TURBO_1106':
203
- return "gpt-4-1106-preview"
204
 
205
- elif key == 'AZURE_GPT_4_TURBO_0125':
206
- return 'gpt-4-0125-preview'
207
 
208
- elif key == 'AZURE_GPT_4_32K':
209
- return "gpt-4-32k"
210
 
211
  ### Google
212
  elif key == 'PALM2_TB_1':
@@ -248,6 +274,14 @@ class ModelMaps:
248
  ### Mistral LOCAL CPU
249
  elif key == 'LOCAL_CPU_MISTRAL_7B_INSTRUCT_V02_GGUF':
250
  return 'Mistral-7B-Instruct-v0.2-GGUF'
 
 
 
 
 
 
 
 
251
 
252
  else:
253
  raise ValueError(f"Invalid model name {key}. See model_maps.py")
 
3
  COLORS_EXPENSE_REPORT = {
4
  'GPT_4': '#32CD32', # Lime Green
5
  'GPT_3_5': '#008000', # Green
6
+ 'GPT_4_TURBO_2024_04_09': '#32CD32', # Lime Green
7
+ 'GPT_4o_2024_05_13': '#3CB371', # Lime Green gpt-4o-2024-05-13
8
  'GPT_3_5_INSTRUCT': '#3CB371', # Medium Sea Green
9
  'GPT_4_TURBO_1106': '#228B22', # Forest Green
10
  'GPT_4_TURBO_0125': '#228B22', # Forest Green
 
16
  'GEMINI_PRO': '#1E00FF', #
17
 
18
  'AZURE_GPT_4': '#800080', # Purple
19
+ # 'AZURE_GPT_4_TURBO_1106': '#9370DB', # Medium Purple
20
+ # 'AZURE_GPT_4_TURBO_0125': '#9370DB', # Medium Purple
21
+ # 'AZURE_GPT_4_32K': '#8A2BE2', # Blue Violet
22
+ # 'AZURE_GPT_3_5_INSTRUCT': '#9400D3', # Dark Violet
23
+ # 'AZURE_GPT_3_5': '#9932CC', # Dark Orchid
24
 
25
  'OPEN_MISTRAL_7B': '#FFA07A', # Light Salmon
26
  'OPEN_MIXTRAL_8X7B': '#FF8C00', # Dark Orange
 
32
  'LOCAL_MISTRAL_7B_INSTRUCT_V02': '#4a4a4a', # Gray
33
 
34
  'LOCAL_CPU_MISTRAL_7B_INSTRUCT_V02_GGUF': '#bababa', # Gray
35
+
36
+ 'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05': '#bababa', # Gray
37
  }
38
 
39
  MODELS_OPENAI = ["GPT 4",
40
  "GPT 4 32k",
41
+ "GPT 4o 2024-05-13", #GPT_4o_2024_05_13
42
+ "GPT 4 Turbo 2024-04-09",#GPT_4_TURBO_2024_04_09
43
  "GPT 4 Turbo 0125-preview",
44
  "GPT 4 Turbo 1106-preview",
45
  "GPT 3.5 Turbo",
46
  "GPT 3.5 Instruct",
47
 
48
  "Azure GPT 4",
49
+ # "Azure GPT 4 32k",
50
+ # "Azure GPT 4 Turbo 0125-preview",
51
+ # "Azure GPT 4 Turbo 1106-preview",
52
+ # "Azure GPT 3.5 Turbo",
53
+ # "Azure GPT 3.5 Instruct",
54
+ ]
55
 
56
  MODELS_GOOGLE = ["PaLM 2 text-bison@001",
57
  "PaLM 2 text-bison@002",
 
67
 
68
  MODELS_LOCAL = ["LOCAL Mixtral 8x7B Instruct v0.1",
69
  "LOCAL Mistral 7B Instruct v0.2",
70
+ "LOCAL CPU Mistral 7B Instruct v0.2 GGUF",
71
+ 'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05']
72
 
73
+ MODELS_GUI_DEFAULT = "Azure GPT 4" # "GPT 4 Turbo 1106-preview"
74
 
75
  version_mapping_cost = {
76
  'GPT 4 32k': 'GPT_4_32K',
77
  'GPT 4': 'GPT_4',
78
+ "GPT 4o 2024-05-13": 'GPT_4o_2024_05_13',
79
+ "GPT 4 Turbo 2024-04-09": 'GPT_4_TURBO_2024_04_09',
80
  'GPT 4 Turbo 0125-preview': 'GPT_4_TURBO_0125',
81
  'GPT 4 Turbo 1106-preview': 'GPT_4_TURBO_1106',
82
  'GPT 3.5 Instruct': 'GPT_3_5_INSTRUCT',
83
  'GPT 3.5 Turbo': 'GPT_3_5',
84
 
85
+ # 'Azure GPT 4 32k': 'AZURE_GPT_4_32K',
86
  'Azure GPT 4': 'AZURE_GPT_4',
87
+ # 'Azure GPT 4 Turbo 0125-preview': 'AZURE_GPT_4_TURBO_0125',
88
+ # 'Azure GPT 4 Turbo 1106-preview': 'AZURE_GPT_4_TURBO_1106',
89
+ # 'Azure GPT 3.5 Instruct': 'AZURE_GPT_3_5_INSTRUCT',
90
+ # 'Azure GPT 3.5 Turbo': 'AZURE_GPT_3_5',
91
 
92
  'Gemini Pro': 'GEMINI_PRO',
93
  'PaLM 2 text-unicorn@001': 'PALM2_TU_1',
 
104
  'LOCAL Mistral 7B Instruct v0.2': 'LOCAL_MISTRAL_7B_INSTRUCT_V02',
105
 
106
  'LOCAL CPU Mistral 7B Instruct v0.2 GGUF': 'LOCAL_CPU_MISTRAL_7B_INSTRUCT_V02_GGUF',
107
+
108
+ 'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05': 'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05',
109
  }
110
 
111
  @classmethod
112
  def get_version_has_key(cls, key, has_key_openai, has_key_azure_openai, has_key_google_application_credentials, has_key_mistral):
113
  # Define the mapping for 'has_key' values
114
  version_has_key = {
115
+ "GPT 4 Turbo 2024-04-09": has_key_openai,
116
  'GPT 4 Turbo 1106-preview': has_key_openai,
117
  'GPT 4 Turbo 0125-preview': has_key_openai,
118
  'GPT 4': has_key_openai,
119
+ "GPT 4o 2024-05-13": has_key_openai,
120
  'GPT 4 32k': has_key_openai,
121
  'GPT 3.5 Turbo': has_key_openai,
122
  'GPT 3.5 Instruct': has_key_openai,
123
 
124
+ # 'Azure GPT 3.5 Turbo': has_key_azure_openai,
125
+ # 'Azure GPT 3.5 Instruct': has_key_azure_openai,
126
  'Azure GPT 4': has_key_azure_openai,
127
+ # 'Azure GPT 4 Turbo 1106-preview': has_key_azure_openai,
128
+ # 'Azure GPT 4 Turbo 0125-preview': has_key_azure_openai,
129
+ # 'Azure GPT 4 32k': has_key_azure_openai,
130
 
131
  'PaLM 2 text-bison@001': has_key_google_application_credentials,
132
  'PaLM 2 text-bison@002': has_key_google_application_credentials,
 
143
  'LOCAL Mistral 7B Instruct v0.2': True,
144
 
145
  'LOCAL CPU Mistral 7B Instruct v0.2 GGUF': True,
146
+
147
+ 'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05': True
148
  }
149
  return version_has_key.get(key)
150
 
151
  @classmethod
152
  def get_version_mapping_is_azure(cls, key):
153
  version_mapping_is_azure = {
154
+ "GPT 4o 2024-05-13": False,
155
+ "GPT 4 Turbo 2024-04-09": False,
156
  "GPT 4 Turbo 1106-preview": False,
157
  "GPT 4 Turbo 0125-preview": False,
158
  'GPT 4': False,
 
160
  'GPT 3.5 Turbo': False,
161
  'GPT 3.5 Instruct': False,
162
 
163
+ # 'Azure GPT 3.5 Turbo': True,
164
+ # 'Azure GPT 3.5 Instruct': True,
165
  'Azure GPT 4': True,
166
+ # 'Azure GPT 4 Turbo 1106-preview': True,
167
+ # 'Azure GPT 4 Turbo 0125-preview': True,
168
+ # 'Azure GPT 4 32k': True,
169
 
170
  'PaLM 2 text-bison@001': False,
171
  'PaLM 2 text-bison@002': False,
 
182
  'LOCAL Mistral 7B Instruct v0.2': False,
183
 
184
  'LOCAL CPU Mistral 7B Instruct v0.2 GGUF': False,
185
+
186
+ 'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05': False
187
  }
188
  return version_mapping_is_azure.get(key)
189
 
 
202
 
203
  elif key == 'GPT_4_32K':
204
  return 'gpt-4-32k'
205
+
206
+ elif key == 'GPT_4o_2024_05_13':
207
+ return 'gpt-4o-2024-05-13'
208
 
209
+ elif key == 'GPT_4_TURBO_2024_04_09':
210
+ return 'gpt-4-turbo-2024-04-09'
211
+
212
  elif key == 'GPT_4_TURBO_1106':
213
  return 'gpt-4-1106-preview'
214
 
 
216
  return 'gpt-4-0125-preview'
217
 
218
  ### Azure
219
+ # elif key == 'AZURE_GPT_3_5':
220
+ # return 'gpt-35-turbo-0125'
221
 
222
+ # elif key == 'AZURE_GPT_3_5_INSTRUCT':
223
+ # return 'gpt-35-turbo-instruct'
224
 
225
  elif key == 'AZURE_GPT_4':
226
  return "gpt-4"
227
 
228
+ # elif key == 'AZURE_GPT_4_TURBO_1106':
229
+ # return "gpt-4-1106-preview"
230
 
231
+ # elif key == 'AZURE_GPT_4_TURBO_0125':
232
+ # return 'gpt-4-0125-preview'
233
 
234
+ # elif key == 'AZURE_GPT_4_32K':
235
+ # return "gpt-4-32k"
236
 
237
  ### Google
238
  elif key == 'PALM2_TB_1':
 
274
  ### Mistral LOCAL CPU
275
  elif key == 'LOCAL_CPU_MISTRAL_7B_INSTRUCT_V02_GGUF':
276
  return 'Mistral-7B-Instruct-v0.2-GGUF'
277
+
278
+
279
+
280
+ ### LOCAL custom fine-tuned
281
+ elif key == 'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05':
282
+ return 'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05'
283
+
284
+
285
 
286
  else:
287
  raise ValueError(f"Invalid model name {key}. See model_maps.py")