Skip to content

Instantly share code, notes, and snippets.

@tc87
Last active March 24, 2020 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tc87/585976da558b9ca87724f9136e335565 to your computer and use it in GitHub Desktop.
Save tc87/585976da558b9ca87724f9136e335565 to your computer and use it in GitHub Desktop.
@st.cache(allow_output_mutation=True, hash_funcs=TL_GAN_HASH_FUNCS)
def load_pg_gan_model():
"""
Create the tensorflow session.
"""
config = tf.ConfigProto(allow_soft_placement=True)
session = tf.Session(config=config)
with session.as_default():
with open(MODEL_FILE_GPU if USE_GPU else MODEL_FILE_CPU, 'rb') as f:
G = pickle.load(f)
return session, G
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment