deep-floyd / IF

Other
7.64k stars 497 forks source link

Issue with inpainting #62

Closed Alexadar closed 1 year ago

Alexadar commented 1 year ago

Hi! I;ve tried to launch the inpainting example from the internal notebook and got error.
` ----> 1 result = inpainting( 2 t5=t5, if_I=if_I, 3 if_II=if_II, 4 if_III=if_III, 5 support_pil_img=raw_pil_image.resize((128, 128), resample=Image.BICUBIC), 6 inpainting_mask=inpainting_mask, 7 prompt=[ 8 'blue sunglasses', 9 ], 10 seed=42, 11 if_I_kwargs={ 12 "guidance_scale": 7.0, 13 "sample_timestep_respacing": "10,10,10,10,10,0,0,0,0,0", 14 'support_noise_less_qsample_steps': 0, 15 }, 16 if_II_kwargs={ 17 "guidance_scale": 4.0, 18 'aug_level': 0.0, 19 "sample_timestep_respacing": '100', 20 }, 21 ) 22 if_I.show(result['I'], 2, 3) 23 if_I.show(result['II'], 2, 6)

File ~/miniconda3/envs/df/lib/python3.8/site-packages/deepfloyd_if/pipelines/inpainting.py:61, in inpainting(t5, if_I, if_II, if_III, support_pil_img, prompt, inpainting_mask, negative_prompt, seed, if_I_kwargs, if_II_kwargs, if_III_kwargs, progress, return_tensors, disable_watermark) 57 if_I_kwargs['negative_t5_embs'] = negative_t5_embs 59 if_I_kwargs['support_noise'] = low_res ---> 61 inpainting_mask_I = img_as_bool(resize(inpainting_mask[0].cpu(), (3, image_h, image_w))) 62 inpainting_mask_I = torch.from_numpy(inpainting_mask_I).unsqueeze(0).to(if_I.device) 64 if_I_kwargs['inpainting_mask'] = inpainting_mask_I

File ~/miniconda3/envs/df/lib/python3.8/site-packages/skimage/transform/_warps.py:154, in resize(image, output_shape, order, mode, cval, clip, preserve_range, anti_aliasing, anti_aliasing_sigma) 149 image = image.astype(np.float32) 151 if anti_aliasing is None: 152 anti_aliasing = ( 153 not input_type == bool and --> 154 not (np.issubdtype(input_type, np.integer) and order == 0) and 155 any(x < y for x, y in zip(output_shape, input_shape))) 157 if input_type == bool and anti_aliasing: 158 raise ValueError("anti_aliasing must be False for boolean images")

File ~/miniconda3/envs/df/lib/python3.8/site-packages/numpy/core/numerictypes.py:416, in issubdtype(arg1, arg2) 358 r""" 359 Returns True if first argument is a typecode lower/equal in type hierarchy. 360 (...) 413 414 """ 415 if not issubclass(arg1, generic): --> 416 arg1 = dtype(arg1).type 417 if not issubclass(arg2, generic): 418 arg2 = dtype(arg2).type

TypeError: Cannot interpret 'torch.float32' as a data type `

libs:

image

I assume something wrong with scikit-image, not sure what Please, assist. Thanks!

tomguluson92 commented 1 year ago

I have fix it, please check my pull requrest. https://github.com/deep-floyd/IF/pull/64

Alexadar commented 1 year ago

I have fix it, please check my pull requrest. #64

I Patched it locally manually, It works, Thanks!