diff --git a/src/models/input_ids.cpp b/src/models/input_ids.cpp index 9333728963..7ace903c81 100644 --- a/src/models/input_ids.cpp +++ b/src/models/input_ids.cpp @@ -106,7 +106,7 @@ void DefaultInputIDs::Update(DeviceSpan new_tokens) { WindowedInputIDs::WindowedInputIDs(State& state) : state_{state} { if (model_.p_device_inputs_->GetType() != DeviceType::QNN && model_.p_device_inputs_->GetType() != DeviceType::CPU) { - throw std::runtime_error("Sliding a window over input_ids works with either the QNN or the CPU provider."); + throw std::runtime_error("Sliding a window over input_ids only works with either the QNN or the CPU provider."); } name_ = model_.config_->model.decoder.inputs.input_ids.c_str(); diff --git a/src/models/model.cpp b/src/models/model.cpp index 2666d869a6..06f8ec2653 100644 --- a/src/models/model.cpp +++ b/src/models/model.cpp @@ -283,7 +283,7 @@ DeviceInterface* SetProviderSessionOptions(OrtSessionOptions& session_options, auto providers_list = providers; if (!is_primary_session_options) { // Providers specified in a non-primary provider options list are added - // to the primary providers. They are considered immutable and implcitly + // to the primary providers. They are considered immutable and implicitly // added as providers. std::transform(provider_options_list.begin(), provider_options_list.end(), std::back_inserter(providers_list), [](const auto& provider_options) { return provider_options.name; }); @@ -642,6 +642,9 @@ void Model::CreateSessionOptionsFromConfig(const Config::SessionOptions& config_ if (!p_device_) { p_device_ = session_device; + } else if (session_device != nullptr && session_device->GetType() != p_device_->GetType()) { + throw std::runtime_error("Running a model with multiple providers is not supported. Encountered " + + to_string(session_device->GetType()) + " and " + to_string(p_device_->GetType())); } }