Hi, I am trying to use st.experimental_memo but I’m getting TypeError: cannot pickle ‘weakref’ object
What could be wrong?
Hi @OOlajide, welcome to the community! 
I wasn’t able to reproduce the error on my end with streamlit==1.0.0 and transformers==4.11.3.
What versions of streamlit and transformers are you using? That info will help with debugging. Also, could you share the entire traceback?
Have you tried using @st.experimental_singleton? It is used is for storing non-data objects, including TensorFlow/Torch/Keras sessions:
Best, 
Snehan
Hey OOlajide - we really need to make that error message better!
This issue here is that the pipeline object you’re creating is not a “pure data” object, and it can’t be serialized. Snehan’s suggestion to use @st.experimental_singleton is correct - you want to use singleton when you’re storing a non-data object that performs computation, and st.experimental_memo when you’re storing data that is the result of a computation.

