Skip to content

Commit

Permalink
Move models out of data and install them with onnxrt (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkoskela authored Nov 14, 2024
1 parent e384883 commit 99a63e0
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions cmake_files/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ find_package(yaml-cpp REQUIRED)

if (onnxrt)
find_package(onnxruntime REQUIRED)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/models DESTINATION .)
endif()

find_package(sopt REQUIRED)
Expand Down
6 changes: 3 additions & 3 deletions cpp/tests/algo_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ TEST_CASE("tf_fb_factory") {
t_real const gamma = 0.0001;

std::string tf_model_path =
purify::notinstalled::data_directory() + "/models/snr_15_model_dynamic.onnx";
purify::notinstalled::models_directory() + "/snr_15_model_dynamic.onnx";

auto const fb = factory::fb_factory<sopt::algorithm::ImagingForwardBackward<t_complex>>(
factory::algo_distribution::serial, measurements_transform, wavelets, uv_data, sigma, beta,
Expand Down Expand Up @@ -287,9 +287,9 @@ TEST_CASE("onnx_fb_factory") {
t_real const gamma = 0.0001;

std::string const prior_path =
purify::notinstalled::data_directory() + "/models/example_cost_dynamic_CRR_sigma_5_t_5.onnx";
purify::notinstalled::models_directory() + "/example_cost_dynamic_CRR_sigma_5_t_5.onnx";
std::string const prior_gradient_path =
purify::notinstalled::data_directory() + "/models/example_grad_dynamic_CRR_sigma_5_t_5.onnx";
purify::notinstalled::models_directory() + "/example_grad_dynamic_CRR_sigma_5_t_5.onnx";
std::shared_ptr<sopt::ONNXDifferentiableFunc<t_complex>> diff_function =
std::make_shared<sopt::ONNXDifferentiableFunc<t_complex>>(
prior_path, prior_gradient_path, sigma, 20, 5e4, *measurements_transform);
Expand Down
3 changes: 3 additions & 0 deletions cpp/tests/directories.in.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ namespace notinstalled {

//! Holds data and such
inline std::string data_directory() { return "@CMAKE_INSTALL_PREFIX@/data"; }
//! Holds TF models
inline std::string models_directory() { return "@CMAKE_INSTALL_PREFIX@/models"; }

//! Holds data and such
inline std::string data_filename(std::string const &filename) {
return data_directory() + "/" + filename;
Expand Down
File renamed without changes.

0 comments on commit 99a63e0

Please sign in to comment.