OSError: No file named diffusion_pythorch_model.bin

#5
by marcii98 - opened

Hi, when trying to use the RealVisXL_V4.0_inpainting, I get an error message:

"OSError: Error no file named diffusion_pytorch_model.bin found in directory C:\Users\User1.cache\huggingface\hub\models--OzzyGT--RealVisXL_V4.0_inpainting\snapshots\5f1d01afee449cf27fe062dba7e7c4497245a77a\vae."

I look into my .cache file and actually there is no file besides config.json. So I manually downloaded the file: "diffusion_pytorch_model.fp16.safetensors" for vae, unet, text_encoder and text_encoder2 (found in the Files and versions directory here in huggingface). However, after having these files in my local directory, I still get the same error. Did someone face this issue too? Would be awesome to get help here :D

My code:

class InstructPix2PixTransform(BaseImageTransform):
def init(self, config: Config_Summary):
super().init(config)
self.augm_probability = config.augm_probability
self.prompt = config.prompt
self.pipe = DiffusionPipeline.from_pretrained("OzzyGT/RealVisXL_V4.0_inpainting", torch_dtype=torch.float32)
self.pipe.to("cuda" if torch.cuda.is_available() else "cpu")

def process_image(self, img: Image.Image) -> Image.Image:

    if random.uniform(0, 1) < self.augm_probability:
        augmented_img = self.pipe(prompt=self.prompt, image=img).images[0]
        return augmented_img

    return img

def get_augm_steps(self):
    _augm_steps = super().get_transformation_steps()
    _augm_steps.insert(1, transforms.Lambda(self.process_image))
    return _augm_steps

def get_transform_operations(self):
    augmentation_data = transforms.Compose(self.get_augm_steps())
    return augmentation_data

Hi, that's because you're trying to load the fp32 version and this repo only has the fp6 version with the "variant" option, you should load this checkpoint like this:

self.pipe = DiffusionPipeline.from_pretrained("OzzyGT/RealVisXL_V4.0_inpainting", variant="fp16", torch_dtype=torch.float16)

Sign up or log in to comment