Search Results for

    Show / Hide Table of Contents

    For Unity Project Users

    You never download AI models by hand. Packages and code say which models they need. AI Model Hub asks you once, downloads the models from Hugging Face, and converts them for Unity Inference Engine (Sentis). Then your code loads them by name.

    This page shows the windows you will see, when they open, and what to click.

    You see When What to do
    Setup prompt You open a project whose packages need models Click Download & Convert All
    Load prompt Code loads a model the project does not have yet Click Add to Project and Download
    Model Hub You open Window > AI Model Hub Check status, add optional models, choose how builds get models

    When you open a project that needs models

    Setup prompt titled "This project needs 4 AI models". Each row shows a model, the package that needs it, a Model card link, a license link, and the download size. The buttons are Later, Open Model Hub, and Download & Convert All · 149.9 MB.

    You installed a package that uses AI models, or you opened a project that a teammate set up. AI Model Hub lists the models that are not on this machine yet.

    1. Check the License of each model.
    2. Click Download & Convert All. Model Hub opens and shows the progress.

    The size on the button is the total download. Converting large models takes CPU, memory, and some minutes.

    Later closes the prompt. It opens again in the next Editor session. Models that another project on this machine already downloaded and converted need no click: AI Model Hub sets them up by itself.

    When code loads a model the project does not have

    Load prompt titled "Add AI models to this project?". One card shows onnx-community/depth-anything-v2-small with 1 file · 94.5 MB · onnx/model.onnx. The buttons are Cancel, Open in AI Model Hub, and Add to Project and Download · 94.5 MB.

    You pasted a code snippet, or you use a sample, that loads a model by its Hugging Face id:

    Model model = await Hub.LoadModelAsync("onnx-community/depth-anything-v2-small", "onnx/model.onnx");
    

    The first time this runs in the Editor, AI Model Hub asks before it downloads anything. The card shows the model, the files the code asked for, and the download size.

    • Click Add to Project and Download. The code continues when the download is done.
    • Commit ProjectSettings/Packages/tools.doji.model-hub/model-hub-manifest.json. It now lists the model, so your teammates and your builds get the same files.
    • Cancel stops the load with an error. The prompt does not ask again for that model until you restart the Editor.

    Hub.LoadModelAsync waits for the download. Hub.LoadModel cannot wait: it opens the prompt and fails at once. Run it again when the download is done.

    Several models at once

    Load prompt with two cards: onnx-community/whisper-tiny with 3 files, 146.7 MB, and onnx-community/Kokoro-82M-v1.0-ONNX with 1 file, 310.5 MB. The primary button says Add to Project and Download · 457.1 MB.

    Some code needs more than one file or model, for example speech recognition and speech output together. It asks once for all of them, with one card per model and the total size on the button.

    When the code names no files

    Load prompt card for onnx-community/depth-anything-v2-small that says "Choose the files to use", with a Choose Files… button. The primary button is disabled.

    Code such as Hub.FromPretrained("onnx-community/depth-anything-v2-small") names a model, but no files. A model on Hugging Face often has many variants. Click Choose Files… and check the files to use. Then click Add to Project and Download.

    When a package offers an optional model

    Load prompt card for julienkay/sentis-MiDaS with 1 file · onnx/midas_v21_small_256.onnx. The primary button says Add to Project.

    A package can offer extra models that it does not download for every project, for example larger, more accurate variants. They show in Model Hub as Available, with their size. When your code uses one, the prompt asks to add it. The package already says which files it needs, so there is nothing to choose.

    The button says Add to Project without a size when the files are already on this machine.

    When you develop a package

    Load prompt card with an Add to field set to Depth Estimation (com.example.depth). The primary button says Add to Package and Download · 47.3 MB.

    When the code of a package in your project's Packages folder loads a file that its manifest does not list, the prompt shows Add to. Choose the package to ship the model with it, or This project. See For Package Maintainers.

    Model Hub: all models in one place

    Model Hub window. The sidebar shows In Project with 4 models and Model Cache. The list shows four Ready models. The details of sentis-midas show the model ID, files, download size, format, In this project, the In builds setting, and the two manifests that use the model.

    Open Window > AI Model Hub to see every model this project uses:

    • Needs action lists models to download or convert, each with its button and size.
    • Ready lists models your code can load now.
    • Available lists optional models of your packages. Click Add to use one, and Remove to stop using it.
    • In builds chooses how players get the model. See Builds.

    Downloads and converted models are shared by every Unity project on your machine, and by Python tools that use the Hugging Face cache. A model downloads once. Nothing is written into Assets. To move the folders, open Preferences > Doji > AI > AI Model Hub.

    See Editor Surfaces for every button.

    Builds

    A build includes every model the project uses, in one of two ways:

    • Bundle in the build (default): the player contains the model.
    • Download at runtime: the player downloads the model from Hugging Face the first time it loads it, at the version you tested.

    Set the default in Project Settings > Doji > AI > AI Model Hub > In builds, and change it per model in Model Hub. A build never downloads: when a model is not downloaded yet, the build stops and lists it. Click Download in Model Hub, then build again.

    When a load fails without a prompt

    Players and batch mode, for example CI, never show a prompt. A load of a model that no manifest lists fails with an error that names the entry to add:

    AI Model Hub has no model 'onnx-community/depth-anything-v2-small'. Add it to a manifest, for example the
    project manifest in Project Settings > AI Model Hub: { "id": "onnx-community/depth-anything-v2-small",
    "files": [ { "path": "onnx/model.onnx" } ] }. Then download it in Window > AI Model Hub, or with
    `unity command model_hub_sync`, and build the player again.
    

    Load the model once in the Editor, and the prompt adds it for you. Or click + Add Model in Model Hub.

    Commit these files

    File Holds
    ProjectSettings/Packages/tools.doji.model-hub/model-hub-manifest.json The models and optional files this project uses
    ProjectSettings/Doji.AI.ModelHubSettings.asset How builds get each model, and changed conversion settings

    Do not commit downloaded or converted models. They live outside the project.

    Next steps

    • Editor Surfaces: every window and button.
    • Setup, Cache, and Runtime Loading: the runtime API, folders, and builds.
    • Command Line and CI: set up models in CI.
    In this article
    Back to top Generated by DocFX