Skip to main content

Crate model_runtime

Crate model_runtime 

Source
Expand description

§model-runtime

Generic model infrastructure for the workspace.

This crate owns model identity, sources, bundle materialization, downloads, model-specific artifact metadata, and job helpers. Generic artifact storage and validation live in moritzbrantner-jobs-core; model bundles and Hugging Face download logic stay here. Domain crates should hide this layer behind operations such as object detection, transcription, OCR, segmentation, embeddings, and classification.

§Runtime Surface

  • model.executionPlan validates a ModelAccessJobRequest and returns a pure job/access plan with runtime execution metadata.
  • model.bundlePlan plans bundle manifest layout and artifact references without downloading or materializing files.
  • model.jobManifest projects a planned model access job into a deterministic JobManifest.
  • model.presets lists preset ids and model spec summaries.
  • model.spec validates a model spec and returns safe names, task, source, requested files, and revision.

Default surface operations are deterministic and planning-only. They do not download models, spawn background jobs, run native inference, execute external commands, write files, or access the network.

§Local ONNX Defaults

moritzbrantner-model-runtime owns materialization for the server-only local model workflows used by text QA, image classification, and image captioning. The current ONNX-first presets are:

  • roberta-base-squad2-onnx: onnx-community/roberta-base-squad2-ONNX.
  • vit-base-patch16-224-onnx: Xenova/vit-base-patch16-224.
  • vit-gpt2-image-captioning-onnx: Xenova/vit-gpt2-image-captioning.

Use resolve_or_download_bundle when a workflow should load an existing bundle first and auto-download missing files into .model-runtime on native server/CLI runtimes. WASM callers should keep using validation/import paths.

Re-exports§

pub use jobs::plan_model_access;
pub use jobs::plan_model_bundle;
pub use jobs::ModelAccessJobRequest;
pub use jobs::ModelAccessPlan;
pub use jobs::ModelBundlePlan;
pub use jobs::ModelBundlePlanFile;
pub use jobs::ModelJobInput;
pub use jobs::ModelJobKind;

Modules§

jobs
surface
Library-owned runtime surface for model-runtime.

Structs§

BlueGreenPredictionTestOptions
Data type for blue/green prediction test options.
BlueGreenPredictionTestReport
Data type for blue/green prediction test report.
CudaOxideModelPlan
Data type for cuda-oxide model plan.
CudaOxideRuntimeConfig
Data type for cuda-oxide runtime config.
DownloadedModel
Data type for downloaded model.
HuggingFaceDownloader
Data type for hugging face downloader.
ModelBundle
Data type for model bundle.
ModelBundleFile
Data type for model bundle file.
ModelBundleManifest
Data type for model bundle manifest.
ModelBundleResolveOptions
Options for resolving a local bundle, downloading it when allowed.
ModelBundleStore
Data type for model bundle store.
ModelRuntimeSelection
Advanced generic runtime selection.
ModelSpec
Generic model spec.
RawPrediction
Backend-neutral raw model prediction used for runtime conformance checks.

Enums§

FallbackPolicy
General fallback behavior for model-backed operations.
ModelFileRequest
Variants describing model file request.
ModelPreset
Variants describing model preset.
ModelRuntimeBackend
Variants describing model runtime backend.
ModelRuntimeError
Error type used by generic model runtime infrastructure.
ModelSource
Model source.
ModelTask
Variants describing model task.
RuntimePreference
General runtime preference for domain APIs.

Constants§

CUDA_OXIDE_BOOK_URL
Documentation URL for the cuda-oxide compiler/runtime stack.

Traits§

ModelDownloader
Minimal downloader seam for bundle resolution tests and alternate materializers.

Functions§

compare_blue_green_predictions
Compares green and blue model predictions for runtime conformance tests.
resolve_or_download_bundle
Resolves a bundle from disk, optionally downloading and materializing it first.
resolve_or_download_bundle_with_downloader
Resolves a bundle with a caller-provided downloader seam.

Type Aliases§

HuggingFaceModelSpec
Hugging Face-oriented compatibility alias for callers migrating to ModelSpec.
Result
Result type used by generic model runtime infrastructure.