Make default throw exception on abort for python (#333)

This also allows conversion of exiting aborts into runtime errors in python, 
providing informative messages to the user via pybind11 existing tooling.
This commit is contained in:
Jerin Philip 2022-02-05 17:25:29 +00:00 committed by GitHub
parent b1e5a48f1a
commit 97bd6e36db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,7 +33,10 @@ PYBIND11_MAKE_OPAQUE(Alignments);
class ServicePyAdapter {
public:
ServicePyAdapter(const Service::Config &config) : service_(make_service(config)) {}
ServicePyAdapter(const Service::Config &config) : service_(make_service(config)) {
// Set marian to throw exceptions instead of std::abort()
marian::setThrowExceptionOnAbort(true);
}
std::shared_ptr<_Model> modelFromConfig(const std::string &config) {
auto parsedConfig = marian::bergamot::parseOptionsFromString(config);