Instructions to use OzzyGT/YuE2-Modular with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use OzzyGT/YuE2-Modular with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("OzzyGT/YuE2-Modular", 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
load components from modular index
Browse files
blocks.py
CHANGED
|
@@ -9,6 +9,7 @@ from diffusers.modular_pipelines import (
|
|
| 9 |
ComponentSpec,
|
| 10 |
InputParam,
|
| 11 |
LoopSequentialPipelineBlocks,
|
|
|
|
| 12 |
ModularPipelineBlocks,
|
| 13 |
OutputParam,
|
| 14 |
SequentialPipelineBlocks,
|
|
@@ -480,14 +481,12 @@ class YuE2Blocks(SequentialPipelineBlocks):
|
|
| 480 |
if components_repo is not None:
|
| 481 |
if not trust_components_code:
|
| 482 |
raise ValueError("Set trust_components_code=True to load code from the model repository")
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
("tokenizer", "YuE2Tokenizer"),
|
| 487 |
-
):
|
| 488 |
self.component_types[name] = get_class_from_dynamic_module(
|
| 489 |
components_repo,
|
| 490 |
-
module_file=f"{
|
| 491 |
class_name=class_name,
|
| 492 |
revision=components_revision,
|
| 493 |
trust_remote_code=True,
|
|
|
|
| 9 |
ComponentSpec,
|
| 10 |
InputParam,
|
| 11 |
LoopSequentialPipelineBlocks,
|
| 12 |
+
ModularPipeline,
|
| 13 |
ModularPipelineBlocks,
|
| 14 |
OutputParam,
|
| 15 |
SequentialPipelineBlocks,
|
|
|
|
| 481 |
if components_repo is not None:
|
| 482 |
if not trust_components_code:
|
| 483 |
raise ValueError("Set trust_components_code=True to load code from the model repository")
|
| 484 |
+
index = ModularPipeline.load_config(components_repo, revision=components_revision)
|
| 485 |
+
for name in ("transformer", "vae", "tokenizer"):
|
| 486 |
+
module_name, class_name, _ = index[name]
|
|
|
|
|
|
|
| 487 |
self.component_types[name] = get_class_from_dynamic_module(
|
| 488 |
components_repo,
|
| 489 |
+
module_file=f"{module_name}.py",
|
| 490 |
class_name=class_name,
|
| 491 |
revision=components_revision,
|
| 492 |
trust_remote_code=True,
|