Open dentistfrankchen opened 1 year ago
What size did you try to make the image?
On May 1, 2023, at 09:22, dentistfrankchen @.***> wrote:
self._check_size_of_dimensions(input_shape
@WSINTRA A 512x512 image. I have already tried the code on the main page and added img_height=..., img_width=..., but that did not work. I still got the same error.
I followed and copied the code on your main page, however it did not behave normally: ValueError Traceback (most recent call last) Cell In[5], line 4 1 from stable_diffusion_tf.stable_diffusion import StableDiffusion 2 from PIL import Image ----> 4 generator = StableDiffusion()
File ~/anaconda3/envs/art_intel/lib/python3.9/site-packages/stable_diffusion_tf/stable_diffusion.py:24, in StableDiffusion.init(self, img_height, img_width, jit_compile, download_weights) 21 self.img_width = img_width 22 self.tokenizer = SimpleTokenizer() ---> 24 text_encoder, diffusion_model, decoder, encoder = get_models(img_height, img_width, download_weights=download_weights) 25 self.text_encoder = text_encoder 26 self.diffusion_model = diffusion_model
File ~/anaconda3/envs/art_intel/lib/python3.9/site-packages/stable_diffusion_tf/stable_diffusion.py:238, in get_models(img_height, img_width, download_weights) 235 latent = keras.layers.Input((n_h, n_w, 4)) 236 unet = UNetModel() 237 diffusion_model = keras.models.Model( --> 238 [latent, t_emb, context], unet([latent, t_emb, context]) 239 ) 241 # Create decoder 242 latent = keras.layers.Input((n_h, n_w, 4))
File ~/anaconda3/envs/art_intel/lib/python3.9/site-packages/keras/utils/traceback_utils.py:70, in filter_traceback..error_handler(*args, **kwargs)
67 filtered_tb = _process_traceback_frames(e.traceback)
68 # To get the full stack trace, call:
69 #
tf.debugging.disable_traceback_filtering()
---> 70 raise e.with_traceback(filtered_tb) from None 71 finally: 72 del filtered_tbFile /tmp/autograph_generated_file2lo7vt15.py:84, in outer_factory..inner_factory..tf call(self, inputs)
82 layer = ag.Undefined('layer')
83 b = ag.Undefined('b')
---> 84 ag__.for_stmt(ag__.ld(self).input_blocks, None, loop_body_1, get_state_3, set_state_3, ('x',), {'iterate_names': 'b'})
86 def get_state_4():
87 return (x,)
File /tmp/autograph_generated_file2lo7vt15.py:80, in outer_factory..inner_factory..tf call..loop_body_1(itr_1)
78 layer = itr
79 x = ag.converted_call(ag.ld(apply), (ag.ld(x), ag.ld(layer)), None, fscope)
---> 80 ag.for_stmt(ag.ld(b), None, loop_body, get_state_2, set_state_2, ('x',), {'iterate_names': 'layer'})
81 ag.converted_call(ag__.ld(saved_inputs).append, (ag.ld(x),), None, fscope)
File /tmp/autograph_generated_file2lo7vt15.py:79, in outer_factory..inner_factory..tf call..loop_body_1..loop_body(itr)
77 nonlocal x
78 layer = itr
---> 79 x = ag__.converted_call(ag.ld(apply), (ag.ld(x), ag__.ld(layer)), None, fscope)
File /tmp/autograph_generated_file2lo7vt15.py:48, in outer_factory..inner_factory..tf call..apply(x, layer)
46 x = ag.converted_call(ag.ld(layer), (ag.ld(x),), None, fscope_1)
47 ag.if_stmt(ag.converted_call(ag.ld(isinstance), (ag.ld(layer), ag__.ld(SpatialTransformer)), None, fscope_1), if_body, else_body, get_state, set_state, ('x',), 1)
---> 48 ag.if_stmt(ag__.converted_call(ag.ld(isinstance), (ag.ld(layer), ag__.ld(ResBlock)), None, fscope_1), if_body_1, else_body_1, get_state_1, set_state_1, ('x',), 1)
49 try:
50 do_return_1 = True
File /tmp/autograph_generated_file2lo7vt15.py:28, in outer_factory..inner_factory..tf call..apply..if_body_1()
26 def if_body_1():
27 nonlocal x
---> 28 x = ag__.converted_call(ag.ld(layer), ([ag.ld(x), ag__.ld(emb)],), None, fscope_1)
File /tmp/autograph_generated_filem_kzpxnn.py:11, in outer_factory..inner_factory..tf_call(self, inputs)
9 retval = ag .UndefinedReturnValue()
10 (x, emb) = ag.ld(inputs)
---> 11 h = ag.converted_call(ag.ld(apply_seq), (ag.ld(x), ag.ld(self).in_layers), None, fscope)
12 emb_out = ag__.converted_call(ag.ld(apply_seq), (ag.ld(emb), ag.ld(self).emb_layers), None, fscope)
13 h = ag.ld(h) + ag.ld(emb_out)[:, None, None]
File /tmp/autograph_generated_file612zmgqy.py:23, in outer_factory..inner_factory..tf apply_seq(x, layers)
21 x = ag.converted_call(ag.ld(l), (ag.ld(x),), None, fscope)
22 l = ag.Undefined('l')
---> 23 ag.for_stmt(ag.ld(layers), None, loop_body, get_state, set_state, ('x',), {'iterate_names': 'l'})
24 try:
25 do_return = True
File /tmp/autograph_generated_file612zmgqy.py:21, in outer_factory..inner_factory..tf apply_seq..loop_body(itr)
19 nonlocal x
20 l = itr
---> 21 x = ag__.converted_call(ag.ld(l), (ag.ld(x),), None, fscope)
File ~/anaconda3/envs/art_intel/lib/python3.9/site-packages/tensorflow_addons/layers/normalizations.py:110, in GroupNormalization.build(self, input_shape) 108 self._check_if_input_shape_is_none(input_shape) 109 self._set_number_of_groups_for_instance_norm(input_shape) --> 110 self._check_size_of_dimensions(input_shape) 111 self._create_input_spec(input_shape) 113 self._add_gamma_weight(input_shape)
File ~/anaconda3/envs/art_intel/lib/python3.9/site-packages/tensorflow_addons/layers/normalizations.py:227, in GroupNormalization._check_size_of_dimensions(self, input_shape) 225 dim = input_shape[self.axis] 226 if dim < self.groups: --> 227 raise ValueError( 228 "Number of groups (" + str(self.groups) + ") cannot be " 229 "more than the number of channels (" + str(dim) + ")." 230 ) 232 if dim % self.groups != 0: 233 raise ValueError( 234 "Number of groups (" + str(self.groups) + ") must be a " 235 "multiple of the number of channels (" + str(dim) + ")." 236 )
ValueError: Exception encountered when calling layer "u_net_model_1" (type UNetModel).
in user code:
ag.for_stmt(ag.ld(layers), None, loop_body, get_state, set_state, ('x',), {'iterate_names': 'l'}) File "/tmp/autograph_generated_file612zmgqy.py", line 21, in loop_body x = ag.converted_call(ag.ld(l), (ag.ld(x),), None, fscope) File "/home/ec2-user/anaconda3/envs/art_intel/lib/python3.9/site-packages/tensorflow_addons/layers/normalizations.py", line 110, in build self._check_size_of_dimensions(input_shape) File "/home/ec2-user/anaconda3/envs/art_intel/lib/python3.9/site-packages/tensorflow_addons/layers/normalizations.py", line 227, in _check_size_of_dimensions raise ValueError(
Call arguments received by layer "u_net_model_1" (type UNetModel): • inputs=['tf.Tensor(shape=(None, 125, 125, 4), dtype=float32)', 'tf.Tensor(shape=(None, 320), dtype=float32)', 'tf.Tensor(shape=(None, 77, 768), dtype=float32)']