--- language: - en license: apache-2.0 base_model: - linlinlinlinsdada/Jeveration pipeline_tag: text-to-image tags: - jeveration - text-to-image - image-to-image - depth-estimation - image-segmentation - modular-diffusers library_name: diffusers --- # Jeveration Modular Diffusers ![A wooden cabin in a snowy pine forest at dusk, generated with the code below](https://huggingface.co/datasets/OzzyGT/diffusers-examples/resolve/main/jeveration/cabin_seed0.png) *Generated with the text-to-image code below, seed `0`.* Modular Diffusers blocks for [Jeveration](https://huggingface.co/linlinlinlinsdada/Jeveration) ([paper](https://arxiv.org/abs/2611.24738), [code](https://github.com/Carol-lyh/Jeveration)), a Qwen3.5-4B that makes a whole 512 x 512 image in one step. One model does text-to-image, image-to-image (edge map or depth map to image, colorization, three styles) and indoor depth, surface normals and segmentation. The blocks ship the model code and load the weights from [OzzyGT/jeveration_diffusers](https://huggingface.co/OzzyGT/jeveration_diffusers). Requires PyTorch, `diffusers>=0.41.0`, `transformers>=5.14.0` and `ftfy`. Installing [`flash-linear-attention`](https://github.com/fla-org/flash-linear-attention) makes the model faster on NVIDIA GPUs; transformers uses it on its own when it is installed. ## Usage ```python import torch from diffusers import ModularPipelineBlocks blocks = ModularPipelineBlocks.from_pretrained("OzzyGT/jeveration_custom_blocks", trust_remote_code=True) pipe = blocks.init_pipeline() pipe.load_components(dtype={"default": torch.bfloat16, "text_encoder": torch.float32}) pipe.to("cuda") ``` This needs about 12 GiB of VRAM. Prompts are in English and images are 512 x 512. ### Text-to-image ```python prompt = ( "A cozy wooden cabin in a snowy pine forest at dusk, warm light glowing from its windows, smoke rising from the " "chimney, snow-covered mountains and a starry purple sky behind it." ) image = pipe(prompt=prompt, generator=torch.Generator("cuda").manual_seed(0)).get("images")[0] image.save("cabin.png") ``` ### Image-to-image Pass an `image` and a `task`. Pictures of other sizes are resized and centre cropped to 512 x 512. | Task | Image | `prompt` | | --- | --- | --- | | `hed` | a soft edge map | a caption of the wanted image | | `depth` | a depth map, bright is near | a caption of the wanted image | | `colorize` | any photo, made grey first | not used | | `anime`, `ghibli`, `watercolor` | a photo | not used | ```python image = pipe(image="cabin.png", task="watercolor", generator=torch.Generator("cuda").manual_seed(0)).get("images")[0] image.save("cabin_watercolor.png") image = pipe(image="cabin.png", task="colorize", generator=torch.Generator("cuda").manual_seed(0)).get("images")[0] image.save("cabin_colorized.png") ``` ### Depth, normals and segmentation For pictures of rooms. ```python state = pipe(image="room.jpg", dense_tasks=["seg", "depth", "normal"]) predictions, pictures = state.get("predictions"), state.get("prediction_images") # predictions["seg"]: class index of every pixel, (1, H, W) # predictions["depth"]: meters, (1, H, W) # predictions["normal"]: unit vectors, (1, H, W, 3) # pictures: the same as PIL images, to look at pictures["depth"][0].save("room_depth.png") ``` The segmentation classes are bed, books, ceiling, chair, floor, furniture, objects, picture, sofa, table, tv, wall and window. The model learned these on indoor scenes; other content works less well. ## Licensing The blocks are [Apache-2.0](https://huggingface.co/OzzyGT/jeveration_custom_blocks/blob/main/LICENSE), with code adapted from [Jeveration](https://github.com/Carol-lyh/Jeveration) and [TA-TiTok](https://github.com/bytedance/1d-tokenizer), both Apache-2.0 (see [NOTICE](https://huggingface.co/OzzyGT/jeveration_custom_blocks/blob/main/NOTICE)). For the weights, see the [model repository](https://huggingface.co/OzzyGT/jeveration_diffusers).