text
stringlengths
0
5.54k
"DeepFloyd/IF-I-IF-v1.0",
text_encoder=text_encoder, # pass the previously instantiated 8bit text encoder
unet=None,
device_map="auto",
)
prompt = 'a photo of a kangaroo wearing an orange hoodie and blue sunglasses standing in front of the eiffel tower holding a sign that says "very deep learning"'
prompt_embeds, negative_embeds = pipe.encode_prompt(prompt)
# Remove the pipeline so we can re-load the pipeline with the unet
del text_encoder
del pipe
gc.collect()
torch.cuda.empty_cache()
pipe = IFPipeline.from_pretrained(
"DeepFloyd/IF-I-IF-v1.0", text_encoder=None, variant="fp16", torch_dtype=torch.float16, device_map="auto"
)
generator = torch.Generator().manual_seed(0)
image = pipe(
prompt_embeds=prompt_embeds,
negative_prompt_embeds=negative_embeds,
output_type="pt",
generator=generator,
).images
pt_to_pil(image)[0].save("./if_stage_I.png")
# Remove the pipeline so we can load the super-resolution pipeline
del pipe
gc.collect()
torch.cuda.empty_cache()
# First super resolution
pipe = IFSuperResolutionPipeline.from_pretrained(
"DeepFloyd/IF-II-L-v1.0", text_encoder=None, variant="fp16", torch_dtype=torch.float16, device_map="auto"
)
generator = torch.Generator().manual_seed(0)
image = pipe(
image=image,
prompt_embeds=prompt_embeds,
negative_prompt_embeds=negative_embeds,
output_type="pt",
generator=generator,
).images
pt_to_pil(image)[0].save("./if_stage_II.png")
Available Pipelines:
Pipeline
Tasks
Colab
pipeline_if.py
Text-to-Image Generation
-
pipeline_if_superresolution.py
Text-to-Image Generation
-
pipeline_if_img2img.py
Image-to-Image Generation
-
pipeline_if_img2img_superresolution.py
Image-to-Image Generation
-
pipeline_if_inpainting.py
Image-to-Image Generation
-
pipeline_if_inpainting_superresolution.py
Image-to-Image Generation
-
IFPipeline
class diffusers.IFPipeline
<
source
>
(
tokenizer: T5Tokenizer
text_encoder: T5EncoderModel
unet: UNet2DConditionModel
scheduler: DDPMScheduler
safety_checker: typing.Optional[diffusers.pipelines.deepfloyd_if.safety_checker.IFSafetyChecker]
feature_extractor: typing.Optional[transformers.models.clip.image_processing_clip.CLIPImageProcessor]
watermarker: typing.Optional[diffusers.pipelines.deepfloyd_if.watermark.IFWatermarker]
requires_safety_checker: bool = True
)
__call__