diff --git a/src/translator/parser.h b/src/translator/parser.h index fa4e7bbc8..207890c84 100644 --- a/src/translator/parser.h +++ b/src/translator/parser.h @@ -31,7 +31,7 @@ inline marian::ConfigParser createConfigParser() { } inline std::shared_ptr -parseOptions(const std::string &config) { +parseOptions(const std::string &config, bool validate = true) { marian::Options options; // @TODO(jerinphilip) There's something off here, @XapaJIaMnu suggests @@ -58,8 +58,11 @@ parseOptions(const std::string &config) { options.parse(config); YAML::Node configCopy = options.cloneToYamlNode(); - marian::ConfigValidator validator(configCopy); - validator.validateOptions(marian::cli::mode::translation); + if (validate) { + // Perform validation on parsed options only when requested + marian::ConfigValidator validator(configCopy); + validator.validateOptions(marian::cli::mode::translation); + } return std::make_shared(options); } diff --git a/src/translator/service.h b/src/translator/service.h index 476be287b..a731653bc 100644 --- a/src/translator/service.h +++ b/src/translator/service.h @@ -84,7 +84,7 @@ class Service { explicit Service(const std::string &config, AlignedMemory modelMemory = AlignedMemory(), AlignedMemory shortlistMemory = AlignedMemory()) - : Service(parseOptions(config), std::move(modelMemory), + : Service(parseOptions(config, /*validate=*/false), std::move(modelMemory), std::move(shortlistMemory)) {} /// Explicit destructor to clean up after any threads initialized in