Skip to content

Commit

Permalink
Merge branch 'download-model-fix' into 'master'
Browse files Browse the repository at this point in the history
quickfix for issue with SSL verification

See merge request machine-learning/dorado!113
  • Loading branch information
iiSeymour committed Oct 5, 2022
2 parents 3e893dc + aa3b5d2 commit 4b67720
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions dorado/cli/download.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,32 @@ int download(int argc, char* argv[]) {
return 1;
}

try {
fs::remove(directory / "tmp");
} catch (std::filesystem::filesystem_error const& e) {
std::cerr << "> error: " << e.code().message() << std::endl;
return 1;
}

httplib::Client http(basecaller::URL_ROOT);
http.enable_server_certificate_verification(false);
http.set_follow_location(true);

for (const auto& [model, url] : basecaller::models) {
if (selected_model == "all" || selected_model == model) {
std::cerr << " - downloading " << model;
auto res = http.Get(url.c_str());
std::cerr << " [" << res->status << "]" << std::endl;
fs::path archive(directory / (model + ".zip"));
std::ofstream ofs(archive.string());
ofs << res->body;
ofs.close();
elz::extractZip(archive, directory);
fs::remove(archive);
if (res != nullptr) {
std::cerr << " [" << res->status << "]" << std::endl;
fs::path archive(directory / (model + ".zip"));
std::ofstream ofs(archive.string());
ofs << res->body;
ofs.close();
elz::extractZip(archive, directory);
fs::remove(archive);
} else {
std::cerr << "Failed to download " << model << std::endl;
}
}
}

Expand Down

0 comments on commit 4b67720

Please sign in to comment.