Skip to content

Commit

Permalink
Follow up to autocomplete pr #317 (#320)
Browse files Browse the repository at this point in the history
* Fllow up with error msg

* Setting decoupled after autocomplete in ModelState:Create

* Refactor

* Refactor according to Tanmay discussion
  • Loading branch information
oandreeva-nv authored Nov 8, 2023
1 parent 0f12211 commit 60a9091
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
23 changes: 23 additions & 0 deletions src/python_be.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2005,6 +2005,29 @@ ModelState::ValidateModelConfig()
return nullptr;
}

TRITONSERVER_Error*
ModelState::SetModelConfig()
{
BackendModel::SetModelConfig();
// `Update model_transaction_policy` if setting was set
// with `set_model_transaction_policy`
triton::common::TritonJson::Value model_transaction_policy;
bool is_decoupled = false;
if (ModelConfig().Find(
"model_transaction_policy", &model_transaction_policy)) {
triton::common::TritonJson::Value decoupled;
if (model_transaction_policy.Find("decoupled", &decoupled)) {
auto error = decoupled.AsBool(&is_decoupled);
if (error != nullptr) {
throw BackendModelException(error);
}
SetDecoupled(is_decoupled);
}
}

return nullptr;
}


extern "C" {

Expand Down
7 changes: 7 additions & 0 deletions src/python_be.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ class ModelState : public BackendModel {
// Is decoupled API being used.
bool IsDecoupled() { return decoupled_; }

// Set decoupled mode
void SetDecoupled(bool decoupled) { decoupled_ = decoupled; }

// Returns the value in the `runtime_modeldir_` field
std::string RuntimeModelDir() { return runtime_modeldir_; }

Expand All @@ -247,6 +250,10 @@ class ModelState : public BackendModel {
// Validate Model Configuration
TRITONSERVER_Error* ValidateModelConfig();

// Overrides `BackendModel::SetModelConfig` to also
// set `ModelState::decoupled_`
TRITONSERVER_Error* SetModelConfig();

// Auto-complete stub
std::unique_ptr<StubLauncher>& Stub() { return auto_complete_stub_; }

Expand Down
2 changes: 1 addition & 1 deletion src/resources/triton_python_backend_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def add_input(self, input):
+ input["name"]
+ "' in auto-complete-config function for model '"
+ self._model_config["name"]
+ "' contains property other than 'name', 'data_type' and 'dims'."
+ "' contains property other than 'name', 'data_type', 'dims' and 'optional'."
)

if "name" not in input:
Expand Down

0 comments on commit 60a9091

Please sign in to comment.