Text-to-Video
Diffusers
Safetensors
modular_diffusers
vae
ltx2.3
lightricks
video-to-video
text-to-audio
Instructions to use AINovice2005/pruna-vaed-modular-diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use AINovice2005/pruna-vaed-modular-diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("AINovice2005/pruna-vaed-modular-diffusers", 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 block.py
Browse files
block.py
CHANGED
|
@@ -1,41 +1,60 @@
|
|
| 1 |
from diffusers.modular_pipelines import ModularPipelineBlocks, PipelineState
|
| 2 |
-
from diffusers.modular_pipelines.modular_pipeline_utils import
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
from .modeling_prunavae import PrunaAutoencoderKLLTX2Video
|
| 6 |
-
except ImportError:
|
| 7 |
-
from modeling_prunavae import PrunaAutoencoderKLLTX2Video
|
| 8 |
|
| 9 |
|
| 10 |
class LoadPrunaVAE(ModularPipelineBlocks):
|
| 11 |
model_name = "PrunaVAED"
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
@property
|
| 14 |
def description(self) -> str:
|
| 15 |
-
return
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
@property
|
| 18 |
-
def expected_components(self)
|
| 19 |
return [
|
| 20 |
ComponentSpec(
|
| 21 |
"vae",
|
| 22 |
PrunaAutoencoderKLLTX2Video,
|
| 23 |
-
pretrained_model_name_or_path=
|
|
|
|
|
|
|
|
|
|
| 24 |
)
|
| 25 |
]
|
| 26 |
|
| 27 |
@property
|
| 28 |
-
def inputs(self)
|
| 29 |
return []
|
| 30 |
|
| 31 |
@property
|
| 32 |
-
def intermediate_outputs(self)
|
| 33 |
return []
|
| 34 |
|
| 35 |
-
def __call__(self, components, state
|
| 36 |
-
# Nothing to compute here -- this block's only role is to make
|
| 37 |
-
#
|
| 38 |
-
#
|
| 39 |
-
# need it (e.g. a decode step) read it directly off `components`,
|
| 40 |
-
# not off `state`.
|
| 41 |
return components, state
|
|
|
|
| 1 |
from diffusers.modular_pipelines import ModularPipelineBlocks, PipelineState
|
| 2 |
+
from diffusers.modular_pipelines.modular_pipeline_utils import (
|
| 3 |
+
ComponentSpec,
|
| 4 |
+
InputParam,
|
| 5 |
+
OutputParam,
|
| 6 |
+
)
|
| 7 |
|
| 8 |
+
from .modeling_prunavae import PrunaAutoencoderKLLTX2Video
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
class LoadPrunaVAE(ModularPipelineBlocks):
|
| 12 |
model_name = "PrunaVAED"
|
| 13 |
|
| 14 |
+
def __init__(
|
| 15 |
+
self,
|
| 16 |
+
pretrained_model_name_or_path: str = "AINovice2005/pruna-vaed-modular-diffusers",
|
| 17 |
+
subfolder: str | None = None,
|
| 18 |
+
revision: str | None = None,
|
| 19 |
+
variant: str | None = None,
|
| 20 |
+
):
|
| 21 |
+
super().__init__()
|
| 22 |
+
|
| 23 |
+
self.pretrained_model_name_or_path = pretrained_model_name_or_path
|
| 24 |
+
self.subfolder = subfolder
|
| 25 |
+
self.revision = revision
|
| 26 |
+
self.variant = variant
|
| 27 |
+
|
| 28 |
@property
|
| 29 |
def description(self) -> str:
|
| 30 |
+
return (
|
| 31 |
+
"Loads a PrunaAutoencoderKLLTX2Video from the Hugging Face Hub "
|
| 32 |
+
"and exposes it as `components.vae`."
|
| 33 |
+
)
|
| 34 |
|
| 35 |
@property
|
| 36 |
+
def expected_components(self):
|
| 37 |
return [
|
| 38 |
ComponentSpec(
|
| 39 |
"vae",
|
| 40 |
PrunaAutoencoderKLLTX2Video,
|
| 41 |
+
pretrained_model_name_or_path=self.pretrained_model_name_or_path,
|
| 42 |
+
subfolder=self.subfolder,
|
| 43 |
+
revision=self.revision,
|
| 44 |
+
variant=self.variant,
|
| 45 |
)
|
| 46 |
]
|
| 47 |
|
| 48 |
@property
|
| 49 |
+
def inputs(self):
|
| 50 |
return []
|
| 51 |
|
| 52 |
@property
|
| 53 |
+
def intermediate_outputs(self):
|
| 54 |
return []
|
| 55 |
|
| 56 |
+
def __call__(self, components, state):
|
| 57 |
+
# Nothing to compute here -- this block's only role is to make # `components.vae`
|
| 58 |
+
#(a PrunaAutoencoderKLLTX2Video) available to # every block downstream in the pipeline.
|
| 59 |
+
#Blocks that actually # need it (e.g. a decode step) read it directly off `components`, # not off `state`.
|
|
|
|
|
|
|
| 60 |
return components, state
|