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

Update generator_model.py #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update generator_model.py #19

wants to merge 1 commit into from

Conversation

Uha661
Copy link

@Uha661 Uha661 commented Sep 3, 2019

No description provided.

Copy link
Author

@Uha661 Uha661 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StopIteration Traceback (most recent call last)
in ()
9 generator_network, discriminator_network, Gs_network = pickle.load(f)
10
---> 11 generator = Generator(Gs_network, batch_size=1, randomize_noise=False)
12
13

/content/stylegan-encoder/encoder/generator_model.py in init(self, model, batch_size, randomize_noise)
30 self.graph = tf.get_default_graph()
31
---> 32 self.dlatent_variable = next(v for v in tf.global_variables() if 'learnable_dlatents' in v.name)
33 self.set_dlatents(self.initial_dlatents)
34

StopIteration:

@progmars
Copy link

The fix leads to error:

 File "encode_images.py", line 84, in <module>
    main()
  File "encode_images.py", line 57, in main
    generator = Generator(Gs_network, args.batch_size, randomize_noise=args.randomize_noise)
  File "D:\GAN\stylegan\encoder\generator_model.py", line 35, in __init__
    self.set_dlatents(self.initial_dlatents)
  File "D:\GAN\stylegan\encoder\generator_model.py", line 46, in set_dlatents
    self.sess.run(tf.assign(self.dlatent_variable, dlatents))
  File "D:\GAN\Anaconda\lib\site-packages\tensorflow\python\ops\state_ops.py", line 224, in assign
    if ref.dtype._is_ref_dtype:
AttributeError: 'generator' object has no attribute 'dtype'

And it seems to be unnecessary at all. I found that StopIteration error occurs only if you use Nvlabs dmlib instead of this repository dmlib because this one has modifications to pass custom arguments to the run method.

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

Successfully merging this pull request may close these issues.

2 participants