Skip to main content

Build and Upload a Model

Quickly build and upload your first custom model to Clarifai platform


The Clarifai platform allows you to upload custom models for a wide range of use cases. With just a few simple steps, you can get your models up and running and leverage the platform’s powerful capabilities.

Let’s walk through how to build and upload a simple custom model.

tip

To learn more about how to upload different types of models, check out this comprehensive guide.

Step 1: Perform Prerequisites

Sign Up or Log In

To get started, log in to your existing Clarifai account or sign up for a new one. If you're creating a new account, a default application will be automatically generated for you.

Next, retrieve the following credentials:

  • App ID – Navigate to your application’s page and select the Overview option in the collapsible left sidebar. Get the app ID from there.
  • User ID – Navigate to Settings in the collapsible left sidebar and select the Account option. Then, copy your user ID from that page.
  • PAT – From the same Settings menu, go to the Secrets page to generate or copy your Personal Access Token (PAT). This token is used to authenticate your connection with the Clarifai platform.

You need to set the CLARIFAI_PAT you've retrieved as an environment variable.

export CLARIFAI_PAT=YOUR_PERSONAL_ACCESS_TOKEN_HERE

Install Clarifai Package

Install the latest version of the clarifai Python SDK. This also installs the Clarifai Command Line Interface (CLI), which we'll use for uploading the model.

pip install --upgrade clarifai

Set Up Cluster and Nodepool

Setting up a cluster and nodepool creates the dedicated compute environment your model needs to run reliably and efficiently.

After uploading your model to the Clarifai platform, you'll need to deploy it to the already created compute environment.

Note: A cluster forms the foundation of your compute environment, while a nodepool is a single compute node or a group of compute nodes within that cluster that provides the resources required to run your model.

You can learn how to set up your compute environment fast here.

Step 2: Create Files

tip

You can automatically generate the required files by running the clarifai model init command in the terminal from your current directory. After the files are created, you can modify them as needed.

Create a project directory and organize your files as indicated below to fit the requirements of uploading models to the Clarifai platform.

your_model_directory/
├── 1/
│ └── model.py
├── requirements.txt
└── config.yaml
  • your_model_directory/ – The root directory containing all files related to your custom model.
    • 1/ – A subdirectory that holds the model file (Note that the folder is named as 1).
      • model.py – Contains the code that defines your model, including running inference.
    • requirements.txt – Lists the Python dependencies required to run your model.
    • config.yaml – Contains metadata and configuration settings, such as compute requirements, needed for uploading the model to Clarifai.

Add the following snippets to each of the respective files.

model.py

from clarifai.runners.models.model_class import ModelClass
from typing import Iterator


class MyFirstModel(ModelClass):
"""A custom model that generates 'Hello World' outputs in a streaming fashion."""

@ModelClass.method
def generate(self, text1: str = "") -> Iterator[str]:
"""
This method streams multiple outputs instead of returning just one.
It takes an input string and yields a sequence of outputs.
"""
for i in range(5): # number of generated outputs
output_text = text1 + f" Hello World {i}"
yield output_text

requirements.txt

clarifai>=11.8.2

config.yaml

important

In the model section of the config.yaml file, specify a unique model ID (any arbitrary name you choose), along with the Clarifai user ID and app ID you retrieved earlier. These values determine the destination where your model will be uploaded on the Clarifai platform.

model:
id: "my-first-model"
user_id: "YOUR_USER_ID_HERE"
app_id: "YOUR_APP_ID_HERE"
model_type_id: "text-to-text"

build_info:
python_version: "3.11"

inference_compute_info:
cpu_limit: "1"
cpu_memory: "5Gi"
num_accelerators: 0

Step 3: Upload the Model

Once your custom model is ready, upload it to the Clarifai platform by navigating to the directory containing the model and running the following command:

clarifai model upload

Step 4: Deploy the Model

Once your model is successfully uploaded to the Clarifai platform, the terminal will guide you through the deployment process to prepare your model for inference.

Follow the on-screen prompts to:

  • Choose an existing cluster and nodepool where your model will run.

  • Provide the deployment configuration, including the minimum and maximum number of replicas to manage your model’s scalability. Take note of the created deployment_id.

Note: Once the setup is complete, you can backtrack to modify these configurations or clean up the deployment resources at any time.

Build Logs Example
clarifai model init
[INFO] 10:21:24.677524 Initializing model with default templates... | thread=8349786304
Press Enter to continue...
[INFO] 10:21:25.913378 Created /Users/macbookpro/Desktop/code3/one/1/model.py | thread=8349786304
[INFO] 10:21:25.913829 Created /Users/macbookpro/Desktop/code3/one/requirements.txt | thread=8349786304
[INFO] 10:21:25.914122 Created /Users/macbookpro/Desktop/code3/one/config.yaml | thread=8349786304
[INFO] 10:21:25.914179 Model initialization complete in /Users/macbookpro/Desktop/code3/one | thread=8349786304
[INFO] 10:21:25.914224 Next steps: | thread=8349786304
[INFO] 10:21:25.914267 1. Search for '# TODO: please fill in' comments in the generated files | thread=8349786304
[INFO] 10:21:25.914305 2. Update the model configuration in config.yaml | thread=8349786304
[INFO] 10:21:25.914343 3. Add your model dependencies to requirements.txt | thread=8349786304
[INFO] 10:21:25.914380 4. Implement your model logic in 1/model.py | thread=8349786304
clarifai model upload
[INFO] 10:29:12.518104 No checkpoints specified in the config file | thread=8349786304
[INFO] 10:29:12.518952 Setup: Using Python version 3.11 from the config file to build the Dockerfile | thread=8349786304
[INFO] 10:29:12.519216 Setup: Validating requirements.txt file at /Users/macbookpro/Desktop/code3/one/requirements.txt using uv pip compile | thread=8349786304
[INFO] 10:29:30.681744 Setup: Requirements.txt file validated successfully | thread=8349786304
[INFO] 10:29:30.682817 Setup: Linting Python files: ['/Users/macbookpro/Desktop/code3/one/1/model.py'] | thread=8349786304
[INFO] 10:29:30.770948 Setup: Python code linted successfully, no errors found. | thread=8349786304
[INFO] 10:29:31.038252 New model will be created at https://clarifai.com/alfrick/my-models/models/friday20th with it's first version. | thread=8349786304
Press Enter to continue...
[INFO] 10:30:58.472365 Uploading file... | thread=6178074624
[INFO] 10:30:58.473071 Upload complete! | thread=6178074624
Status: Upload done, Progress: 0% - Completed upload of files, initiating model version image build.. request_id: sdk-pythoStatus: Model image is currently being built., Progress: 0% - Model version image is being built. request_id: sdk-python-11[INFO] 10:30:59.234629 Created Model Version ID: babcbb3ed3f84103892fe4eb5833b692 | thread=8349786304
[INFO] 10:30:59.235657 Full url to that version is: https://clarifai.com/alfrick/my-models/models/friday20th | thread=8349786304
[INFO] 10:31:05.699753 2025-11-20 07:31:00.984356 INFO: Downloading uploaded buildable from storage...
2025-11-20 07:31:01.765286 INFO: Done downloading buildable from storage
2025-11-20 07:31:01.768792 INFO: Extracting upload...
2025-11-20 07:31:01.773345 INFO: Done extracting upload
2025-11-20 07:31:01.776036 INFO: Parsing requirements file for buildable version ID ****e4eb5833b692
2025-11-20 07:31:01.800255 INFO: Dockerfile found at /shared/context/Dockerfile
cat: /shared/context/downloader/hf_token: No such file or directory
2025-11-20 07:31:02.441141 INFO: Setting up credentials
amazon-ecr-credential-helper
Version: 0.8.0
Git commit: ********
2025-11-20 07:31:02.446367 INFO: Building image...
#1 \[internal] load build definition from Dockerfile
#1 transferring dockerfile: 3.40kB done
#1 WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 7)
#1 DONE 0.0s

#2 resolve image config for docker-image://docker.io/docker/dockerfile:1.13-labs
#2 DONE 0.1s

#3 docker-image://docker.io/docker/dockerfile:1.13-labs@sha256:************18b8
#3 resolve docker.io/docker/dockerfile:1.13-labs@sha256:************18b8 done
#3 CACHED

#4 \[linux/amd64 internal] load metadata for public.ecr.aws/clarifai-models/python-base:3.11-********
#4 DONE 0.2s

#5 \[linux/arm64 internal] load metadata for public.ecr.aws/clarifai-models/python-base:3.11-********
#5 DONE 0.2s

#6 \[internal] load .dockerignore
#6 transferring context: 2B done
#6 DONE 0.0s

#7 \[internal] load build context
#7 transferring context: 2.13kB done
#7 DONE 0.0s

#8 \[linux/amd64 model-assets 1/8] FROM public.ecr.aws/clarifai-models/python-base:3.11-********@sha256:************48e5
#8 resolve public.ecr.aws/clarifai-models/python-base:3.11-********@sha256:************48e5 done
#8 CACHED

#9 \[linux/arm64 final 1/5] FROM public.ecr.aws/clarifai-models/python-base:3.11-********@sha256:************48e5
#9 resolve public.ecr.aws/clarifai-models/python-base:3.11-********@sha256:************48e5 done
#9 CACHED

#10 \[linux/arm64 final 2/5] COPY --link --chown=65532:65532 requirements.txt /home/nonroot/requirements.txt
#10 merging done
#10 DONE 0.0s

#11 \[linux/amd64 final 2/5] COPY --link --chown=65532:65532 requirements.txt /home/nonroot/requirements.txt
#11 merging done
#11 DONE 0.0s

#12 \[linux/amd64 final 3/5] RUN ["uv", "pip", "install", "--no-cache-dir", "-r", "/home/nonroot/requirements.txt"]
#12 0.062 Using Python 3.11.14 environment at: /venv
#12 0.414 Resolved 35 packages in 349ms
#12 0.422 Downloading pygments (1.2MiB)
#12 0.422 Downloading pydantic-core (1.9MiB)
#12 0.422 Downloading pillow (6.7MiB)
#12 0.422 Downloading numpy (16.1MiB)
#12 0.422 Downloading grpcio (6.3MiB)
#12 0.423 Downloading aiohttp (1.7MiB)
#12 0.426 Downloading uv (17.0MiB)
#12 0.429 Downloading ruff (10.8MiB)
#12 0.558 Downloading pydantic-core
#12 0.671 Downloading aiohttp
#12 0.799 Downloading ruff
#12 0.831 Downloading uv
#12 0.833 Downloading grpcio
#12 0.834 Downloading pillow
#12 0.858 Downloading pygments
#12 1.014 Downloading numpy
#12 1.014 Prepared 27 packages in 599ms
#12 1.016 Uninstalled 1 package in 1ms
#12 1.036 Installed 27 packages in 20ms
#12 1.036 + aiohappyeyeballs==2.6.1
#12 1.036 + aiohttp==3.13.2
#12 1.036 + aiosignal==1.4.0
#12 1.036 + attrs==25.4.0
#12 1.036 + charset-normalizer==3.4.4
#12 1.036 + clarifai==11.10.2
#12 1.036 + clarifai-grpc==11.10.5
#12 1.036 + clarifai-protocol==0.0.34
#12 1.036 + contextlib2==21.6.0
#12 1.036 + frozenlist==1.8.0
#12 1.036 + googleapis-common-protos==1.72.0
#12 1.036 + grpcio==1.76.0
#12 1.036 + multidict==6.7.0
#12 1.036 + numpy==2.3.5
#12 1.036 + pillow==12.0.0
#12 1.036 + propcache==0.4.1
#12 1.036 + protobuf==6.33.1
#12 1.036 + psutil==7.0.0
#12 1.036 + pydantic-core==2.33.2
#12 1.036 + pygments==2.19.2
#12 1.036 + requests==2.32.5
#12 1.036 + ruff==0.11.4
#12 1.036 + schema==0.7.5
#12 1.036 + tabulate==0.9.0
#12 1.036 + urllib3==2.5.0
#12 1.036 - uv==0.9.9
#12 1.036 + uv==0.7.12
#12 1.036 + yarl==1.22.0
#12 DONE 1.1s

#13 \[linux/amd64 final 4/5] RUN ["uv", "pip", "show", "--no-cache-dir", "clarifai"]
#13 0.075 Using Python 3.11.14 environment at: /venv
#13 0.077 Name: clarifai
#13 0.077 Version: 11.10.2
#13 0.077 Location: /venv/lib/python3.11/site-packages
#13 0.077 Requires: aiohttp, clarifai-grpc, clarifai-protocol, click, fsspec, numpy, packaging, pillow, psutil, pydantic-core, pygments, pyyaml, requests, ruff, schema, tabulate, tqdm, uv
#13 0.077 Required-by: clarifai-protocol
#13 DONE 0.1s

#14 \[linux/amd64 model-assets 2/8] RUN pip install --no-cache-dir clarifai==11.10.2 huggingface_hub
#14 0.721 Collecting clarifai==11.10.2
#14 0.773 Downloading clarifai-11.10.2-py3-none-any.whl.metadata (23 kB)
#14 0.778 Requirement already satisfied: huggingface_hub in /venv/lib/python3.11/site-packages (1.1.4)
#14 0.807 Collecting clarifai-grpc>=11.10.3 (from clarifai==11.10.2)
#14 0.810 Downloading clarifai_grpc-11.10.5-py3-none-any.whl.metadata (4.4 kB)
#14 0.846 Collecting clarifai-protocol>=0.0.33 (from clarifai==11.10.2)
#14 0.849 Downloading clarifai_protocol-0.0.34-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (14 kB)
#14 0.969 Collecting numpy>=1.22.0 (from clarifai==11.10.2)
#14 0.973 Downloading numpy-2.3.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (62 kB)
#14 0.989 Requirement already satisfied: tqdm>=4.65.0 in /venv/lib/python3.11/site-packages (from clarifai==11.10.2) (4.67.1)
#14 0.989 Requirement already satisfied: PyYAML>=6.0.1 in /venv/lib/python3.11/site-packages (from clarifai==11.10.2) (6.0.3)
#14 0.997 Collecting schema==0.7.5 (from clarifai==11.10.2)
#14 1.000 Downloading schema-0.7.5-py2.py3-none-any.whl.metadata (34 kB)
#14 1.121 Collecting Pillow>=9.5.0 (from clarifai==11.10.2)
#14 1.124 Downloading pillow-12.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (8.8 kB)
#14 1.152 Collecting tabulate>=0.9.0 (from clarifai==11.10.2)
#14 1.154 Downloading tabulate-0.9.0-py3-none-any.whl.metadata (34 kB)
#14 1.157 Requirement already satisfied: fsspec>=2024.6.1 in /venv/lib/python3.11/site-packages (from clarifai==11.10.2) (2025.10.0)
#14 1.157 Requirement already satisfied: click>=8.1.7 in /venv/lib/python3.11/site-packages (from clarifai==11.10.2) (8.3.0)
#14 1.170 Collecting requests>=2.32.3 (from clarifai==11.10.2)
#14 1.173 Downloading requests-2.32.5-py3-none-any.whl.metadata (4.9 kB)
#14 1.490 Collecting aiohttp>=3.10.0 (from clarifai==11.10.2)
#14 1.493 Downloading aiohttp-3.13.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (8.1 kB)
#14 1.623 Collecting uv==0.7.12 (from clarifai==11.10.2)
#14 1.627 Downloading uv-0.7.12-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (11 kB)
#14 1.854 Collecting ruff==0.11.4 (from clarifai==11.10.2)
#14 1.858 Downloading ruff-0.11.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (25 kB)
#14 1.896 Collecting psutil==7.0.0 (from clarifai==11.10.2)
#14 1.899 Downloading psutil-7.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (22 kB)
#14 1.911 Collecting pygments>=2.19.2 (from clarifai==11.10.2)
#14 1.915 Downloading pygments-2.19.2-py3-none-any.whl.metadata (2.5 kB)
#14 2.375 Collecting pydantic_core==2.33.2 (from clarifai==11.10.2) | thread=8349786304
[INFO] 10:31:11.252711 #14 2.375 Collecting pydantic_core==2.33.2 (from clarifai==11.10.2)
#14 2.379 Downloading pydantic_core-2.33.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.8 kB)
#14 2.380 Requirement already satisfied: packaging==25.0 in /venv/lib/python3.11/site-packages (from clarifai==11.10.2) (25.0)
#14 2.382 Requirement already satisfied: typing-extensions!=4.7.0,>=4.6.0 in /venv/lib/python3.11/site-packages (from pydantic_core==2.33.2->clarifai==11.10.2) (4.15.0)
#14 2.387 Collecting contextlib2>=0.5.5 (from schema==0.7.5->clarifai==11.10.2)
#14 2.390 Downloading contextlib2-21.6.0-py2.py3-none-any.whl.metadata (4.1 kB)
#14 2.392 Requirement already satisfied: filelock in /venv/lib/python3.11/site-packages (from huggingface_hub) (3.20.0)
#14 2.393 Requirement already satisfied: hf-xet<2.0.0,>=1.2.0 in /venv/lib/python3.11/site-packages (from huggingface_hub) (1.2.0)
#14 2.393 Requirement already satisfied: httpx<1,>=0.23.0 in /venv/lib/python3.11/site-packages (from huggingface_hub) (0.28.1)
#14 2.393 Requirement already satisfied: shellingham in /venv/lib/python3.11/site-packages (from huggingface_hub) (1.5.4)
#14 2.394 Requirement already satisfied: typer-slim in /venv/lib/python3.11/site-packages (from huggingface_hub) (0.20.0)
#14 2.399 Requirement already satisfied: anyio in /venv/lib/python3.11/site-packages (from httpx<1,>=0.23.0->huggingface_hub) (4.11.0)
#14 2.399 Requirement already satisfied: certifi in /venv/lib/python3.11/site-packages (from httpx<1,>=0.23.0->huggingface_hub) (2025.11.12)
#14 2.399 Requirement already satisfied: httpcore==1.* in /venv/lib/python3.11/site-packages (from httpx<1,>=0.23.0->huggingface_hub) (1.0.9)
#14 2.399 Requirement already satisfied: idna in /venv/lib/python3.11/site-packages (from httpx<1,>=0.23.0->huggingface_hub) (3.11)
#14 2.401 Requirement already satisfied: h11>=0.16 in /venv/lib/python3.11/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->huggingface_hub) (0.16.0)
#14 2.410 Collecting aiohappyeyeballs>=2.5.0 (from aiohttp>=3.10.0->clarifai==11.10.2)
#14 2.413 Downloading aiohappyeyeballs-2.6.1-py3-none-any.whl.metadata (5.9 kB)
#14 2.418 Collecting aiosignal>=1.4.0 (from aiohttp>=3.10.0->clarifai==11.10.2)
#14 2.421 Downloading aiosignal-1.4.0-py3-none-any.whl.metadata (3.7 kB)
#14 2.429 Collecting attrs>=17.3.0 (from aiohttp>=3.10.0->clarifai==11.10.2)
#14 2.433 Downloading attrs-25.4.0-py3-none-any.whl.metadata (10 kB)
#14 2.471 Collecting frozenlist>=1.1.1 (from aiohttp>=3.10.0->clarifai==11.10.2)
#14 2.474 Downloading frozenlist-1.8.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (20 kB)
#14 2.609 Collecting multidict<7.0,>=4.5 (from aiohttp>=3.10.0->clarifai==11.10.2)
#14 2.612 Downloading multidict-6.7.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (5.3 kB)
#14 2.645 Collecting propcache>=0.2.0 (from aiohttp>=3.10.0->clarifai==11.10.2)
#14 2.648 Downloading propcache-0.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (13 kB)
#14 2.850 Collecting yarl<2.0,>=1.17.0 (from aiohttp>=3.10.0->clarifai==11.10.2)
#14 2.855 Downloading yarl-1.22.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (75 kB)
#14 3.149 Collecting grpcio>=1.53.2 (from clarifai-grpc>=11.10.3->clarifai==11.10.2)
#14 3.152 Downloading grpcio-1.76.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (3.7 kB)
#14 3.307 Collecting protobuf>=5.29.5 (from clarifai-grpc>=11.10.3->clarifai==11.10.2)
#14 3.311 Downloading protobuf-6.33.1-cp39-abi3-manylinux2014_x86_64.whl.metadata (593 bytes)
#14 3.321 Collecting googleapis-common-protos>=1.57.0 (from clarifai-grpc>=11.10.3->clarifai==11.10.2)
#14 3.324 Downloading googleapis_common_protos-1.72.0-py3-none-any.whl.metadata (9.4 kB)
#14 3.427 Collecting charset_normalizer<4,>=2 (from requests>=2.32.3->clarifai==11.10.2)
#14 3.430 Downloading charset_normalizer-3.4.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (37 kB)
#14 3.446 Collecting urllib3<3,>=1.21.1 (from requests>=2.32.3->clarifai==11.10.2)
#14 3.449 Downloading urllib3-2.5.0-py3-none-any.whl.metadata (6.5 kB)
#14 3.456 Requirement already satisfied: sniffio>=1.1 in /venv/lib/python3.11/site-packages (from anyio->httpx<1,>=0.23.0->huggingface_hub) (1.3.1)
#14 3.464 Downloading clarifai-11.10.2-py3-none-any.whl (306 kB)
#14 3.469 Downloading psutil-7.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (277 kB)
#14 3.472 Downloading pydantic_core-2.33.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB)
#14 3.478 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 382.2 MB/s 0:00:00
#14 3.485 Downloading ruff-0.11.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.3 MB)
#14 3.530 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.3/11.3 MB 254.8 MB/s 0:00:00
#14 3.533 Downloading schema-0.7.5-py2.py3-none-any.whl (17 kB)
#14 3.539 Downloading uv-0.7.12-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.8 MB)
#14 3.594 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.8/17.8 MB 330.3 MB/s 0:00:00
#14 3.596 Downloading aiohttp-3.13.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.7 MB)
#14 3.600 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 801.1 MB/s 0:00:00
#14 3.603 Downloading multidict-6.7.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (246 kB)
#14 3.606 Downloading yarl-1.22.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (365 kB)
#14 3.610 Downloading aiohappyeyeballs-2.6.1-py3-none-any.whl (15 kB)
#14 3.613 Downloading aiosignal-1.4.0-py3-none-any.whl (7.5 kB)
#14 3.615 Downloading attrs-25.4.0-py3-none-any.whl (67 kB)
#14 3.620 Downloading clarifai_grpc-11.10.5-py3-none-any.whl (305 kB)
#14 3.625 Downloading clarifai_protocol-0.0.34-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (409 kB)
#14 3.628 Downloading contextlib2-21.6.0-py2.py3-none-any.whl (13 kB)
#14 3.631 Downloading frozenlist-1.8.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (231 kB)
#14 3.634 Downloading googleapis_common_protos-1.72.0-py3-none-any.whl (297 kB)
#14 3.638 Downloading protobuf-6.33.1-cp39-abi3-manylinux2014_x86_64.whl (323 kB)
#14 3.641 Downloading grpcio-1.76.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (6.6 MB)
#14 3.652 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.6/6.6 MB 645.1 MB/s 0:00:00
#14 3.655 Downloading numpy-2.3.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (16.9 MB)
#14 3.687 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.9/16.9 MB 550.4 MB/s 0:00:00
#14 3.690 Downloading pillow-12.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (7.0 MB)
#14 3.702 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.0/7.0 MB 611.4 MB/s 0:00:00
#14 3.705 Downloading propcache-0.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (210 kB)
#14 3.708 Downloading pygments-2.19.2-py3-none-any.whl (1.2 MB)
#14 3.711 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 882.7 MB/s 0:00:00
#14 3.714 Downloading requests-2.32.5-py3-none-any.whl (64 kB)
#14 3.717 Downloading charset_normalizer-3.4.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (151 kB)
#14 3.719 Downloading urllib3-2.5.0-py3-none-any.whl (129 kB)
#14 3.722 Downloading tabulate-0.9.0-py3-none-any.whl (35 kB)
#14 3.838 Installing collected packages: uv, urllib3, tabulate, ruff, pygments, pydantic_core, psutil, protobuf, propcache, Pillow, numpy, multidict, grpcio, frozenlist, contextlib2, charset_normalizer, attrs, aiohappyeyeballs, yarl, schema, requests, googleapis-common-protos, aiosignal, clarifai-grpc, aiohttp, clarifai-protocol, clarifai
#14 3.838 Attempting uninstall: uv
#14 3.839 Found existing installation: uv 0.9.9
#14 3.841 Uninstalling uv-0.9.9:
#14 3.844 Successfully uninstalled uv-0.9.9
#14 6.872
#14 6.874 Successfully installed Pillow-12.0.0 aiohappyeyeballs-2.6.1 aiohttp-3.13.2 aiosignal-1.4.0 attrs-25.4.0 charset_normalizer-3.4.4 clarifai-11.10.2 clarifai-grpc-11.10.5 clarifai-protocol-0.0.34 contextlib2-21.6.0 frozenlist-1.8.0 googleapis-common-protos-1.72.0 grpcio-1.76.0 multidict-6.7.0 numpy-2.3.5 propcache-0.4.1 protobuf-6.33.1 psutil-7.0.0 pydantic_core-2.33.2 pygments-2.19.2 requests-2.32.5 ruff-0.11.4 schema-0.7.5 tabulate-0.9.0 urllib3-2.5.0 uv-0.7.12 yarl-1.22.0
#14 ...

#15 \[linux/arm64 final 3/5] RUN ["uv", "pip", "install", "--no-cache-dir", "-r", "/home/nonroot/requirements.txt"]
#15 0.952 Using Python 3.11.14 environment at: /venv
#15 3.208 Resolved 35 packages in 2.19s
#15 3.293 Downloading pygments (1.2MiB)
#15 3.294 Downloading numpy (13.9MiB)
#15 3.300 Downloading grpcio (6.1MiB)
#15 3.301 Downloading aiohttp (1.7MiB)
#15 3.303 Downloading uv (15.8MiB)
#15 3.306 Downloading ruff (9.9MiB)
#15 3.308 Downloading pydantic-core (1.8MiB)
#15 3.375 Downloading pillow (6.1MiB)
#15 4.241 Downloading pydantic-core
#15 4.684 Downloading aiohttp
#15 5.845 Downloading ruff
#15 5.893 Downloading uv
#15 5.920 Downloading pillow
#15 5.935 Downloading grpcio
#15 6.044 Downloading pygments
#15 6.774 Downloading numpy
#15 6.776 Prepared 27 packages in 3.55s
#15 6.784 Uninstalled 1 package in 7ms
#15 6.883 Installed 27 packages in 98ms
#15 6.886 + aiohappyeyeballs==2.6.1
#15 6.886 + aiohttp==3.13.2
#15 6.886 + aiosignal==1.4.0
#15 6.886 + attrs==25.4.0
#15 6.886 + charset-normalizer==3.4.4
#15 6.886 + clarifai==11.10.2
#15 6.886 + clarifai-grpc==11.10.5
#15 6.886 + clarifai-protocol==0.0.34
#15 6.886 + contextlib2==21.6.0
#15 6.887 + frozenlist==1.8.0
#15 6.887 + googleapis-common-protos==1.72.0
#15 6.887 + grpcio==1.76.0
#15 6.887 + multidict==6.7.0
#15 6.887 + numpy==2.3.5
#15 6.887 + pillow==12.0.0
#15 6.887 + propcache==0.4.1
#15 6.887 + protobuf==6.33.1
#15 6.887 + psutil==7.0.0
#15 6.887 + pydantic-core==2.33.2
#15 6.887 + pygments==2.19.2
#15 6.887 + requests==2.32.5
#15 6.888 + ruff==0.11.4
#15 6.888 + schema==0.7.5
#15 6.888 + tabulate==0.9.0
#15 6.888 + urllib3==2.5.0
#15 6.888 - uv==0.9.9
#15 6.888 + uv==0.7.12
#15 6.888 + yarl==1.22.0
#15 DONE 7.1s

#16 \[linux/arm64 final 4/5] RUN ["uv", "pip", "show", "--no-cache-dir", "clarifai"]
#16 ...

#14 \[linux/amd64 model-assets 2/8] RUN pip install --no-cache-dir clarifai==11.10.2 huggingface_hub
#14 DONE 7.4s | thread=8349786304
[INFO] 10:31:15.744421 #16 \[linux/arm64 final 4/5] RUN ["uv", "pip", "show", "--no-cache-dir", "clarifai"]
#16 ...

#14 \[linux/amd64 model-assets 2/8] RUN pip install --no-cache-dir clarifai==11.10.2 huggingface_hub
#14 DONE 7.4s

#17 \[linux/amd64 model-assets 3/8] WORKDIR /home/nonroot/main
#17 DONE 0.0s

#18 \[linux/amd64 model-assets 4/8] COPY --link downloader/unused.yaml /home/nonroot/main/1/checkpoints/.cache/unused.yaml
#18 DONE 0.0s

#19 \[linux/amd64 model-assets 5/8] COPY --link config.yaml /home/nonroot/main/
#19 merging done
#19 DONE 0.0s

#20 \[linux/amd64 model-assets 6/8] RUN ["python", "-m", "clarifai.cli", "model", "download-checkpoints", "/home/nonroot/main", "--out_path", "/home/nonroot/main/1/checkpoints", "--stage", "build"]
#20 0.183 [WARNING] 07:31:10.452752 Could not write configuration to disk. Could be a read only file system. | thread=140546745761344
#20 0.472 [WARNING] 07:31:10.741134 Config file /home/nonroot/.config/clarifai/config not found, using default config. Run 'clarifai config' on the command line to create a config file. | thread=140546745761344
#20 0.472 [WARNING] 07:31:10.741228 Config file /home/nonroot/.config/clarifai/config not found, using default config. Run 'clarifai config' on the command line to create a config file. | thread=140546745761344
#20 0.472 [INFO] 07:31:10.741343 No checkpoints specified in the config file | thread=140546745761344
#20 DONE 0.5s

#21 \[linux/amd64 model-assets 7/8] COPY --link 1 /home/nonroot/main/1
#21 DONE 0.0s

#22 \[linux/amd64 model-assets 8/8] COPY --link requirements.txt /home/nonroot/main/
#22 merging 0.0s done
#22 DONE 0.0s

#23 \[linux/amd64 final 5/5] COPY --link --chown=65532:65532 --from=model-assets /home/nonroot/main /home/nonroot/main
#23 DONE 0.0s

#16 \[linux/arm64 final 4/5] RUN ["uv", "pip", "show", "--no-cache-dir", "clarifai"]
#16 0.878 Using Python 3.11.14 environment at: /venv
#16 0.931 Name: clarifai
#16 0.931 Version: 11.10.2
#16 0.931 Location: /venv/lib/python3.11/site-packages
#16 0.931 Requires: aiohttp, clarifai-grpc, clarifai-protocol, click, fsspec, numpy, packaging, pillow, psutil, pydantic-core, pygments, pyyaml, requests, ruff, schema, tabulate, tqdm, uv
#16 0.932 Required-by: clarifai-protocol
#16 DONE 1.0s

#24 \[linux/arm64 final 5/5] COPY --link --chown=65532:65532 --from=model-assets /home/nonroot/main /home/nonroot/main
#24 DONE 0.0s

#25 exporting to image
#25 exporting layers | thread=8349786304
[INFO] 10:31:21.161501 #25 exporting layers 5.5s done
#25 exporting manifest sha256:************7c40 done
#25 exporting config sha256:************a91f done
#25 exporting manifest sha256:************e852 done
#25 exporting config sha256:************8aad done
#25 exporting manifest list sha256:************0dc6 done
#25 pushing layers
#25 ...

#26 \[auth] sharing credentials for 891377382885.dkr.ecr.us-east-1.amazonaws.com
#26 DONE 0.0s

#25 exporting to image | thread=8349786304
[INFO] 10:31:24.681411 #25 pushing layers 6.6s done
#25 pushing manifest for ****/prod/pytorch:****e4eb5833b692@sha256:************0dc6
#25 pushing manifest for ****/prod/pytorch:****e4eb5833b692@sha256:************0dc6 1.2s done
#25 DONE 13.3s
2025-11-20 07:31:24.218354 INFO: Done building image!!! | thread=8349786304
[INFO] 10:31:28.297981 Model build complete! | thread=8349786304
[INFO] 10:31:28.298410 Build time elapsed 29.1s) | thread=8349786304
[INFO] 10:31:28.298574 Check out the model at https://clarifai.com/alfrick/my-models/models/friday20th version: babcbb3ed3f84103892fe4eb5833b692 | thread=8349786304
[INFO] 10:31:28.354403

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Here is a code snippet to use this model:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
| thread=8349786304
[INFO] 10:31:28.354474 # Clarifai Model Client Script
# Set the environment variables `CLARIFAI_DEPLOYMENT_ID` and `CLARIFAI_PAT` to run this script.
# Example usage:
import os

from clarifai.client import Model
from clarifai.runners.utils import data_types

model = Model(
"https://clarifai.com/user-id/my-models/models/friday20th",
deployment_id=os.environ.get("CLARIFAI_DEPLOYMENT_ID", None), # Only needed for dedicated deployed models
deployment_user_id=os.environ.get("CLARIFAI_DEPLOYMENT_USER_ID", None), # Organization or user ID for deployment/nodepool
)

# Example model prediction from different model methods:

response = model.generate(
text1="What is the future of AI?",
)
for res in response:
print(res)
| thread=8349786304
[INFO] 10:31:28.354549

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
| thread=8349786304

🔶 Do you want to deploy the model? [Y/n]: y

🚀 Model Deployment

🖥️ Available Compute Clusters:
1. advanced-cluster-au64 – No description
Select compute cluster (number): 1

📦 Available Nodepools:
1. advanced-nodepool-ncz5 – No description
Select nodepool (number): 1

⌨️ Enter Deployment Configuration:
Enter deployment ID [deploy-friday20th-d84da3]:
Enter minimum replicas [1]:
Enter maximum replicas [5]:

⏳ Deploying model...
[INFO] 10:33:18.874665 Deployment with ID 'deploy-friday20th-d84da3' is created:
code: SUCCESS
description: "Ok"
req_id: "sdk-python-11.10.2-97997115d79f43f3b3055c834c6b05c7"
| thread=8349786304
✅ Deployment 'deploy-friday20th-d84da3' successfully created for model 'friday20th' with version 'babcbb3ed3f84103892fe4eb5833b692'.
Model deployed successfully! You can test it now.

🗑️ Do you want to backtrack and clean up? [Y/n]: y

🔄 Starting backtrack process...
Do you want to delete the deployment? [Y/n]: n
Do you want to delete the model version? [y/N]: n

Step 5: Predict With Model

Once your model is successfully deployed, you can start making predictions with it. You can also test it directly in the Playground.

from clarifai.client import Model
import os

# Set PAT as an environment variable
# export CLARIFAI_PAT=YOUR_PAT_HERE # Unix-Like Systems
# set CLARIFAI_PAT=YOUR_PAT_HERE # Windows
# Also set CLARIFAI_DEPLOYMENT_ID as an environment variable

# Initialize with your model URL
model = Model(
url="https://clarifai.com/user-id/app-id/models/model-id",
deployment_id=os.environ.get("CLARIFAI_DEPLOYMENT_ID", None),
)

for response in model.generate("Yes, I uploaded it! "):
print(response)
Output Example
Yes, I uploaded it!  Hello World 0
Yes, I uploaded it! Hello World 1
Yes, I uploaded it! Hello World 2
Yes, I uploaded it! Hello World 3
Yes, I uploaded it! Hello World 4

Congratulations!

You've successfully uploaded your first model to the Clarifai platform and run inference with it!