Is there a recommended way to cache variables from PyTorch? I’m currently getting the error “UnhashableType: Cannot hash object of type torch._C._TensorBase”.
I’m trying to cache initialization of a StyleGAN2
class datastructure (which includes loading model weights from a file or online). I don’t want the model weights to be reloaded (and other data structures re-initialized) every time a new image is created.
I tried refactoring my code so that
@st.cache is in front of a function that only does one thing:
torch.load(filename) and the same error occurs.