Hello,
Been poking around Streamlit for the first time with a GAN. I tried to use the Demo GAN app in the galley as a template. However, I am not experienced with caching, hashmaps, etcâŠ
This is what I have tried. I assume I need to move the call of âtflib.init_tf()â to this hash_funcs. But nothing has worked.
TL_GAN_HASH_FUNCS = {
tflib.init_tf():id
}
@st.cache(allow_output_mutation=True, hash_funcs=TL_GAN_HASH_FUNCS)
def load_model(network_pkl):
print(âLoading networks from â%sââŠâ % network_pkl)
with dnnlib.util.open_url(network_pkl) as fp:
_G, _D, Gs = pickle.load(fp)
noise_vars = [var for name, var in Gs.components.synthesis.vars.items() if name.startswith(ânoiseâ)] Gs_kwargs = dnnlib.EasyDict()
Gs_kwargs.output_transform = dict(func=tflib.convert_images_to_uint8, nchw_to_nhwc=True)
Gs_kwargs.randomize_noise = False
return Gs, noise_vars, Gs_kwargs
Has anyone had luck caching their stylegan GANs?