"vscode:/vscode.git/clone" did not exist on "81fb06f5307349244263a199d66eb30926a71d28"
auto_pipeline.md 2.26 KB
Newer Older
YiYi Xu's avatar
YiYi Xu committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!--Copyright 2023 The HuggingFace Team. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
-->

# AutoPipeline

15
`AutoPipeline` is designed to:
YiYi Xu's avatar
YiYi Xu committed
16

17
18
1. make it easy for you to load a checkpoint for a task without knowing the specific pipeline class to use
2. use multiple pipelines in your workflow
YiYi Xu's avatar
YiYi Xu committed
19

20
Based on the task, the `AutoPipeline` class automatically retrieves the relevant pipeline given the name or path to the pretrained weights with the `from_pretrained()` method.
YiYi Xu's avatar
YiYi Xu committed
21

22
To seamlessly switch between tasks with the same checkpoint without reallocating additional memory, use the `from_pipe()` method to transfer the components from the original pipeline to the new one.
YiYi Xu's avatar
YiYi Xu committed
23

24
25
26
27
28
29
30
31
32
33
```py
from diffusers import AutoPipelineForText2Image
import torch

pipeline = AutoPipelineForText2Image.from_pretrained(
    "runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16, use_safetensors=True
).to("cuda")
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"

image = pipeline(prompt, num_inference_steps=25).images[0]
YiYi Xu's avatar
YiYi Xu committed
34
35
```

36
<Tip>
YiYi Xu's avatar
YiYi Xu committed
37

38
Check out the [AutoPipeline](/tutorials/autopipeline) tutorial to learn how to use this API!
YiYi Xu's avatar
YiYi Xu committed
39

40
</Tip>
YiYi Xu's avatar
YiYi Xu committed
41

42
`AutoPipeline` supports text-to-image, image-to-image, and inpainting for the following diffusion models:
YiYi Xu's avatar
YiYi Xu committed
43

44
- [Stable Diffusion](./stable_diffusion)
Lucain's avatar
Lucain committed
45
- [ControlNet](./controlnet)
46
47
- [Stable Diffusion XL (SDXL)](./stable_diffusion/stable_diffusion_xl)
- [DeepFloyd IF](./if) 
YiYi Xu's avatar
YiYi Xu committed
48
- [Kandinsky](./kandinsky)
49
- [Kandinsky 2.2](./kandinsky#kandinsky-22)
YiYi Xu's avatar
YiYi Xu committed
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74


## AutoPipelineForText2Image

[[autodoc]] AutoPipelineForText2Image
	- all
	- from_pretrained
	- from_pipe


## AutoPipelineForImage2Image

[[autodoc]] AutoPipelineForImage2Image
	- all
	- from_pretrained
	- from_pipe

## AutoPipelineForInpainting

[[autodoc]] AutoPipelineForInpainting
	- all
	- from_pretrained
	- from_pipe