Skip to content

Commit

Permalink
Merge branch 'smalton/auto-model-error' into 'master'
Browse files Browse the repository at this point in the history
Auto model error

See merge request machine-learning/dorado!754
  • Loading branch information
malton-ont committed Dec 7, 2023
2 parents 936d408 + e5b95cc commit c552351
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dorado/data_loader/ModelFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ ModelSelection ModelComplexParser::parse(const std::string& arg) {
spdlog::trace("Model option: '{}' unknown - assuming path", variant_str);
selection.model = ModelVariantPair{model_variant};
} else {
spdlog::trace("'{}' found variant: '{}' and version: '{}'", variant_str),
to_string(model_variant), to_string(version);
spdlog::trace("'{}' found variant: '{}' and version: '{}'", variant_str,
to_string(model_variant), to_string(version));
selection.model = ModelVariantPair{model_variant, version};
}
} else {
Expand Down
10 changes: 4 additions & 6 deletions dorado/models/models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void suggest_models(const std::vector<ModelInfo>& models,
const ModelVariantPair& model,
const ModsVariantPair& mods) {
if (Chemistry::NONE == chemistry) {
throw std::runtime_error("cannot get model without chemistry");
throw std::runtime_error("Cannot get model without chemistry");
}

if (mods.has_variant()) {
Expand Down Expand Up @@ -154,18 +154,16 @@ ModelInfo find_model(const std::vector<ModelInfo>& models,
const ModsVariantPair& mods,
bool suggestions) {
if (Chemistry::NONE == chemistry) {
throw std::runtime_error("cannot get model without chemistry");
throw std::runtime_error("Cannot get model without chemistry");
}
const auto matches = find_models(models, chemistry, model, mods);

if (matches.empty()) {
spdlog::error("Failed to get {} model", description);
if (suggestions) {
spdlog::error("Failed to get {} model. No matches for {}", description,
format_msg(chemistry, model, mods));
suggest_models(models, description, chemistry, model, mods);
}
throw std::runtime_error("Failed to get " + description + " model. No matches for " +
format_msg(chemistry, model, mods));
throw std::runtime_error("No matches for " + format_msg(chemistry, model, mods));
}

// Get the only match or the latest model
Expand Down

0 comments on commit c552351

Please sign in to comment.