Integrate "get model versions" and "download specific model version" into cpp Core with max_versions#816
Integrate "get model versions" and "download specific model version" into cpp Core with max_versions#816selenayang888 wants to merge 25 commits into
Conversation
…o baijumeswani/catalog
…/integrate-get-model-versions-into-cpp
…odel-versions-into-cpp
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…odel-versions-into-cpp
…odel-versions-into-cpp
… the default list"
| /// Returns the variants (in any order; the base class sorts/indexes them) | ||
| /// for the given alias. |
There was a problem hiding this comment.
These should automatically be sorted by AddVariant so should be in the same priority order as the model list output.
| } | ||
|
|
||
| container.SelectDefaultVariant(); | ||
| version_query_models_[model_alias] = std::make_unique<Model>(std::move(container)); |
There was a problem hiding this comment.
If someone had previously queried for this alias this line is going to invalidate the previously returned flModelList. The comment in the C and C++ code says that never happens.
| // Sort into best-first order. Within the same variant name, device priority is identical, | ||
| // so this also groups by name with latest version first — suitable for max_versions capping. | ||
| std::stable_sort(result.begin(), result.end(), [](const Model* a, const Model* b) { | ||
| return Model::CompareBestFirst(*a, *b); | ||
| }); |
There was a problem hiding this comment.
I didn't expect sorting would be required here as Model::AddVariant sorts on insert to keep the vector of variants in the priority order, so you should be able to use the list returned from Model::Variants() as-is.
|
Will the other language bindings have GetModelVersions exposed in this PR or a separate one? AI should be able to handle adding that fairly easily. |
Porting the changes "get model versions" and "download specific model version" from C# into C++ Core now: