-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Pass missing infer parameters during conversion #3368
Pass missing infer parameters during conversion #3368
Conversation
db56d96
to
4f9852c
Compare
I saw this PR linked to my issue and had a look out of interest as I wondered about the This is all new to me and I'm not very familiar with kserve so I might be talking nonsense but I couldn't see an elegant way to deal with that. I must admit I'm using them to place extra information into the request to change some predictor behaviour and some custom component settings, so I could be abusing the functionality. |
4f9852c
to
e55e02c
Compare
e55e02c
to
9efd39b
Compare
Can you try with these changes and give some feedback ? |
The change looks good, discussed with @Siva to add a few tests |
cbba47d
to
3a773e7
Compare
Tests added. |
@@ -240,14 +243,14 @@ def test_list_models_v1(self, http_server_client): | |||
|
|||
def test_predict_v1(self, http_server_client): | |||
resp = http_server_client.post('/v1/models/TestModel:predict', | |||
data=b'{"instances":[[1,2]]}') | |||
content=b'{"instances":[[1,2]]}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To fix the warning
DeprecationWarning: Use 'content=<...>' to upload raw bytes/text content.
A gave your branch a go (3a773e7) but I'm hitting an assignment error pasted below. I think I remember hitting the same problem in my workaround and I ended not trying to reassign on the current parameters but instead recreating them. Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 419, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 276, in __call__
await super().__call__(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.10/site-packages/timing_asgi/middleware.py", line 68, in __call__
await self.app(scope, receive, send_wrapper)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 237, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
return await dependant.call(**values)
File "/usr/local/lib/python3.10/site-packages/kserve/protocol/rest/v2_endpoints.py", line 151, in infer
response, response_headers = self.dataplane.encode(model_name=model_name,
File "/usr/local/lib/python3.10/site-packages/kserve/protocol/dataplane.py", line 273, in encode
response = response.to_rest()
File "/usr/local/lib/python3.10/site-packages/kserve/protocol/infer_type.py", line 611, in to_rest
res['parameters'] = to_http_parameters(self.parameters)
File "/usr/local/lib/python3.10/site-packages/kserve/protocol/infer_type.py", line 688, in to_http_parameters
parameters[key] = val.string_param
ValueError: Direct assignment of submessage not allowed |
Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>
Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>
Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>
3a773e7
to
5eff780
Compare
I am not reassigning the parameters dict anymore. Can you retry with these changes ? |
Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>
5eff780
to
d9a955c
Compare
Yep these are being passed through now! The model I am testing is using grpc so once they get to the predictor I have to run the |
Thanks @sivanantha321 fixing this! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sivanantha321, yuzisun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
* Pass missing infer parameters Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com> * Add tests Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com> * Fix warnings Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com> * Add equal magic method for infer types Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com> * Avoid inplace modification of parameters in conversion Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com> --------- Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #3365
Type of changes
Please delete options that are not relevant.
Feature/Issue validation/testing:
Please describe the tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced.
Please also list any relevant details for your test configuration.
Test A
Test B
Logs
Special notes for your reviewer:
Checklist:
Release note: