Instructions to use diffusers/sd-vae-ft-mse with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use diffusers/sd-vae-ft-mse with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("diffusers/sd-vae-ft-mse", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Update handler.py
Browse files- handler.py +0 -8
handler.py
CHANGED
|
@@ -8,14 +8,6 @@ from diffusers.image_processor import VaeImageProcessor
|
|
| 8 |
class EndpointHandler:
|
| 9 |
def __init__(self, path=""):
|
| 10 |
kwargs = {"torch_dtype": torch.float16}
|
| 11 |
-
model_data = model_info(path)
|
| 12 |
-
has_model_index = any(
|
| 13 |
-
file.rfilename == "model_index.json" for file in model_data.siblings
|
| 14 |
-
)
|
| 15 |
-
|
| 16 |
-
if has_model_index:
|
| 17 |
-
kwargs["subfolder"] = "vae"
|
| 18 |
-
|
| 19 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 20 |
self.dtype = kwargs["torch_dtype"]
|
| 21 |
self.vae = AutoencoderKL.from_pretrained(path, **kwargs).to(self.device).eval()
|
|
|
|
| 8 |
class EndpointHandler:
|
| 9 |
def __init__(self, path=""):
|
| 10 |
kwargs = {"torch_dtype": torch.float16}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 12 |
self.dtype = kwargs["torch_dtype"]
|
| 13 |
self.vae = AutoencoderKL.from_pretrained(path, **kwargs).to(self.device).eval()
|