Instructions to use pci-lab/worldflow3d with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use pci-lab/worldflow3d with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("pci-lab/worldflow3d", 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
Upload WorldFlow3D model (converted + remote code)
Browse files- front3d-color/model_index.json +19 -0
- front3d-color/scheduler/scheduler_config.json +7 -0
- front3d-color/scheduler/worldflow3d_scheduler.py +27 -0
- front3d-color/unet/config.json +98 -0
- front3d-color/unet/diffusion_pytorch_model.safetensors +3 -0
- front3d-color/unet/worldflow3d_unet.py +39 -0
- front3d-color/worldflow3d_pipeline.py +35 -0
front3d-color/model_index.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": [
|
| 3 |
+
"worldflow3d_pipeline",
|
| 4 |
+
"WorldFlow3DPipeline"
|
| 5 |
+
],
|
| 6 |
+
"_diffusers_version": "0.29.2",
|
| 7 |
+
"unet": [
|
| 8 |
+
"worldflow3d_unet",
|
| 9 |
+
"WorldFlow3DUNet"
|
| 10 |
+
],
|
| 11 |
+
"scheduler": [
|
| 12 |
+
"worldflow3d_scheduler",
|
| 13 |
+
"WorldFlow3DFlowScheduler"
|
| 14 |
+
],
|
| 15 |
+
"vae": [
|
| 16 |
+
null,
|
| 17 |
+
null
|
| 18 |
+
]
|
| 19 |
+
}
|
front3d-color/scheduler/scheduler_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": "WorldFlow3DFlowScheduler",
|
| 3 |
+
"_diffusers_version": "0.29.2",
|
| 4 |
+
"num_train_timesteps": 1000,
|
| 5 |
+
"prediction_type": "flow_velocity",
|
| 6 |
+
"sigma_min": 0.0001
|
| 7 |
+
}
|
front3d-color/scheduler/worldflow3d_scheduler.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Remote-code mirror for ``WorldFlow3DFlowScheduler`` (diffusers ``trust_remote_code``).
|
| 2 |
+
|
| 3 |
+
Referenced from ``model_index.json`` as the ``scheduler`` component::
|
| 4 |
+
|
| 5 |
+
"scheduler": ["worldflow3d_scheduler", "WorldFlow3DFlowScheduler"]
|
| 6 |
+
|
| 7 |
+
and placed inside the component subfolder ``<repo>/scheduler/worldflow3d_scheduler.py``
|
| 8 |
+
(see ``worldflow3d_unet.py`` for the resolution rule diffusers 0.29.2 uses).
|
| 9 |
+
|
| 10 |
+
The scheduler is pure-python (numpy + torch, no custom kernels) so it *could* be
|
| 11 |
+
made fully self-contained here. We keep it a thin re-export of the installed
|
| 12 |
+
``worldflow3d`` class for a single source of truth: that guarantees the Hub load
|
| 13 |
+
path and the local ``from_converted`` path use byte-identical step math. If you
|
| 14 |
+
ever need a zero-dependency remote scheduler, inline the body of
|
| 15 |
+
``worldflow3d.pipeline.scheduler`` here — it has no project-internal imports.
|
| 16 |
+
"""
|
| 17 |
+
try:
|
| 18 |
+
from worldflow3d.pipeline.scheduler import WorldFlow3DFlowScheduler
|
| 19 |
+
except ImportError as exc: # pragma: no cover - actionable message at load time
|
| 20 |
+
raise ImportError(
|
| 21 |
+
"Loading a WorldFlow3D model via trust_remote_code requires the "
|
| 22 |
+
"'worldflow3d' package to be installed. Install it first, e.g.\n"
|
| 23 |
+
" pip install --index-url https://test.pypi.org/simple/ worldflow3d # private dry-run\n"
|
| 24 |
+
" pip install worldflow3d # public"
|
| 25 |
+
) from exc
|
| 26 |
+
|
| 27 |
+
__all__ = ["WorldFlow3DFlowScheduler"]
|
front3d-color/unet/config.json
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": "WorldFlow3DUNet",
|
| 3 |
+
"_diffusers_version": "0.29.2",
|
| 4 |
+
"attention_resolutions": [
|
| 5 |
+
16,
|
| 6 |
+
8,
|
| 7 |
+
4
|
| 8 |
+
],
|
| 9 |
+
"channel_mult": [
|
| 10 |
+
1,
|
| 11 |
+
2,
|
| 12 |
+
4,
|
| 13 |
+
8
|
| 14 |
+
],
|
| 15 |
+
"dropout": 0.0,
|
| 16 |
+
"geometry_channels": 0,
|
| 17 |
+
"in_channels": 4,
|
| 18 |
+
"inpainting_channels": 0,
|
| 19 |
+
"level_meta": {
|
| 20 |
+
"H_channels": 4,
|
| 21 |
+
"L_channels": 0,
|
| 22 |
+
"channels": {
|
| 23 |
+
"geometry": 0,
|
| 24 |
+
"in": 4,
|
| 25 |
+
"inpainting": 0,
|
| 26 |
+
"map": 0,
|
| 27 |
+
"micro": 0,
|
| 28 |
+
"out": 4,
|
| 29 |
+
"outpainting": 0,
|
| 30 |
+
"tag": 0
|
| 31 |
+
},
|
| 32 |
+
"dataset_type": "front3d",
|
| 33 |
+
"direct_diffusion": true,
|
| 34 |
+
"factor": 2,
|
| 35 |
+
"generator_type": "UNet3D",
|
| 36 |
+
"has_layout": false,
|
| 37 |
+
"has_tags": false,
|
| 38 |
+
"initial_distribution": "tudf_0p044_latent",
|
| 39 |
+
"is_coarsest": false,
|
| 40 |
+
"layout_config": null,
|
| 41 |
+
"layout_types": null,
|
| 42 |
+
"level_name": "tudf_0p044_color",
|
| 43 |
+
"output_chunk_size": [
|
| 44 |
+
96,
|
| 45 |
+
96,
|
| 46 |
+
96
|
| 47 |
+
],
|
| 48 |
+
"source_noise_std": 0.25,
|
| 49 |
+
"tag_types": null,
|
| 50 |
+
"truncation": 0.1,
|
| 51 |
+
"use_color": true,
|
| 52 |
+
"use_separate_color_head": true,
|
| 53 |
+
"voxel_size": 0.022
|
| 54 |
+
},
|
| 55 |
+
"level_spec": {
|
| 56 |
+
"H_channels": 4,
|
| 57 |
+
"L_channels": 0,
|
| 58 |
+
"custom_output_chunk_size": [
|
| 59 |
+
96,
|
| 60 |
+
96,
|
| 61 |
+
96
|
| 62 |
+
],
|
| 63 |
+
"feature_channels": 0,
|
| 64 |
+
"input_voxel_size": 0.044,
|
| 65 |
+
"internal_feature_channels": null,
|
| 66 |
+
"is_coarsest": false,
|
| 67 |
+
"is_finest": true,
|
| 68 |
+
"is_pure_latent": false,
|
| 69 |
+
"level_index": 1,
|
| 70 |
+
"mode": "tudf",
|
| 71 |
+
"name": "tudf_0p044_color",
|
| 72 |
+
"normalize_latent": false,
|
| 73 |
+
"normalize_points": true,
|
| 74 |
+
"output_type": "voxel",
|
| 75 |
+
"output_voxel_size": 0.022,
|
| 76 |
+
"pretrained_TRELLIS": false,
|
| 77 |
+
"reduce_spatial_extent": false,
|
| 78 |
+
"representation": "dense",
|
| 79 |
+
"sparse_latent": false,
|
| 80 |
+
"truncation": 0.1,
|
| 81 |
+
"use_color": true,
|
| 82 |
+
"use_feature_supervision": false,
|
| 83 |
+
"use_features": false,
|
| 84 |
+
"with_occupancy": true
|
| 85 |
+
},
|
| 86 |
+
"map_channels": 0,
|
| 87 |
+
"micro_channels": 0,
|
| 88 |
+
"model_channels": 128,
|
| 89 |
+
"num_head_channels": -1,
|
| 90 |
+
"num_heads": 8,
|
| 91 |
+
"num_res_blocks": 2,
|
| 92 |
+
"out_channels": 4,
|
| 93 |
+
"outpainting_channels": 0,
|
| 94 |
+
"tag_channels": 0,
|
| 95 |
+
"use_fp16": false,
|
| 96 |
+
"use_scale_shift_norm": true,
|
| 97 |
+
"use_separate_color_head": true
|
| 98 |
+
}
|
front3d-color/unet/diffusion_pytorch_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5657bf5363c00ad229093254fb6259d19bbf71ad7ddc2a39595c2e631fdb6220
|
| 3 |
+
size 2688898936
|
front3d-color/unet/worldflow3d_unet.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Remote-code mirror for ``WorldFlow3DUNet`` (diffusers ``trust_remote_code``).
|
| 2 |
+
|
| 3 |
+
This single file is what diffusers downloads + executes when loading a published
|
| 4 |
+
WorldFlow3D repo from the Hub. It is referenced from ``model_index.json`` as the
|
| 5 |
+
``unet`` component::
|
| 6 |
+
|
| 7 |
+
"unet": ["worldflow3d_unet", "WorldFlow3DUNet"]
|
| 8 |
+
|
| 9 |
+
and must be placed **inside the component subfolder** of the repo, i.e.
|
| 10 |
+
``<repo>/unet/worldflow3d_unet.py``. diffusers 0.29.2 resolves a component
|
| 11 |
+
``[library_name, class_name]`` by first checking
|
| 12 |
+
``os.path.isfile(<component_folder>/<library_name>.py)`` — if present it loads the
|
| 13 |
+
class via ``get_class_from_dynamic_module`` (the trust-remote-code path); otherwise
|
| 14 |
+
it falls back to ``importlib.import_module(library_name)`` (which fails for a
|
| 15 |
+
custom top-level module name like ``worldflow3d_unet``). Hence the file lives next
|
| 16 |
+
to ``unet/config.json``.
|
| 17 |
+
|
| 18 |
+
Contract: this is a *thin re-export* of the real class from the installed
|
| 19 |
+
``worldflow3d`` package. The full UNet torso lives in ``worldflow3d.models`` (a
|
| 20 |
+
multi-file subpackage with sparse-conv / attention kernels) which is impractical to
|
| 21 |
+
mirror as a single remote file, so the published-Hub flow REQUIRES the
|
| 22 |
+
``worldflow3d`` package to be pip-installed (TestPyPI for the private dry-run, then
|
| 23 |
+
PyPI). The re-exported class is a genuine ``ModelMixin``/``ConfigMixin`` subclass,
|
| 24 |
+
so ``WorldFlow3DUNet.from_pretrained(<repo>/unet)`` round-trips identically whether
|
| 25 |
+
diffusers resolves the class from here or from the installed package.
|
| 26 |
+
"""
|
| 27 |
+
try:
|
| 28 |
+
from worldflow3d.pipeline.unet import WorldFlow3DUNet, WorldFlow3DUNetOutput
|
| 29 |
+
except ImportError as exc: # pragma: no cover - actionable message at load time
|
| 30 |
+
raise ImportError(
|
| 31 |
+
"Loading a WorldFlow3D model via trust_remote_code requires the "
|
| 32 |
+
"'worldflow3d' package to be installed (the remote files re-export the "
|
| 33 |
+
"real classes from it; the UNet torso cannot be a single remote file). "
|
| 34 |
+
"Install it first, e.g.\n"
|
| 35 |
+
" pip install --index-url https://test.pypi.org/simple/ worldflow3d # private dry-run\n"
|
| 36 |
+
" pip install worldflow3d # public"
|
| 37 |
+
) from exc
|
| 38 |
+
|
| 39 |
+
__all__ = ["WorldFlow3DUNet", "WorldFlow3DUNetOutput"]
|
front3d-color/worldflow3d_pipeline.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Remote-code mirror for ``WorldFlow3DPipeline`` (diffusers ``trust_remote_code``).
|
| 2 |
+
|
| 3 |
+
This is the top-level custom-pipeline file diffusers downloads + executes when the
|
| 4 |
+
repo's ``model_index.json`` declares a *list* ``_class_name``::
|
| 5 |
+
|
| 6 |
+
"_class_name": ["worldflow3d_pipeline", "WorldFlow3DPipeline"]
|
| 7 |
+
|
| 8 |
+
In diffusers 0.29.2 (``pipeline_utils.py:744-751``) a list ``_class_name`` makes the
|
| 9 |
+
loader look for ``<repo>/worldflow3d_pipeline.py`` at the **repo root** (not inside a
|
| 10 |
+
subfolder), import it via ``get_class_from_dynamic_module``, and use
|
| 11 |
+
``_class_name[1]`` as the class. ``trust_remote_code=True`` must be passed.
|
| 12 |
+
|
| 13 |
+
NOTE: when ``_class_name`` is a plain string (``"WorldFlow3DPipeline"``) the loader
|
| 14 |
+
instead requires the class to be importable from the installed ``diffusers`` or the
|
| 15 |
+
class you call ``from_pretrained`` on — which is why we publish with the *list* form
|
| 16 |
+
so a bare ``DiffusionPipeline.from_pretrained(repo, trust_remote_code=True)`` works
|
| 17 |
+
without the caller importing ``worldflow3d`` first.
|
| 18 |
+
|
| 19 |
+
Like the component mirrors, this re-exports the real class. The pipeline body pulls
|
| 20 |
+
in the vendored ``conditioning``/``recon`` subpackages, so the installed
|
| 21 |
+
``worldflow3d`` package is required (TestPyPI private dry-run, then PyPI).
|
| 22 |
+
"""
|
| 23 |
+
try:
|
| 24 |
+
from worldflow3d.pipeline.pipeline import WorldFlow3DPipeline
|
| 25 |
+
except ImportError as exc: # pragma: no cover - actionable message at load time
|
| 26 |
+
raise ImportError(
|
| 27 |
+
"Loading a WorldFlow3D pipeline via trust_remote_code requires the "
|
| 28 |
+
"'worldflow3d' package to be installed (the remote pipeline file re-exports "
|
| 29 |
+
"the real class, which depends on the vendored conditioning/recon "
|
| 30 |
+
"subpackages). Install it first, e.g.\n"
|
| 31 |
+
" pip install --index-url https://test.pypi.org/simple/ worldflow3d # private dry-run\n"
|
| 32 |
+
" pip install worldflow3d # public"
|
| 33 |
+
) from exc
|
| 34 |
+
|
| 35 |
+
__all__ = ["WorldFlow3DPipeline"]
|