Skip to content

default task detection based on model config#4317

Draft
dtrawins wants to merge 11 commits into
mainfrom
default-task
Draft

default task detection based on model config#4317
dtrawins wants to merge 11 commits into
mainfrom
default-task

Conversation

@dtrawins

Copy link
Copy Markdown
Collaborator

🛠 Summary

JIRA/Issue if applicable.
Describe the changes.

🧪 Checklist

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

Comment thread src/cli_parser.cpp Outdated
// Check if task-specific parameters are provided or if graph.pbtxt is missing
bool hasUnmatchedOptions = ::ovms::hasTaskSpecificParameters(result->unmatched());
bool graphExists = ::ovms::graphPbtxtExists(*modelPath);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change

Comment thread src/cli_parser.cpp Outdated
const std::optional<std::string> modelPath = result->count("model_path") ? std::make_optional(result->operator[]("model_path").as<std::string>()) : std::nullopt;
const std::optional<std::string> sourceModel = result->count("source_model") ? std::make_optional(result->operator[]("source_model").as<std::string>()) : std::nullopt;
const std::optional<std::string> modelRepositoryPath = result->count("model_repository_path") ? std::make_optional(result->operator[]("model_repository_path").as<std::string>()) : std::nullopt;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change

Comment thread src/cli_parser.cpp Outdated
bool graphExists = ::ovms::graphPbtxtExists(*modelPath);
shouldInferTask = hasUnmatchedOptions || !graphExists;
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change

@dtrawins dtrawins requested review from dkalinowski and mzegla June 23, 2026 10:09
@@ -0,0 +1,6 @@
{
"architectures": ["XLMRobertaForSequenceClassification"],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see its possible to have more than 1 architecture (its a list). How would OVMS behave? Can you add test for that behavior?

@@ -0,0 +1,5 @@
{
"architectures": ["UNet2DConditionModel"],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please add these files to data field in unit test build target. If you dont do that, the unit tests will not re-run once this file change.

Example: https://github.com/openvinotoolkit/model_server/blob/main/src/BUILD#L2337-L2364

const std::string modelPath = resolveTestModelPath("llama");
const std::filesystem::path configJson = std::filesystem::path(modelPath) / "config.json";
if (!std::filesystem::exists(configJson)) {
GTEST_SKIP() << "Test prerequisite missing: " << configJson.string();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why skipping? Shouldnt it error?

Comment thread src/BUILD
cc_binary(
name = "num_streams_repro",
srcs = [
"num_streams_repro.cpp",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

?

Comment thread src/cli_parser.cpp
{"XLMRobertaModel", "embeddings"},
};

std::string getEnvOrDefault(const char* envName, const std::string& defaultValue = "") {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

these functions should be static

Comment thread src/cli_parser.cpp
}
}
if (!resolvedTask.has_value()) {
throw std::logic_error("config.json architectures do not map to a supported default task");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please add test for that

Comment thread src/cli_parser.cpp

result = std::make_unique<cxxopts::ParseResult>(options->parse(argc, argv));

const bool isConfigManagementFlow =

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could be a CLIParser method

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.

2 participants