JPBianchi commited on
Commit
82e8c15
1 Parent(s): 476fd04

removed finetuning and metrics when online

Browse files
Files changed (1) hide show
  1. app.py +34 -38
app.py CHANGED
@@ -244,11 +244,6 @@ guest_list = sorted(list(set([d['guest'] for d in data])))
244
  def main():
245
 
246
  with st.sidebar:
247
- # moved it to main area
248
- # guest = st.selectbox('Select Guest',
249
- # options=guest_list,
250
- # index=None,
251
- # placeholder='Select Guest')
252
  _, center, _ = st.columns([3, 5, 3])
253
  with center:
254
  st.text("Search Lab")
@@ -297,11 +292,11 @@ def main():
297
  shutil.rmtree(model_path)
298
  st.write("Models deleted")
299
 
300
- st.write("Experimental and time limited 2'")
301
- c1,c2 = st.columns([8,1])
302
- with c1:
303
- finetune_model = st.button('Finetune on Modal A100 GPU')
304
- if we_are_not_online or we_are_online:
305
  if finetune_model:
306
  from finetune_backend import finetune
307
  if 'finetuned' in model_name_or_path:
@@ -323,8 +318,8 @@ def main():
323
  # TODO: add model to Weaviate and to model list
324
  except Exception:
325
  st.write("Model not found on HF or error")
326
- else:
327
- st.write("Finetuning not available on Streamlit online because of space limitations")
328
 
329
  check_model(model_name_or_path)
330
  try:
@@ -345,32 +340,33 @@ def main():
345
 
346
  st.write("----------")
347
 
348
- c1,c2 = st.columns([8,1])
349
- with c1:
350
- show_metrics = st.button('Show Metrics on Golden set')
351
- if show_metrics:
352
- # we must add it because the hybrid search toggle could hide it
353
- alpha_input2 = st.slider(label='Alpha',min_value=0.00, max_value=1.00, value=0.40, step=0.05, key=2)
354
-
355
- # _, center, _ = st.columns([3, 5, 3])
356
- # with center:
357
- # st.text("Metrics")
358
- with c2:
359
- with st.spinner(''):
360
- metrics = execute_evaluation(golden_dataset, class_name, client, alpha=alpha_input2)
361
- with c1:
362
- kw_hit_rate = metrics['kw_hit_rate']
363
- kw_mrr = metrics['kw_mrr']
364
- hybrid_hit_rate = metrics['hybrid_hit_rate']
365
- vector_hit_rate = metrics['vector_hit_rate']
366
- vector_mrr = metrics['vector_mrr']
367
- total_misses = metrics['total_misses']
368
-
369
- st.text(f"KW hit rate: {kw_hit_rate}")
370
- st.text(f"Vector hit rate: {vector_hit_rate}")
371
- st.text(f"Hybrid hit rate: {hybrid_hit_rate}")
372
- st.text(f"Hybrid MRR: {vector_mrr}")
373
- st.text(f"Total misses: {total_misses}")
 
374
 
375
 
376
  st.write("----------")
 
244
  def main():
245
 
246
  with st.sidebar:
 
 
 
 
 
247
  _, center, _ = st.columns([3, 5, 3])
248
  with center:
249
  st.text("Search Lab")
 
292
  shutil.rmtree(model_path)
293
  st.write("Models deleted")
294
 
295
+ if we_are_not_online:
296
+ st.write("Experimental and time limited 2'")
297
+ c1,c2 = st.columns([8,1])
298
+ with c1:
299
+ finetune_model = st.button('Finetune on Modal A100 GPU')
300
  if finetune_model:
301
  from finetune_backend import finetune
302
  if 'finetuned' in model_name_or_path:
 
318
  # TODO: add model to Weaviate and to model list
319
  except Exception:
320
  st.write("Model not found on HF or error")
321
+ else:
322
+ st.write("Finetuning not available on Streamlit online because of space limitations")
323
 
324
  check_model(model_name_or_path)
325
  try:
 
340
 
341
  st.write("----------")
342
 
343
+ if we_are_not_online:
344
+ c1,c2 = st.columns([8,1])
345
+ with c1:
346
+ show_metrics = st.button('Show Metrics on Golden set')
347
+ if show_metrics:
348
+ # we must add it because the hybrid search toggle could hide it
349
+ alpha_input2 = st.slider(label='Alpha',min_value=0.00, max_value=1.00, value=0.40, step=0.05, key=2)
350
+
351
+ # _, center, _ = st.columns([3, 5, 3])
352
+ # with center:
353
+ # st.text("Metrics")
354
+ with c2:
355
+ with st.spinner(''):
356
+ metrics = execute_evaluation(golden_dataset, class_name, client, alpha=alpha_input2)
357
+ with c1:
358
+ kw_hit_rate = metrics['kw_hit_rate']
359
+ kw_mrr = metrics['kw_mrr']
360
+ hybrid_hit_rate = metrics['hybrid_hit_rate']
361
+ vector_hit_rate = metrics['vector_hit_rate']
362
+ vector_mrr = metrics['vector_mrr']
363
+ total_misses = metrics['total_misses']
364
+
365
+ st.text(f"KW hit rate: {kw_hit_rate}")
366
+ st.text(f"Vector hit rate: {vector_hit_rate}")
367
+ st.text(f"Hybrid hit rate: {hybrid_hit_rate}")
368
+ st.text(f"Hybrid MRR: {vector_mrr}")
369
+ st.text(f"Total misses: {total_misses}")
370
 
371
 
372
  st.write("----------")