Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in facial_exchange.py #10

Open
mzprose opened this issue Feb 23, 2021 · 7 comments
Open

error in facial_exchange.py #10

mzprose opened this issue Feb 23, 2021 · 7 comments

Comments

@mzprose
Copy link

mzprose commented Feb 23, 2021

Hello,when I run this .py file,error happend,can you tell me how to solve?thank you!

"RuntimeError: No default TensorFlow session found. Please call dnnlib.tflib.init_tf()."

the complete code in dnnlib/tflib/tfutil.py:
def assert_tf_initialized():
"""Check that TensorFlow session has been initialized."""
if tf.get_default_session() is None:
raise RuntimeError("No default TensorFlow session found. Please call dnnlib.tflib.init_tf().")

@pacifinapacific
Copy link
Owner

pacifinapacific commented Feb 23, 2021

I don't know your detailed environment, so I can't answer. did you run it according to the jupyter-notebook file? did you successfully convert the weights before facial_exchange.py?

@mzprose
Copy link
Author

mzprose commented Feb 24, 2021

I do run according to the jupyter-notebook file and have converted the weights, so there should be a problem with my operating environment? But other tasks, such as image_crossover.py, image_morphing.py, etc., all run successfully.

@pacifinapacific
Copy link
Owner

umm...It looks like facial_exchange.py is running in pytorch and not calling dnnlib. Can you show me the error log so that I can see at what stage the error is occurring?

@mzprose
Copy link
Author

mzprose commented Feb 24, 2021

Traceback (most recent call last):
File "facial_exchange.py", line 167, in
main()
File "facial_exchange.py", line 37, in main
g_all.load_state_dict(torch.load(args.weight_file, map_location=device))
File "D:\Anaconda\lib\site-packages\torch\serialization.py", line 387, in load
return _load(f, map_location, pickle_module, **pickle_load_args)
File "D:\Anaconda\lib\site-packages\torch\serialization.py", line 564, in _load
magic_number = pickle_module.load(f, **pickle_load_args)
File "E:\Style Transfer\GAN_2020_12\StyleGAN_LatentEditor-master\dnnlib\tflib\network.py", line 271, in setstate
tfutil.assert_tf_initialized()
File "E:\Style Transfer\GAN_2020_12\StyleGAN_LatentEditor-master\dnnlib\tflib\tfutil.py", line 125, in assert_tf_initialized
raise RuntimeError("No default TensorFlow session found. Please call dnnlib.tflib.init_tf().")
RuntimeError: No default TensorFlow session found. Please call dnnlib.tflib.init_tf().

@pacifinapacific
Copy link
Owner

pacifinapacific commented Feb 24, 2021

I'm sorry, I don't know why you get the error in facial_exchange.py but not in image_crossover.py.
The two codes should be the same until line 37.
Did you try it on google colaboratory?

@mzprose
Copy link
Author

mzprose commented Feb 24, 2021

Ok, I will try again, thanks for your answer

@zmxhhh
Copy link

zmxhhh commented Dec 27, 2021

Hello, can you share the weight file? The link provided by the author cannot be downloaded at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants