Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion bin/pytorch_inference/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <torch/script.h>

#include <cstdint>
#include <cstdlib>
#include <exception>
#include <memory>
#include <optional>
Expand Down Expand Up @@ -315,7 +316,13 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}
module_ = torch::jit::load(std::move(readAdapter));
verifySafeModel(module_);
const char* skipValidation = std::getenv("ML_SKIP_MODEL_VALIDATION");
if (skipValidation != nullptr && std::string{skipValidation} == "true") {
LOG_WARN(<< "Model graph validation SKIPPED — ML_SKIP_MODEL_VALIDATION=true. "
<< "This disables security checks on model operations.");
} else {
verifySafeModel(module_);
}
module_.eval();

LOG_DEBUG(<< "model loaded");
Expand Down
Loading