﻿# ONNX external data: release the graph and relative tensor files together

Package ONNX external tensor data without breaking relative locations, confusing graph validation with file integrity or publishing mismatched model and weight revisions.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-onnx-external-data-relative-artifact-release/
Language: en

## A small graph file hides a large dependency

A container image contains the expected model file, but loading fails after moving it into a different directory. The graph may be intact while the external tensor file stayed behind. Treat this as an artifact-layout failure before assuming the GPU lacks memory. External storage separates tensor bytes from the serialized graph; it does not make those bytes optional or authorize a loader to substitute another file with a similar name.

## Relative locations are part of tensor identity

The [external data specification](https://onnx.ai/onnx/repo-docs/ExternalData.html) describes a location relative to the model directory, with optional byte offsets and lengths. Preserve that directory relationship during packaging. A shared tensor file can contain several ranges, so merely confirming that the file exists is insufficient: its contents must belong to the same export. Avoid independently updating graph and weight files through mutable deployment paths that expose an intermediate mismatched state.

## Loading APIs need the intended base directory

The [external data helper API](https://onnx.ai/onnx/api/external_data_helper.html) exposes operations for loading and converting external data. Review which step resolves files and which step changes the in-memory representation. Loading a graph without materializing tensor bytes is useful for inspection, but it is not proof that the final package can run. The [release-manifest guide](/journal/tokenizer-artifact-release-manifest/) provides a comparable reason to identify every required companion artifact rather than only the principal filename.

## Structural checks have a scope

The [ONNX checker API](https://onnx.ai/onnx/api/checker.html) documents model validation. Run checks against the packaged location with the intended files available, then load and evaluate the model in the deployment environment. Keep a separate digest inventory of graph and data files. An optional checksum field in a format does not establish that every consumer automatically verifies your chosen release policy. Specify the verification procedure rather than inferring it from the presence of metadata.

## Publish a coherent directory snapshot

Stage a complete immutable directory, validate it, and only then switch the active release reference. A rollback must restore the matching graph and tensor files together. Use [artifact signature verification](/journal/artifact-signature-verification/) to bind this directory inventory to the reviewed release. A useful failure report includes the resolved model directory and missing or mismatched relative dependency, while excluding confidential tensor contents. This narrows diagnosis without treating storage packaging and numerical correctness as the same check.
