Sign in Get started

Models

List, version, import and download trained models as ONNX, PyTorch, safetensors, TensorRT or ExecuTorch, and test one image on hosted inference for free.

View as Markdown
On this page

In REST the model’s name is in the path, URL-encoded: /models/Stop%20Sign%20Detector.

list

One page of your organization’s models.

Source: Models.list

Arg Type Default Notes
name str | None None Only the model with this exact name (use get for one model)
dataset str | None None Only models trained on this dataset
status ModelStatus | None None Only this status: training, ready, failed or archived
model_type ModelType | None None Only this task, e.g. object_detection
limit int 50 Page size (max 100)
offset int 0 Items to skip
models = client.models.list(limit=20)
for m in models:
    print(m.name, m.architecture, m.status, m.metrics)
pictograph models list --limit 20
curl -s "https://api.pictograph.io/api/v1/developer/models/?limit=20" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns list[Model]

Model · 22 fields
class Model(BaseModel):
    """A trained computer vision model."""
    id: str
    organization_id: str
    name: str
    # Its URL name, unique in the organization.
    slug: str | None = None
    description: str | None = None
    # Its model card, in Markdown.
    readme: str | None = None
    # Its license's catalog id (such as 'mit'), or 'custom' with license_custom_text.
    license_id: str | None = None
    # The license's text, when license_id is 'custom'.
    license_custom_text: str | None = None
    # How many people starred it.
    star_count: int = 0
    model_type: Literal['object_detection', 'semantic_segmentation', 'instance_segmentation', 'classification', 'keypoint_detection', 'anomaly_detection']
    # Its architecture, such as 'yolox-s' or 'rfdetr-base'.
    architecture: str | None = None
    visibility: Literal['private', 'public']
    status: Literal['training', 'ready', 'failed', 'archived']
    # Its validation scores from training (mAP, precision, recall), once ready.
    metrics: dict[str, Any] | None = None
    # Its classes in index order, as `{"classes": [name, ...]}`.
    class_mapping: dict[str, Any] | None = None
    # Its training settings, including its input `image_width` and `image_height` (local
    # inference reads them).
    training_config: dict[str, Any] | None = None
    version: str = '1.0.0'
    # When set, this model was fine-tuned from another.
    parent_model_id: str | None = None
    # When set, this model was imported from a public model.
    forked_from_model_id: str | None = None
    # Its weights' precision. 'fp16': half-precision weights with fp32 inputs and
    # outputs, about half the size and faster on a GPU.
    precision: Literal['fp32', 'fp16'] = 'fp32'
    created_at: datetime
    updated_at: datetime

iter

Every model, fetched page by page.

Source: Models.iter

Arg Type Default Notes
dataset str | None None Only models trained on this dataset
status ModelStatus | None None As in list
model_type ModelType | None None As in list
page_size int 50 Items fetched per request
max_total int | None None Stop after this many items
for m in client.models.iter(page_size=50):
    print(m.id, m.model_type)
# Page manually with limit + offset until fewer than `limit` rows return.
curl -s "https://api.pictograph.io/api/v1/developer/models/?limit=50&offset=0" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"
# --limit pages through the API for you
pictograph models list --limit 100

Returns OffsetPager[Model]

Model · 22 fields
class Model(BaseModel):
    """A trained computer vision model."""
    id: str
    organization_id: str
    name: str
    # Its URL name, unique in the organization.
    slug: str | None = None
    description: str | None = None
    # Its model card, in Markdown.
    readme: str | None = None
    # Its license's catalog id (such as 'mit'), or 'custom' with license_custom_text.
    license_id: str | None = None
    # The license's text, when license_id is 'custom'.
    license_custom_text: str | None = None
    # How many people starred it.
    star_count: int = 0
    model_type: Literal['object_detection', 'semantic_segmentation', 'instance_segmentation', 'classification', 'keypoint_detection', 'anomaly_detection']
    # Its architecture, such as 'yolox-s' or 'rfdetr-base'.
    architecture: str | None = None
    visibility: Literal['private', 'public']
    status: Literal['training', 'ready', 'failed', 'archived']
    # Its validation scores from training (mAP, precision, recall), once ready.
    metrics: dict[str, Any] | None = None
    # Its classes in index order, as `{"classes": [name, ...]}`.
    class_mapping: dict[str, Any] | None = None
    # Its training settings, including its input `image_width` and `image_height` (local
    # inference reads them).
    training_config: dict[str, Any] | None = None
    version: str = '1.0.0'
    # When set, this model was fine-tuned from another.
    parent_model_id: str | None = None
    # When set, this model was imported from a public model.
    forked_from_model_id: str | None = None
    # Its weights' precision. 'fp16': half-precision weights with fp32 inputs and
    # outputs, about half the size and faster on a GPU.
    precision: Literal['fp32', 'fp16'] = 'fp32'
    created_at: datetime
    updated_at: datetime

get

One model, by name or id.

Source: Models.get

Arg Type Default Notes
model str required Model name or id
model = client.models.get(model="Stop Sign Detector")
print(model.architecture, model.metrics, model.class_mapping)
pictograph models get "Stop Sign Detector"
curl -s "https://api.pictograph.io/api/v1/developer/models/Stop%20Sign%20Detector" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns Model

Model · 22 fields
class Model(BaseModel):
    """A trained computer vision model."""
    id: str
    organization_id: str
    name: str
    # Its URL name, unique in the organization.
    slug: str | None = None
    description: str | None = None
    # Its model card, in Markdown.
    readme: str | None = None
    # Its license's catalog id (such as 'mit'), or 'custom' with license_custom_text.
    license_id: str | None = None
    # The license's text, when license_id is 'custom'.
    license_custom_text: str | None = None
    # How many people starred it.
    star_count: int = 0
    model_type: Literal['object_detection', 'semantic_segmentation', 'instance_segmentation', 'classification', 'keypoint_detection', 'anomaly_detection']
    # Its architecture, such as 'yolox-s' or 'rfdetr-base'.
    architecture: str | None = None
    visibility: Literal['private', 'public']
    status: Literal['training', 'ready', 'failed', 'archived']
    # Its validation scores from training (mAP, precision, recall), once ready.
    metrics: dict[str, Any] | None = None
    # Its classes in index order, as `{"classes": [name, ...]}`.
    class_mapping: dict[str, Any] | None = None
    # Its training settings, including its input `image_width` and `image_height` (local
    # inference reads them).
    training_config: dict[str, Any] | None = None
    version: str = '1.0.0'
    # When set, this model was fine-tuned from another.
    parent_model_id: str | None = None
    # When set, this model was imported from a public model.
    forked_from_model_id: str | None = None
    # Its weights' precision. 'fp16': half-precision weights with fp32 inputs and
    # outputs, about half the size and faster on a GPU.
    precision: Literal['fp32', 'fp16'] = 'fp32'
    created_at: datetime
    updated_at: datetime

update

Change only the fields you pass. Needs a member key.

Source: Models.update

Arg Type Default Notes
model str required Model name or id
name str | None None New name; refused if another model has it
description str | None None New short description
readme str | None None New model card, in Markdown
visibility Literal["private", "public"] | None None public lists it on Explore, private removes it; admin+
license str | None None License catalog id, e.g. mit; custom with license_custom_text
license_custom_text str | None None Terms of a custom license
hf_publish_enabled bool | None None Mirror to Pictograph’s Hugging Face organization while public (on by default); admin+
model = client.models.update(
    model="Stop Sign Detector",
    readme="# Stop Sign Detector\n\nTrained on road-signs v2.",
    license="apache-2.0",
)
print(model.name, model.visibility)
pictograph models update "Stop Sign Detector" --readme README.md --license apache-2.0
curl -s -X PATCH "https://api.pictograph.io/api/v1/developer/models/Stop%20Sign%20Detector" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"readme": "# Stop Sign Detector", "license": "apache-2.0"}'

Returns Model

Model · 22 fields
class Model(BaseModel):
    """A trained computer vision model."""
    id: str
    organization_id: str
    name: str
    # Its URL name, unique in the organization.
    slug: str | None = None
    description: str | None = None
    # Its model card, in Markdown.
    readme: str | None = None
    # Its license's catalog id (such as 'mit'), or 'custom' with license_custom_text.
    license_id: str | None = None
    # The license's text, when license_id is 'custom'.
    license_custom_text: str | None = None
    # How many people starred it.
    star_count: int = 0
    model_type: Literal['object_detection', 'semantic_segmentation', 'instance_segmentation', 'classification', 'keypoint_detection', 'anomaly_detection']
    # Its architecture, such as 'yolox-s' or 'rfdetr-base'.
    architecture: str | None = None
    visibility: Literal['private', 'public']
    status: Literal['training', 'ready', 'failed', 'archived']
    # Its validation scores from training (mAP, precision, recall), once ready.
    metrics: dict[str, Any] | None = None
    # Its classes in index order, as `{"classes": [name, ...]}`.
    class_mapping: dict[str, Any] | None = None
    # Its training settings, including its input `image_width` and `image_height` (local
    # inference reads them).
    training_config: dict[str, Any] | None = None
    version: str = '1.0.0'
    # When set, this model was fine-tuned from another.
    parent_model_id: str | None = None
    # When set, this model was imported from a public model.
    forked_from_model_id: str | None = None
    # Its weights' precision. 'fp16': half-precision weights with fp32 inputs and
    # outputs, about half the size and faster on a GPU.
    precision: Literal['fp32', 'fp16'] = 'fp32'
    created_at: datetime
    updated_at: datetime

download

Download a ready model’s weights to a local file. A format the model doesn’t publish is refused, never swapped for another.

Source: Models.download

Arg Type Default Notes
model str required Model name or id
output_path str | Path required Local file to write
format Literal["onnx", "pytorch", "safetensors", "pte", "engine"] "onnx" Weights format; pte is ExecuTorch, engine TensorRT
precision Literal["fp32", "fp16"] | None None Weights precision; one that wasn’t built is a 404, never substituted
target str | None None ExecuTorch backend for pte, or GPU architecture for engine (required)
chunk_size int 8388608 Bytes per download chunk
progress Callable[[int, int], None] | None None Called with (bytes_so_far, total_bytes); total_bytes is 0 when the size is unknown
from pathlib import Path

client.models.download(
    model="Stop Sign Detector",
    output_path=Path("./stop-sign-detector.onnx"),
)
# The CLI takes --format, not precision or target.
pictograph models download "Stop Sign Detector" --output ./stop-sign-detector.onnx --format onnx
# Returns {"data": {"download_url": …, "expires_in_minutes": 60, …}}; fetch the weights from it.
curl -s "https://api.pictograph.io/api/v1/developer/models/Stop%20Sign%20Detector/download?format=onnx" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns Path

A failed download never leaves a partial file at output_path.

fork

Import a public model into your organization. The copy is private and ready at once, works everywhere your own models do, and keeps working if the source is made private or deleted. Importing is free. Needs a member key.

Source: Models.fork

Arg Type Default Notes
organization str required Source model’s organization slug
model str required Source model’s slug or name
name str | None None Name for the copy (default: the source’s); a taken name gets a (2) suffix, so read the returned name
model = client.models.fork(
    organization="acme-vision",
    model="stop-sign-detector",
    name="Stop signs (ours)",
)
print(model.name, model.visibility, model.forked_from_model_id)
pictograph models fork acme-vision stop-sign-detector --name "Stop signs (ours)"
curl -s -X POST "https://api.pictograph.io/api/v1/developer/models/acme-vision/stop-sign-detector/fork" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Stop signs (ours)"}'

Find public models with Explore.

Returns Model

Model · 22 fields
class Model(BaseModel):
    """A trained computer vision model."""
    id: str
    organization_id: str
    name: str
    # Its URL name, unique in the organization.
    slug: str | None = None
    description: str | None = None
    # Its model card, in Markdown.
    readme: str | None = None
    # Its license's catalog id (such as 'mit'), or 'custom' with license_custom_text.
    license_id: str | None = None
    # The license's text, when license_id is 'custom'.
    license_custom_text: str | None = None
    # How many people starred it.
    star_count: int = 0
    model_type: Literal['object_detection', 'semantic_segmentation', 'instance_segmentation', 'classification', 'keypoint_detection', 'anomaly_detection']
    # Its architecture, such as 'yolox-s' or 'rfdetr-base'.
    architecture: str | None = None
    visibility: Literal['private', 'public']
    status: Literal['training', 'ready', 'failed', 'archived']
    # Its validation scores from training (mAP, precision, recall), once ready.
    metrics: dict[str, Any] | None = None
    # Its classes in index order, as `{"classes": [name, ...]}`.
    class_mapping: dict[str, Any] | None = None
    # Its training settings, including its input `image_width` and `image_height` (local
    # inference reads them).
    training_config: dict[str, Any] | None = None
    version: str = '1.0.0'
    # When set, this model was fine-tuned from another.
    parent_model_id: str | None = None
    # When set, this model was imported from a public model.
    forked_from_model_id: str | None = None
    # Its weights' precision. 'fp16': half-precision weights with fp32 inputs and
    # outputs, about half the size and faster on a GPU.
    precision: Literal['fp32', 'fp16'] = 'fp32'
    created_at: datetime
    updated_at: datetime

delete

Delete a model. Needs an admin key.

Source: Models.delete

Arg Type Default Notes
model str required Model name or id
client.models.delete(model="Stop Sign Detector")
pictograph models delete "Stop Sign Detector" --yes
curl -s -X DELETE "https://api.pictograph.io/api/v1/developer/models/Stop%20Sign%20Detector" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns None

bulk_delete

Delete many models by id in one request. Needs an admin key. An id that matches nothing is listed in not_found, so running it again still succeeds.

Source: Models.bulk_delete

Arg Type Default Notes
models Sequence[str] required Model ids, up to 10,000; duplicates are ignored
result = client.models.bulk_delete(
    models=[
        "6f1c2f0e-6a1e-4a55-9f3a-2f2d3b4c5d6e",
        "7a2d3e1b-8c4f-4b66-9e2a-3f4d5c6b7a8e",
    ],
)
print(result.succeeded, result.not_found, result.count)
# One model's name, or several ids in one request.
pictograph models delete \
  6f1c2f0e-6a1e-4a55-9f3a-2f2d3b4c5d6e \
  7a2d3e1b-8c4f-4b66-9e2a-3f4d5c6b7a8e --yes
curl -s -X POST "https://api.pictograph.io/api/v1/developer/models/bulk-delete" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"models": ["6f1c2f0e-6a1e-4a55-9f3a-2f2d3b4c5d6e",
        "7a2d3e1b-8c4f-4b66-9e2a-3f4d5c6b7a8e"]}'

Returns BulkDeleteResult

BulkDeleteResult · 3 fields
class BulkDeleteResult(BaseModel):
    """What a bulk delete removed."""
    # Ids that existed and were deleted.
    succeeded: list[str] = []
    # Ids that were not found.
    not_found: list[str] = []
    # How many were deleted.
    count: int = 0

    # The same as succeeded.
    @property
    def deleted(self) -> list[str]: ...

versions

A model keeps every version it was trained to. is_current marks the one it serves: the version pinned with set_current_version, else the newest ready one.

Source: Models.versions

Arg Type Default Notes
model str required Model name or id
payload = client.models.versions(model="Stop Sign Detector")
for v in payload.versions:
    print(v.version_number, v.status, v.precision, v.is_current, v.metrics)
pictograph models versions "Stop Sign Detector"            # --json for the payload
curl -s "https://api.pictograph.io/api/v1/developer/models/Stop%20Sign%20Detector/versions" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns ModelVersionsPayload

ModelVersionsPayload · 4 fields
class ModelVersionsPayload(BaseModel):
    """`models.versions`: every version, and which one serves."""
    versions: list[ModelVersionEntry] = []
    current_version_id: str | None = None
    pinned_version_id: str | None = None
    latest_version_id: str | None = None

files

Every file of a model’s versions in one list: its weights in each format, its config.json, and its generated LICENSE.md and README.md.

Source: Models.files

Arg Type Default Notes
model str required Model name or id
manifest = client.models.files(model="Stop Sign Detector")
for f in manifest.files:
    print(f.name, f.runtime, f.precision, f.target_key, f.size_bytes, f.stale)
pictograph models files "Stop Sign Detector"                # the current version; --version / --all-versions
curl -s "https://api.pictograph.io/api/v1/developer/models/Stop%20Sign%20Detector/files" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns ModelFileManifest

ModelFileManifest · 3 fields
class ModelFileManifest(BaseModel):
    """A model's complete version + file manifest (`models.files`)."""
    versions: list[ModelVersionEntry] = []
    files: list[ModelFileEntry] = []
    pinned_version_id: str | None = None

stale means the file was built with an older runtime version. A stale onnx or pte file still loads; a stale TensorRT engine doesn’t, so rebuild it instead of downloading it.

download_file

Download one file of a model, by its name in files.

Source: Models.download_file

Arg Type Default Notes
model str required Model name or id
filename str required File name from files, e.g. config.json
version str | int | None None Version label (2.0.0), number (2) or version_id from files; None uses the current version
output_path str | Path required Where to write it; missing folders are created
chunk_size int 8388608 Bytes per download chunk
progress Callable[[int, int], None] | None None Called with (bytes_so_far, total_bytes)
path = client.models.download_file(
    model="Swift Falcon",
    filename="model.onnx",
    output_path="./model.onnx",
)
print(path)
pictograph models download-file "Stop Sign Detector" model.onnx -o ./model.onnx --version 2
# List the manifest, then fetch the row's signed download_url.
curl -s "https://api.pictograph.io/api/v1/developer/models/Stop%20Sign%20Detector/files" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns Path

A failed download never leaves a partial file at output_path.

load

Load a model to run on your machine, with this client’s key (Local inference).

Source: Models.load

Arg Type Default Notes
model str required Model name or id
task TaskName | None None Task, which types the returned model and results; None reads it from the model
format WeightFormat "onnx" Weights format: onnx, pytorch, safetensors, pte or engine; the runtime follows from it
precision Literal["fp32", "fp16"] | None None Weights precision; None takes the model’s published precision
target str | None None GPU architecture for engine (default: this machine’s, e.g. sm75), or backend for pte (default xnnpack)
confidence float 0.5 Minimum score for predict, 0 to 1
device Device "auto" auto, cpu, cuda (or cuda:1) or mps, on every format
cache_path str | Path | None None Cache directory for downloaded files; None uses the SDK’s default
detector = client.models.load(
    model="Swift Falcon",
    format="onnx",
    confidence=0.4,
)
result = detector.predict("photo.jpg")
# `load` returns an in-process model object; download the weights instead.
pictograph models download "Stop Sign Detector" -o model.onnx
# `load` returns an in-process model object - there is no REST endpoint.

Returns AnyModel

AnyModel
AnyModel = (
    DetectionModel
    | InstanceSegmentationModel
    | SemanticSegmentationModel
    | KeypointModel
    | ClassificationModel
    | AnomalyModel
)

predict

Run one image through the model on Pictograph: nothing to install, free on every plan within a daily limit.

Source: Models.predict

Arg Type Default Notes
model str required Model name or id
image str | Path | bytes required File path, http(s):// URL (fetched locally, then uploaded) or bytes
confidence float 0.5 Minimum score for returned predictions (0.05 to 0.95)
top_k int 3 Predictions to return (classifiers only)
result = client.models.predict(
    model="Swift Falcon",
    image="photo.jpg",
    confidence=0.4,
)
for annotation in result.annotations:
    print(annotation.name, round(annotation.confidence, 2))
pictograph models predict "Swift Falcon" photo.jpg --remote --confidence 0.4 --json

The CLI also reads URLs, - (stdin), globs, a video’s frames (--video clip.mp4 --sample-fps 2) or a dataset’s images (--dataset shelves --directory /val), a JSON line each (CLI: models).

curl -s -X POST "https://api.pictograph.io/api/v1/developer/models/Stop%20Sign%20Detector/predict?confidence_threshold=0.5&top_k=3" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"\
  -F "file=@street.jpg"

Returns ModelPredictResult

ModelPredictResult · 8 fields
class ModelPredictResult(BaseModel):
    """Result of a remote single-image test inference (`models.predict`)."""
    success: bool = True
    annotations: list[dict[str, Any]] = []
    tags: list[str] = []
    tag_scores: list[float] = []
    anomaly_score: float | None = None
    is_anomalous: bool | None = None
    model_type: Optional[Literal['object_detection', 'semantic_segmentation', 'instance_segmentation', 'classification', 'keypoint_detection', 'anomaly_detection']] = None
    inference_seconds: float = 0.0

set_current_version

Pin the version a model serves everywhere: downloads, deployments and auto-annotation. The pin outlasts later training runs; unpinned, the newest ready version serves. Needs an admin key.

Source: Models.set_current_version

Arg Type Default Notes
model str required Model name or id
version str | None required Version to make current; None unpins
versions = client.models.set_current_version(
    model="Swift Falcon",
    version="3f8a1c22-7d40-4b91-a2e5-6c9b0d1e2f34",
)
print(versions.current_version_id)
pictograph models set-version "Stop Sign Detector" 1.0.0     # roll back
pictograph models set-version "Stop Sign Detector" --clear   # follow the newest ready version
curl -s -X PATCH "https://api.pictograph.io/api/v1/developer/models/Stop%20Sign%20Detector/current-version" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"version": "6f1c2f0e-6a1e-4a55-9f3a-2f2d3b4c5d6e"}'

Returns ModelVersionsPayload

ModelVersionsPayload · 4 fields
class ModelVersionsPayload(BaseModel):
    """`models.versions`: every version, and which one serves."""
    versions: list[ModelVersionEntry] = []
    current_version_id: str | None = None
    pinned_version_id: str | None = None
    latest_version_id: str | None = None

Status lifecycle

status Meaning
training Training in progress; download fails until it is ready
ready Trained; its weights can be downloaded
failed Training failed; see its run’s error_message
archived Retired and hidden from list() unless status="archived"; unlike delete, it keeps the model

Running a model

  • One image, free: predict runs it on Pictograph (a daily limit applies).
  • On your machine: load, pictograph.get_model or pictograph.load_model, in any of five weight formats (Local inference).
  • At volume or in real time: a deployment or a workflow.

Common errors

Status Exception Cause
400 ValidationError download of a model that isn’t ready, update with a name another model has, or a fork source with no weights
403 ForbiddenError A key below member (update, fork, predict) or admin (update(visibility=...), set_current_version, delete, bulk_delete)
404 NotFoundError The model doesn’t exist in your organization, or a fork source is private, not ready or missing (one answer for all three)
409 ConflictError The model doesn’t publish the requested format, or format="engine" without a target
429 RateLimitError predict’s daily limit is reached; retry after Retry-After
Copied to clipboard