Skip to content

option to deploy single model from local storage without versioning#4209

Open
dtrawins wants to merge 5 commits into
mainfrom
single-classic-model
Open

option to deploy single model from local storage without versioning#4209
dtrawins wants to merge 5 commits into
mainfrom
single-classic-model

Conversation

@dtrawins
Copy link
Copy Markdown
Collaborator

@dtrawins dtrawins commented May 14, 2026

🛠 Summary

This option can be useful for deploying models from hugging face which typically include a set of model variances with different quantizations. It could be combined with image processing parameters based on preprocessing_config.json

🧪 Checklist

  • Unit tests added.
  • The documentation updated.
  • Change follows security best practices.
    ``

@dtrawins dtrawins requested review from atobiszei and dkalinowski May 14, 2026 10:50
@dtrawins dtrawins marked this pull request as ready for review May 19, 2026 12:28
Copilot AI review requested due to automatic review settings May 19, 2026 12:28
@dtrawins dtrawins requested a review from mzegla May 19, 2026 12:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for configuring a model base_path as a single local model file (instead of a versioned directory structure), exposing a synthetic version 1. This fits into OVMS’s classic model repository workflow by simplifying deployments where model artifacts are stored as standalone files (e.g., local exports / hub downloads).

Changes:

  • Extend model version discovery to treat certain local regular files as a single-model repository (synthetic version 1).
  • Update model file discovery and config path handling to work when base_path is a file (including mapping config lookup).
  • Add unit tests and update docs to describe the new single-file base_path mode.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/modelmanager.cpp Detects local regular-file base_path and returns synthetic version 1 for supported extensions.
src/modelinstance.cpp Adds file-path handling in model file discovery (IR/ONNX/Paddle/TF/TFLite).
src/modelconfig.cpp Adjusts getPath() and mapping config lookup behavior for file-based local paths.
src/test/modelmanager_test.cpp Adds tests for single-file version discovery and config-based startup using an .xml file path.
docs/parameters.md Documents that local base_path may point directly to a single model file and exposes version 1.
docs/models_repository_classic.md Documents the single-file alternative for local filesystem classic repositories.
Comments suppressed due to low confidence (1)

src/modelinstance.cpp:1131

  • For PaddlePaddle single-file paths (.pdmodel/.pdiparams), switching to the parent directory and searching by extension can select a different pair when multiple variants exist. Resolve the companion file corresponding to the explicitly provided file (e.g., same stem) so the configured variant is deterministically loaded.
        if (extension == ".pdmodel" || extension == ".pdiparams") {
            path = modelDirectory;
            bool found = false;
            fetchModelFiles(found, PADDLE_MODEL_FILES_EXTENSIONS);
            if (!found) {

Comment thread src/modelinstance.cpp
Comment on lines +1104 to +1106
std::error_code ec;
if (FileSystem::isLocalFilesystem(path) && std::filesystem::is_regular_file(path, ec)) {
const auto modelFile = std::filesystem::path(path);
Comment thread src/modelinstance.cpp Outdated
Comment on lines +1111 to +1115
if (extension == ".xml") {
path = modelDirectory;
bool found = false;
fetchModelFiles(found, OV_MODEL_FILES_EXTENSIONS);
if (!found) {
Comment thread src/modelinstance.cpp Outdated

if (!found) {
SPDLOG_ERROR("Could not find file for model: {} version: {} in path: {}", getName(), getVersion(), path);
SPDLOG_ERROR("Error loading model. Invalid model file.");
Comment thread docs/models_repository_classic.md Outdated
- Each model directory should include a sub-folder for each of its versions (1,2, etc). The versions and their folder names should be positive integer values.
**Note:** In execution, the versions are enabled according to a pre-defined version policy. If the client does not specify
the version number in parameters, by default, the latest version is served.
- As an alternative for local filesystem only, `model_path` / `base_path` can point directly to a single model file (`.xml`, `.bin`, `.onnx`, `.pdmodel`, `.pdiparams`, `.pb`, `.tflite`). In this mode, Model Server exposes synthetic version `1`.
Comment thread src/modelmanager.cpp
Comment on lines +1295 to +1301
static const std::set<std::string> supportedSingleFileModelExtensions = {
".xml",
".onnx",
".pdmodel",
".pdiparams",
".pb",
".tflite"};
Copy link
Copy Markdown
Collaborator

@mzegla mzegla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general - please look into copilot comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants