> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ovalbee.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ovalbee.com/_mcp/server.

# Apply model

> Applies the selected model to the dataset, automatically detects its framework, and runs the corresponding backend container.

## Overview

Runs inference with whichever model you hand it, without you naming the framework.

Pick a **Destination dataset** to add the predictions to a dataset you already have, such as a labeling pool or an active-learning set. Existing assets are kept, and new predictions replace any previous annotations for the same image. Leave it empty and the node writes into a dataset of its own, one version per run.

The node reads the framework and task off the selected model version, runs the prediction node that serves that pair, and returns the output dataset with the predictions. The badge shows how many images were annotated and opens that dataset.

Use it after a model selection node, where the winning model is only known at runtime.

```mermaid
flowchart LR
  n1["Get best classifier"] --> n2["Apply model"] --> n3["Evaluate classifier"]
```

## Prerequisites

| Requirement                      | What you need                                                                                                                                                                                                                                               |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Registered model**             | A model of this workspace whose framework and task type are recorded in the registry. The training nodes, [Upload model](/node-library/nodes/models-general-upload-model), and [Import model](/node-library/nodes/supervisely-import-model) all write both. |
| **Supported framework and task** | A prediction node that covers that combination. The pairs that ship today are listed under [Models and configuration](#models-and-configuration).                                                                                                           |
| **GPU worker**                   | A worker with a GPU. Every prediction node this one dispatches to requires one.                                                                                                                                                                             |

## How it works

Reads the framework and task type recorded on the selected model version.

Picks the prediction node that serves that pair and hands it the dataset, the model, and the configuration.

Runs that node and mirrors its log into this node's log, prefixed with the framework.

Publishes the dataset and the prediction count that the prediction node produced.

## FAQ

#### What happens when no model is connected?

The run logs a warning, passes the input dataset straight through as the output, and produces no predictions. That keeps a flow with an optional pre-labeling step working when no model was selected upstream.

#### Why did the run fail saying the model has no framework?

The model was registered without one. Register it again through a node that records the framework, or add it before applying the model.

#### Why did the run fail saying no prediction node was found?

Nothing published serves that framework and task combination. Check the pairs in [Models and configuration](#models-and-configuration): a detection model cannot be routed to a classification node, even when the framework matches.

#### Does it change the input dataset?

No. Predictions land in the output dataset, and the source dataset keeps whatever annotations it already had.

#### Can I still tune the prediction settings?

Yes, through **Config**. Leaving it empty uses the defaults of the prediction node that gets selected, which differ per framework. See [Models and configuration](#models-and-configuration).

#### What does this node not support?

It applies one model to one dataset. Chaining several models, mixing tasks in a single run, and pretrained checkpoints that are not in the model registry are all out of scope.

## Inputs

**`Dataset`** `dataset` — required

Dataset the model runs on. Predictions are written to the output dataset, so this one is left as it is. Key: `DATASET`.

---

**`Destination dataset`** `dataset`

Dataset the predictions are added to, keeping what it already holds. An image it already annotates gets the new prediction instead. Leave empty to use the node's own output dataset, which a rerun writes a new version of. Key: `DST_DATASET`.

---

**`Model`** `model`

Model to apply. Leave empty to pass the dataset through unchanged. Key: `MODEL`.

---

**`Config`** `yaml`

Settings in YAML handed to the predict node that runs. Leave empty to use that node's own defaults. Key: `CONFIG`.

---

**`Download batch size`** `integer` — required, default: 64

Number of assets to download at once before prediction. Minimum: `1`. Key: `DOWNLOAD_BATCH_SIZE`.

---

**`Prefetch batches`** `integer` — required, default: 4

Number of downloaded batches to keep ready on local disk. Minimum: `1`. Key: `PREFETCH_BATCHES`.

---

## Outputs

**`Output Dataset`** `dataset`

Dataset with the source images and prediction annotations: the destination dataset when one is picked, otherwise the node's own. Shown as an artifact. Key: `OUTPUT_DATASET`.

---

**`Prediction Count`** `string`

Badge showing the number of images annotated. Shown on the node as a badge. Selecting the badge opens `OUTPUT_DATASET`. Key: `PRED_COUNT`.

---

## Models and configuration

Routing is driven by two facts recorded on the model version: the framework and the task type. Each prediction node declares the pair it serves, and the run fails when nothing matches or when two nodes claim the same pair.

| Framework        | Task                                    |
| ---------------- | --------------------------------------- |
| `yolo`           | Object detection                        |
| `deim`           | Object detection                        |
| `grounding_dino` | Object detection                        |
| `edgecrafter`    | Object detection, instance segmentation |
| `maskdino`       | Semantic segmentation                   |
| `timm`           | Classification                          |

**Config** is forwarded to the selected prediction node as-is. Leave it empty and that node's own default configuration applies, so the same flow can run a YOLO model and a TIMM model without editing anything. Enter your own YAML and it replaces the default in full rather than merging into it, which means the settings you write have to be valid for the framework the model happens to use.

**Download Batch Size** and **Prefetch Batches** are passed through too. They control how many assets are fetched ahead of the prediction, so raise them for faster storage and lower them when local disk is tight.

## Runtime

This node is a dispatcher. It runs on an ordinary worker and starts the selected prediction node in its own GPU container, so that node's image and speed are what the run actually costs.

The first run of a given framework takes noticeably longer while the worker pulls that prediction node's image. Cancelling the task stops the container it started.

## JSON config

Machine-readable node interface for automation and advanced usage.

#### Show JSON

```json
{
  "name": "Apply model",
  "description": "Applies the selected model to the dataset, automatically detects its framework, and runs the corresponding backend container.\n",
  "category": "Predict",
  "namespace": null,
  "templateKey": "models/general/apply_model",
  "version": "v1",
  "inputs": [
    {
      "key": "DATASET",
      "label": "Dataset",
      "type": "dataset",
      "description": "Dataset the model runs on. Predictions are written to the output dataset, so this one is left as it is.",
      "required": true,
      "default": null,
      "visibleWhen": null,
      "options": {
        "creatable": false
      }
    },
    {
      "key": "DST_DATASET",
      "label": "Destination dataset",
      "type": "dataset",
      "description": "Dataset the predictions are added to, keeping what it already holds. An image it already annotates gets the new prediction instead. Leave empty to use the node's own output dataset, which a rerun writes a new version of.",
      "required": false,
      "default": null,
      "visibleWhen": null
    },
    {
      "key": "MODEL",
      "label": "Model",
      "type": "model",
      "description": "Model to apply. Leave empty to pass the dataset through unchanged.",
      "required": false,
      "default": null,
      "visibleWhen": null,
      "options": {
        "scope": "my"
      }
    },
    {
      "key": "CONFIG",
      "label": "Config",
      "type": "yaml",
      "description": "Settings in YAML handed to the predict node that runs. Leave empty to use that node's own defaults.",
      "required": false,
      "default": null,
      "visibleWhen": null
    },
    {
      "key": "DOWNLOAD_BATCH_SIZE",
      "label": "Download batch size",
      "type": "number",
      "description": "Number of assets to download at once before prediction.",
      "required": true,
      "default": 64,
      "visibleWhen": null,
      "options": {
        "type": "integer",
        "min": 1
      }
    },
    {
      "key": "PREFETCH_BATCHES",
      "label": "Prefetch batches",
      "type": "number",
      "description": "Number of downloaded batches to keep ready on local disk.",
      "required": true,
      "default": 4,
      "visibleWhen": null,
      "options": {
        "type": "integer",
        "min": 1
      }
    }
  ],
  "outputs": [
    {
      "key": "OUTPUT_DATASET",
      "label": "Output Dataset",
      "type": "dataset",
      "description": "Dataset with the source images and prediction annotations: the destination dataset when one is picked, otherwise the node's own.",
      "artifact": true,
      "badge": false,
      "badgeOpens": null,
      "hidden": false
    },
    {
      "key": "PRED_COUNT",
      "label": "Prediction Count",
      "type": "string",
      "description": "Badge showing the number of images annotated.",
      "artifact": false,
      "badge": true,
      "badgeOpens": "OUTPUT_DATASET",
      "hidden": false
    }
  ]
}
```

## References

#### Sources and related pages

* [Train YOLO](/node-library/nodes/models-yolo-train-yolo) and the other training nodes register the model they produce with its framework and task type.
* [Upload model](/node-library/nodes/models-general-upload-model) registers a checkpoint from your machine.
* [Import model](/node-library/nodes/supervisely-import-model) registers a model trained in Supervisely.
* [Predict](/node-library/nodes/models-yolo-predict-yolo) is the YOLO prediction node this node dispatches to for YOLO detection models.