-
Couldn't load subscription status.
- Fork 660
feat: allow Triton model config specification in TensorModelConfig #3874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6e14de4
5eef909
a4b0fdd
67d14e6
bd6eedb
8b9f4e6
efb015d
1a77c6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,8 @@ use inference::{ | |
| ModelMetadataRequest, ModelMetadataResponse, ModelStreamInferResponse, | ||
| }; | ||
|
|
||
| use prost::Message; | ||
|
|
||
| /// [gluo TODO] 'metrics' are for HTTP service and there is HTTP endpoint | ||
| /// for it as part of HTTP service. Should we always start HTTP service up | ||
| /// for non-inference? | ||
|
|
@@ -418,6 +420,50 @@ impl GrpcInferenceService for KserveService { | |
| if card.model_type.supports_tensor() { | ||
| if let Some(tensor_model_config) = card.runtime_config.tensor_model_config.as_ref() | ||
| { | ||
| if let Some(triton_model_config) = | ||
| tensor_model_config.triton_model_config.as_ref() | ||
| { | ||
| let model_config = ModelConfig::decode(triton_model_config.as_slice()) | ||
| .map_err(|e| { | ||
| Status::invalid_argument(format!( | ||
| "Failed to deserialize model config: {}", | ||
| e | ||
| )) | ||
| })?; | ||
| return Ok(Response::new(ModelMetadataResponse { | ||
| name: model_config.name, | ||
| versions: vec!["1".to_string()], | ||
| platform: model_config.platform, | ||
| inputs: model_config | ||
| .input | ||
| .iter() | ||
| .map(|input| inference::model_metadata_response::TensorMetadata { | ||
| name: input.name.clone(), | ||
| datatype: match inference::DataType::try_from(input.data_type) { | ||
| Ok(dt) => dt.as_str_name().to_string(), | ||
| Err(_) => "TYPE_INVALID".to_string(), | ||
| }, | ||
| shape: input.dims.clone(), | ||
| }) | ||
| .collect(), | ||
| outputs: model_config | ||
| .output | ||
| .iter() | ||
| .map( | ||
| |output| inference::model_metadata_response::TensorMetadata { | ||
| name: output.name.clone(), | ||
| datatype: match inference::DataType::try_from( | ||
| output.data_type, | ||
| ) { | ||
| Ok(dt) => dt.as_str_name().to_string(), | ||
| Err(_) => "TYPE_INVALID".to_string(), | ||
| }, | ||
| shape: output.dims.clone(), | ||
| }, | ||
| ) | ||
| .collect(), | ||
| })); | ||
| } | ||
| return Ok(Response::new(ModelMetadataResponse { | ||
| name: tensor_model_config.name.clone(), | ||
| versions: vec!["1".to_string()], | ||
|
|
@@ -499,6 +545,20 @@ impl GrpcInferenceService for KserveService { | |
| if card.model_type.supports_tensor() { | ||
| if let Some(tensor_model_config) = card.runtime_config.tensor_model_config.as_ref() | ||
| { | ||
| if let Some(triton_model_config) = | ||
| tensor_model_config.triton_model_config.as_ref() | ||
| { | ||
| let model_config = ModelConfig::decode(triton_model_config.as_slice()) | ||
| .map_err(|e| { | ||
| Status::invalid_argument(format!( | ||
| "Failed to deserialize model config: {}", | ||
| e | ||
| )) | ||
| })?; | ||
|
Comment on lines
+551
to
+557
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Could extract Additionally, within |
||
| return Ok(Response::new(ModelConfigResponse { | ||
| config: Some(model_config), | ||
| })); | ||
| } | ||
| let model_config = ModelConfig { | ||
| name: tensor_model_config.name.clone(), | ||
| platform: "dynamo".to_string(), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.