Update README.md
Browse files
README.md
CHANGED
|
@@ -150,5 +150,36 @@ vae = AutoencoderKL.from_single_file(
|
|
| 150 |
It's trickier if the VAE is in [CivitAI](civitai.com), because you can't use
|
| 151 |
`from_single_file()` method. It only works for files inside HuggingFace and local files only. You can upload the VAE from there into
|
| 152 |
HuggingFace, but you must comply with the model's license before continuing. To solve this issue, you may
|
| 153 |
-
use `wget` or `curl` command to get the file from outside HuggingFace.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
# That's all for this repository. Thank you for reading my silly note. Have a nice day!
|
|
|
|
| 150 |
It's trickier if the VAE is in [CivitAI](civitai.com), because you can't use
|
| 151 |
`from_single_file()` method. It only works for files inside HuggingFace and local files only. You can upload the VAE from there into
|
| 152 |
HuggingFace, but you must comply with the model's license before continuing. To solve this issue, you may
|
| 153 |
+
use `wget` or `curl` command to get the file from outside HuggingFace.
|
| 154 |
+
|
| 155 |
+
Before downloading, to organize the VAE file you want to use and download, change
|
| 156 |
+
the directory to save the downloaded model with `cd`
|
| 157 |
+
and use `-O` option before specifying the file's link and name. It's the same thing
|
| 158 |
+
for both `wget` and `curl`.
|
| 159 |
+
```py
|
| 160 |
+
# For 'wget'
|
| 161 |
+
!cd <path>; wget -O [filename.safetensors] <link>
|
| 162 |
+
|
| 163 |
+
# For 'curl'
|
| 164 |
+
!cd <path>; curl -O [filename.safetensors] <link>
|
| 165 |
+
|
| 166 |
+
# Use only one of them. Replace "filename" with any
|
| 167 |
+
# name you want. If you run the code in Command Prompt or
|
| 168 |
+
# Windows Shell, you don't need the exclamation mark (!).
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
Since the file is now in your local directory, you can
|
| 172 |
+
finally use `from_single_file()` method normally. Make sure to
|
| 173 |
+
input the correct path for your VAE file. Load the VAE file into [AutoencoderKL](https://huggingface.co/docs/diffusers/en/api/models/autoencoderkl).
|
| 174 |
+
```py
|
| 175 |
+
path = "path to VAE" # Ends with .safetensors file format.
|
| 176 |
+
model = "IDK-ab0ut/Yiffymix_v51"
|
| 177 |
+
vae = AutoencoderKL.from_single_file(path).to("cuda")
|
| 178 |
+
pipeline = StableDiffusionXLPipeline.from_pretrained(
|
| 179 |
+
model, vae=vae).to("cuda")
|
| 180 |
+
|
| 181 |
+
# Use 'torch_dtype=torch.float16' for both
|
| 182 |
+
# AutoencoderKL and SDXL pipeline for FP16.
|
| 183 |
+
```
|
| 184 |
+
|
| 185 |
# That's all for this repository. Thank you for reading my silly note. Have a nice day!
|