I have a streamlit app where I want to first load a sklearn model from s3.
import streamlit as st
import pandas as pd
@st.cache(suppress_st_warning=True)
def load_model():
DATA_URL = "path/to/model"
rf_mod = pd.read_pickle(DATA_URL)
return rf_mod
load_state = st.text("loading ...")
rf_mod = load_model()
load_state.text("loaded")
options = st.selectbox("select a model", ["Random Forest", "XGBoost"])
f"you select {options}"
However, when I toggle the select box the error was raised CachedObjectMutationWarning: Return value of load_model() was mutated between runs
. I didn’t try to modify the loaded model. Anyone has idea how the mutation happened?