Skip to content
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

Sherif akoush/quickfix/get names from metadata endpoint #393

Conversation

sakoush
Copy link
Member

@sakoush sakoush commented Nov 24, 2021

Fetch metadata from v2 endpoint inference model and use the info to construct the internal inference request from alibi explain model.

Also in this pr:

  • upgrade to alibi 0.6.2
  • bump mlserver version to 0.6.0.dev4
  • add KernelShap explainer

@sakoush sakoush force-pushed the SherifAkoush/quickfix/get_names_from_metadata_endpoint branch from c0c57da to 540a11b Compare November 24, 2021 11:29
@@ -51,6 +57,19 @@ def remote_predict(
return InferenceResponse.parse_raw(response_raw.text)


def remote_metadata(url: str) -> MetadataModelResponse:
"""Get metadata from v2 endpoint"""
response_raw = requests.get(url)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that it matters much, but should we make this call asynchronous?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats a good point. having a look at the caller load, it has also load_explainer that we need to do async so that the entire function (i.e load) is truly async.

I am tempted however to leave it as a separate ticket?

if metadata is not None:
if metadata.inputs:
# we only support a big single input numpy
input_name = metadata.inputs[0].name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to pass on the datatype, shape and parameters from the metadata?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the type and shape is inferred from the payload. I think we can add a warning it they dont match? I didnt want to get into converting the payload according to the metadata as part of this ticket?

# For List[str] (e.g. AnchorText), we use StringCodec for input
input_payload_codec = StringCodec if type(input_data) == list else NumpyCodec
v2_request = InferenceRequest(
id=id_name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure, but I think the executor will set this to a unique value. Therefore, should we leave the id field empty?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about SC, maybe this is the case. However locally it will not work with a None id (for triron case).

)
],
# set outputs as empty list, this will return everything?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that the protocol itself defines what should happen, so I guess that the behaviour will depend on the model and model runtime.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually this comment is not valid anymore as we get that from the metadata.

@sakoush sakoush merged commit db9ddb0 into SeldonIO:master Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants