abormal behavior
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.tf.debugging.disable_traceback_filtering()
---> 70 raise e.with_traceback(filtered_tb) from None
71 finally:
72 del filtered_tb
File /tmp/autograph_generated_file2lo7vt15.py:84, in outer_factory.
File /tmp/autograph_generated_file2lo7vt15.py:80, in outer_factory.
File /tmp/autograph_generated_file2lo7vt15.py:79, in outer_factory.
File /tmp/autograph_generated_file2lo7vt15.py:48, in outer_factory.
File /tmp/autograph_generated_file2lo7vt15.py:28, in outer_factory.
File /tmp/autograph_generated_filem_kzpxnn.py:11, in outer_factory.
File /tmp/autograph_generated_file612zmgqy.py:23, in outer_factory.
File /tmp/autograph_generated_file612zmgqy.py:21, in outer_factory.
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:
File "/home/ec2-user/anaconda3/envs/art_intel/lib/python3.9/site-packages/stable_diffusion_tf/diffusion_model.py", line 199, in apply *
x = layer([x, emb])
File "/home/ec2-user/anaconda3/envs/art_intel/lib/python3.9/site-packages/keras/utils/traceback_utils.py", line 70, in error_handler **
raise e.with_traceback(filtered_tb) from None
File "/tmp/__autograph_generated_filem_kzpxnn.py", line 11, in tf__call
h = ag__.converted_call(ag__.ld(apply_seq), (ag__.ld(x), ag__.ld(self).in_layers), None, fscope)
File "/tmp/__autograph_generated_file612zmgqy.py", line 23, in tf__apply_seq
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(
ValueError: Exception encountered when calling layer "res_block_22" " f"(type ResBlock).
in user code:
File "/home/ec2-user/anaconda3/envs/art_intel/lib/python3.9/site-packages/stable_diffusion_tf/diffusion_model.py", line 31, in call *
h = apply_seq(x, self.in_layers)
File "/home/ec2-user/anaconda3/envs/art_intel/lib/python3.9/site-packages/stable_diffusion_tf/layers.py", line 41, in apply_seq *
x = l(x)
File "/home/ec2-user/anaconda3/envs/art_intel/lib/python3.9/site-packages/keras/utils/traceback_utils.py", line 70, in error_handler **
raise e.with_traceback(filtered_tb) from None
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(
ValueError: Number of groups (32) cannot be more than the number of channels (4).
Call arguments received by layer "res_block_22" " f"(type ResBlock):
• inputs=['tf.Tensor(shape=(None, 320, 125, 4), dtype=float32)', 'tf.Tensor(shape=(None, 1280), dtype=float32)']
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)']
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.