Text-to-Image
Diffusers
English
jeveration
image-to-image
depth-estimation
image-segmentation
modular-diffusers
Run this model with HF Jobs
Run OzzyGT/jeveration_custom_blocks on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/OzzyGT/jeveration_custom_blocks. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/OzzyGT/jeveration_custom_blocks on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use OzzyGT/jeveration_custom_blocks with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use OzzyGT/jeveration_custom_blocks 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/jeveration_custom_blocks", 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
- Local Apps Settings
- Draw Things
- DiffusionBee
File size: 3,016 Bytes
c60a1b3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | # Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0. See the LICENSE file in this repository.
import torch
from diffusers.modular_pipelines import ModularPipelineBlocks, PipelineState
from diffusers.modular_pipelines.modular_pipeline_utils import ComponentSpec, InputParam, OutputParam
from diffusers.utils.torch_utils import get_module_execution_device
from .components import transformer_spec
class JeverationDecideStep(ModularPipelineBlocks):
model_name = "jeveration"
@property
def description(self) -> str:
return (
"Step that decides the image in one forward pass: a shared random state is drawn, the backbone reads the "
"request and 128 decision tokens built from that state, and every code is sampled at once."
)
@property
def expected_components(self) -> list[ComponentSpec]:
return [transformer_spec()]
@property
def inputs(self) -> list[InputParam]:
return [
InputParam("input_ids", required=True, type_hint=torch.Tensor, description="Request token ids `[B, L]`."),
InputParam(
"attention_mask", required=True, type_hint=torch.Tensor, description="Padding mask of the request ids."
),
InputParam("position_ids", type_hint=torch.Tensor, description="Rotary positions of an image request."),
InputParam("pixel_values", type_hint=torch.Tensor, description="The source images of an image request."),
InputParam.template("generator"),
]
@property
def intermediate_outputs(self) -> list[OutputParam]:
return [OutputParam("codes", type_hint=torch.Tensor, description="Image codes `[B, 128]`, int64.")]
@torch.no_grad()
def __call__(self, components, state: PipelineState) -> PipelineState:
block_state = self.get_block_state(state)
transformer = components.transformer
device = get_module_execution_device(transformer)
generator = block_state.generator
random_state, masked_share = transformer.sample_random_state(block_state.input_ids.shape[0], generator)
logits = transformer(
input_ids=block_state.input_ids.to(device),
attention_mask=block_state.attention_mask.to(device),
position_ids=None if block_state.position_ids is None else block_state.position_ids.to(device),
pixel_values=None if block_state.pixel_values is None else block_state.pixel_values.to(device),
random_state=random_state,
masked_share=masked_share,
).logits
probs = torch.softmax(logits.float(), -1)
draw_device = generator.device if generator is not None else probs.device
codes = torch.multinomial(probs.view(-1, probs.shape[-1]).to(draw_device), 1, generator=generator)
block_state.codes = codes.view(logits.shape[:2])
self.set_block_state(state, block_state)
return components, state
|