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

Batch size bug with batch of one using aws_sagemaker.invoke_endpoint #145

Open
BrendonPierson opened this issue Oct 10, 2022 · 0 comments
Open

Comments

@BrendonPierson
Copy link

I have a trained sklearn model deployed as a sagemaker endpoint that I want to invoke from the aurora postgres extenstion using aws_sagemaker.invoke_endpoint. Invoking works correctly as long as each batch has more than one sample but if the batch has one sample it returns a 500 with the error ValueError: Expected 2D array, got 1D array instead.

For example if there are 100 samples and I call the postgres extention with a max_batch_size of 10 like below it will score 10 batches without issue. If there were 101 samples it would score 10 batches successfully and then blow up on the 11th.

SELECT
    s.id
  , aws_sagemaker.invoke_endpoint(
          'model-v3-2022-10-04-17-20-24'
        , 10
        , ARRAY [s.feat_1, s.feat_2, s.feat_3, s.feat_4])::DECIMAL(16, 2) predicted_output
FROM
    _samples s;

I saw issue #15 had a similar problem invoking from the api but I'm not sure how I can pass in an extra line when invoking the endpoint.

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

No branches or pull requests

1 participant