Loading sentence transformer model in streamlit taking FOREVER

840 Views Asked by At

So to start I have to mention, that my code was working 110% fine as it was for my streamlit. I have the code set up where the user selects a model to use and hits a button to choose it. Then the load function is called and the rest of the program is fine. Here's a screenshot of a portion of the projects first screen:

enter image description here

Simple, hit the button, and the following relevant code will run:

1)

if type_of_model == self.m_model_types[0]:
   self.m_model = St_AllMpnetBaseV2()
            
with st.spinner(f'Loading {self.m_model.GetName()} into memory....'):
    self.m_model.Load()

St_AllMpnetBaseV2 is just a class made that, as shown above, will call the load function.

2)

def Load(self):
   if 'model' not in st.session_state:
      st.session_state.m_model = SentenceTransformer('all-mpnet-base-v2')

HOWEVER the following image is the result and it keeps going for a ridiculous amount of time.

enter image description here

What's going on? As I've said I've been running this code for a week now advancing my project then a couple hours ago this issue came up.

0

There are 0 best solutions below