Files
nixpkgs/pkgs/development/rocm-modules/6/miopen/test-frugally-deep-model-loading.cpp
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

56 lines
1.8 KiB
C++

#include <fdeep/fdeep.hpp>
#include <iostream>
#include <filesystem>
#include <vector>
#include <string>
int main() {
std::vector<std::string> model_files;
std::string src_dir = std::getenv("SRC_DIR") ? std::getenv("SRC_DIR") : ".";
// collect *tn.model files except _metadata
try {
for (const auto& entry : std::filesystem::recursive_directory_iterator(src_dir)) {
if (entry.is_regular_file()) {
std::string path = entry.path().string();
if (path.find("tn.model") != std::string::npos && path.find("_metadata.") == std::string::npos) {
model_files.push_back(path);
}
}
}
} catch (const std::exception& e) {
std::cerr << "Error scanning directory: " << e.what() << std::endl;
return 1;
}
if (model_files.empty()) {
std::cout << "No *.tn.model files found in " << src_dir << std::endl;
return 1;
}
std::cout << "Found " << model_files.size() << " model files to test" << std::endl;
int failed_count = 0;
for (const auto& model_file : model_files) {
std::cout << "Loading: " << model_file << " ... ";
std::cout.flush();
try {
const auto model = fdeep::load_model(model_file);
std::cout << "OK" << std::endl;
} catch (const std::exception& e) {
std::cout << "FAILED: " << e.what() << std::endl;
failed_count++;
}
}
if (failed_count > 0) {
std::cerr << "\n" << failed_count << " out of " << model_files.size()
<< " models failed to load" << std::endl;
return 1;
}
std::cout << "\nAll " << model_files.size() << " models loaded successfully!" << std::endl;
return 0;
}