Pierluigi Vinciguerra
Pierluigi Vinciguerra

Reputation: 104

Aws Sagemaker invoke-endpoint call and csv

i've created a clustering model on sagemaker and i'm invoking it via CLI with this command: aws sagemaker-runtime invoke-endpoint --endpoint-name myendpoint --body $mydata --content-type text/csv output.json --region eu-west-1

If my data starts with a negative number, i get an error "usage: aws [options] [ ...] [parameters] To see help text, you can run:

aws help aws help aws help aws: error: argument --body: expected one argument"

While if it's a positive number, everything works. How can i escape the first minus of the data to make it work? Thanks in advance

Upvotes: 0

Views: 2080

Answers (2)

Wenzhao Sun
Wenzhao Sun

Reputation: 71

It looks like that aws cli is treating your input data as another option because negative sign and hyphen are the same.

Have you tried to use quotes before and after $mydata?

For example, instead of:

sagemaker-runtime invoke-endpoint --endpoint-name myendpoint --body -2,1,2 --content-type text/csv output.json --region eu-west-1

use:

sagemaker-runtime invoke-endpoint --endpoint-name myendpoint --body "-2,1,2" --content-type text/csv output.json --region eu-west-1

Upvotes: 1

filup
filup

Reputation: 195

Did you use AWS Sagemaker's provided image for clustering? If you provided your own, you should be able to modify the inference code to expect the input data to have a header row. Then modify $mydata to include column headers which should avoid this issue you're seeing with negative numbers.

Upvotes: 0

Related Questions