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.
File size: 2,906 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
66
67
68
69
70
71
72
# Copyright 2026 The HuggingFace Team and The Jeveration Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0. See the LICENSE and NOTICE files in this repository.
#
# Adapted from the Jeveration code (https://github.com/Carol-lyh/Jeveration, Apache-2.0): jeveration/pipeline.py.

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 JeverationDensePredictStep(ModularPipelineBlocks):
    model_name = "jeveration"

    @property
    def description(self) -> str:
        return (
            "Step that predicts the raw per-pixel maps of every request row in one forward pass: segmentation logits, "
            "log-depth or surface normals, at the dense input size."
        )

    @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 `[rows, L]`."
            ),
            InputParam(
                "attention_mask", required=True, type_hint=torch.Tensor, description="Padding mask of the request ids."
            ),
            InputParam(
                "position_ids", required=True, type_hint=torch.Tensor, description="Rotary positions `[3, rows, L]`."
            ),
            InputParam(
                "pixel_values", required=True, type_hint=torch.Tensor, description="The resized pictures, uint8."
            ),
            InputParam("dense_rows", required=True, type_hint=list, description="The task of each request row."),
        ]

    @property
    def intermediate_outputs(self) -> list[OutputParam]:
        return [
            OutputParam(
                "dense_maps",
                type_hint=dict,
                description="Task -> raw maps `[B, C, h, w]` of that task's rows, in order, at the dense input size.",
            )
        ]

    @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)
        block_state.dense_maps = transformer(
            input_ids=block_state.input_ids.to(device),
            attention_mask=block_state.attention_mask.to(device),
            position_ids=block_state.position_ids.to(device),
            pixel_values=block_state.pixel_values.to(device),
            dense_tasks=block_state.dense_rows,
        ).dense_maps
        self.set_block_state(state, block_state)
        return components, state