Spaces:
Running
Running
changed button default status
Browse files- app.py +1 -1
- finetune_backend.py +4 -2
app.py
CHANGED
@@ -510,7 +510,7 @@ def main():
|
|
510 |
|
511 |
# I jump out of col1 to get all page width, so need to retest query
|
512 |
if query is not None and reworded_query['status'] != 'error':
|
513 |
-
show_query = st.toggle('Show rewritten query',
|
514 |
if show_query: # or reworded_query['changed']:
|
515 |
st.write(f"Rewritten query: {query}")
|
516 |
|
|
|
510 |
|
511 |
# I jump out of col1 to get all page width, so need to retest query
|
512 |
if query is not None and reworded_query['status'] != 'error':
|
513 |
+
show_query = st.toggle('Show rewritten query', True)
|
514 |
if show_query: # or reworded_query['changed']:
|
515 |
st.write(f"Rewritten query: {query}")
|
516 |
|
finetune_backend.py
CHANGED
@@ -3,6 +3,7 @@ import os, time, io, zipfile
|
|
3 |
from preprocessing import FileIO
|
4 |
import shutil
|
5 |
import modal
|
|
|
6 |
from llama_index.finetuning import EmbeddingQAFinetuneDataset
|
7 |
|
8 |
from dotenv import load_dotenv, find_dotenv
|
@@ -28,12 +29,13 @@ def finetune(model='all-mpnet-base-v2', savemodel=False, outpath='.'):
|
|
28 |
path of the saved model (when saved)
|
29 |
"""
|
30 |
f = modal.Function.lookup("vector-search-project", "finetune")
|
31 |
-
model = model.replace('/','')
|
32 |
|
33 |
if 'sentence-transformers' not in model:
|
|
|
34 |
model = f"sentence-transformers/{model}"
|
35 |
|
36 |
fullpath = os.path.join(outpath, f"finetuned-{model}-300")
|
|
|
37 |
|
38 |
if os.path.exists(fullpath):
|
39 |
msg = "Model already exists!"
|
@@ -44,7 +46,7 @@ def finetune(model='all-mpnet-base-v2', savemodel=False, outpath='.'):
|
|
44 |
finetuned_model = f.remote(training_path, valid_path, model_id=model)
|
45 |
|
46 |
end = time.perf_counter() - start
|
47 |
-
|
48 |
|
49 |
if savemodel:
|
50 |
|
|
|
3 |
from preprocessing import FileIO
|
4 |
import shutil
|
5 |
import modal
|
6 |
+
import streamlit as st
|
7 |
from llama_index.finetuning import EmbeddingQAFinetuneDataset
|
8 |
|
9 |
from dotenv import load_dotenv, find_dotenv
|
|
|
29 |
path of the saved model (when saved)
|
30 |
"""
|
31 |
f = modal.Function.lookup("vector-search-project", "finetune")
|
|
|
32 |
|
33 |
if 'sentence-transformers' not in model:
|
34 |
+
model = model.replace('/','')
|
35 |
model = f"sentence-transformers/{model}"
|
36 |
|
37 |
fullpath = os.path.join(outpath, f"finetuned-{model}-300")
|
38 |
+
st.sidebar.write(f"Model will be saved in {fullpath}")
|
39 |
|
40 |
if os.path.exists(fullpath):
|
41 |
msg = "Model already exists!"
|
|
|
46 |
finetuned_model = f.remote(training_path, valid_path, model_id=model)
|
47 |
|
48 |
end = time.perf_counter() - start
|
49 |
+
st.write(f"Finetuning with GPU lasted {end:.2f} seconds")
|
50 |
|
51 |
if savemodel:
|
52 |
|