sagemaker-python-sdk icon indicating copy to clipboard operation
sagemaker-python-sdk copied to clipboard

Batch Transform with output_filter with ranges failed

Open tnaduc opened this issue 7 years ago • 2 comments

Please fill out the form below.

System Information

  • Framework (e.g. TensorFlow) / Algorithm (e.g. KMeans): Xgboost
  • Framework Version:0.90-1-cpu-py3
  • Python Version:3.6.5
  • CPU or GPU:CPU
  • Are you using a custom image:No (default latest xgboost image: 0.90-1-cpu-py3)

Describe the problem

Batch transform failed when output_filter is specified in ranges. In this transformed dataset, the first and second are IDs, and the last column (246) is supposed to be the scored result. I would like to have the output including 2 id columns and the result column only. Following examples here: https://aws.amazon.com/blogs/machine-learning/associating-prediction-results-with-input-data-using-amazon-sagemaker-batch-transform/

Minimal repro / logs

(...)transform/transform_ID.csv: Invalid JsonPath: $[0:2,246:]: only single range filters of format (eg: [1:5]) are supported. Format [0:2,246:] is not supported

  • Exact command to reproduce:

transformer =sagemaker.transformer.Transformer( base_transform_job_name='Batch-Transform', model_name=model_name, instance_count=1, instance_type='ml.m4.xlarge', accept= 'text/csv', assemble_with = 'Line', output_path=output_data_path_id )

transformer.transform(input_data_path_id, content_type='text/csv', split_type='Line', input_filter="$[2:]", join_source= "Input", output_filter="$[0:2,246:]")

tnaduc avatar Oct 30 '19 23:10 tnaduc

Hi tnaduc,

Thanks for bringing it to our attention. Unfortunately, we don't support multi-range JSON filter for now. We'll add this to our roadmap and let you know here when it's fixed.

Thanks for using SageMaker.

Aloha106 avatar Nov 04 '19 17:11 Aloha106

Hi @Aloha106 ,

Are there any further plans to add support for multi-range JSON filters? I am getting a similar exception to that of @tnaduc : "Invalid JsonPath: $[0,43:]: only single range filters of format (eg: [1:5]) are supported. Format [0,43:] is not supported".

This is despite the examples given on the web page (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DataProcessing.html#sagemaker-Type-DataProcessing-OutputFilter) indicating it is possible to use multi-ranges i.e. " Examples: "$", "$[0,5:]", "$['id','SageMakerOutput']" "

Thanks

lexxmachina avatar Jan 28 '22 09:01 lexxmachina