PacktPublishing / Getting-Started-with-Amazon-SageMaker-Studio

Getting Started with Amazon SageMaker Studio, published by Packt
MIT License
20 stars 26 forks source link

Inference batch transform job failed in chapter07/chapter07/01-tensorflow_sentiment_analysis_batch_transform.ipynb #2

Open tkbky opened 1 year ago

tkbky commented 1 year ago

JSON Parse error: Invalid escape character ... occurs when running the codes in chapter07/chapter07/01-tensorflow_sentiment_analysis_batch_transform.ipynb up until transformer.transform(...) causing the inference batch transform job to fail.

Here is the relevant logs ``` 169.254.255.130 - - [09/Oct/2022:00:53:07 +0000] "POST /invocations HTTP/1.1" 200 23971 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:07 +0000] "POST /invocations HTTP/1.1" 200 23971 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:12 +0000] "POST /invocations HTTP/1.1" 200 23873 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:12 +0000] "POST /invocations HTTP/1.1" 200 23873 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:14 +0000] "POST /invocations HTTP/1.1" 200 24124 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:14 +0000] "POST /invocations HTTP/1.1" 200 24124 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:16 +0000] "POST /invocations HTTP/1.1" 200 23918 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:16 +0000] "POST /invocations HTTP/1.1" 200 23918 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:18 +0000] "POST /invocations HTTP/1.1" 200 24212 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:18 +0000] "POST /invocations HTTP/1.1" 200 24212 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:23 +0000] "POST /invocations HTTP/1.1" 200 24156 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:23 +0000] "POST /invocations HTTP/1.1" 200 4524 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:24 +0000] "POST /invocations HTTP/1.1" 400 82 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:23 +0000] "POST /invocations HTTP/1.1" 200 24156 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:23 +0000] "POST /invocations HTTP/1.1" 200 4524 "-" "Go-http-client/1.1" 169.254.255.130 - - [09/Oct/2022:00:53:24 +0000] "POST /invocations HTTP/1.1" 400 82 "-" "Go-http-client/1.1" 2022-10-09T00:53:24.083:[sagemaker logs]: sagemaker-cn-north-1-323750898175/sagemaker-studio-book/chapter07/data/csv_test/x_test.npy: ClientError: 400 2022-10-09T00:53:24.083:[sagemaker logs]: sagemaker-cn-north-1-323750898175/sagemaker-studio-book/chapter07/data/csv_test/x_test.npy: 2022-10-09T00:53:24.083:[sagemaker logs]: sagemaker-cn-north-1-323750898175/sagemaker-studio-book/chapter07/data/csv_test/x_test.npy: Message: 2022-10-09T00:53:24.083:[sagemaker logs]: sagemaker-cn-north-1-323750898175/sagemaker-studio-book/chapter07/data/csv_test/x_test.npy: { "error": "JSON Parse error: Invalid escape character in string. at offset: 24" } ```
michaelhsieh42 commented 1 year ago

Hi, did you change the training job name to your own in this cell? I accidentally committed one that from my account. You should replace it with yours. I was able to get it running correctly without error. Let me know.

from sagemaker.tensorflow import TensorFlow

# insert the training job name from chapter05/02-tensorflow_sentiment_analysis.ipynb
training_job_name='imdb-tf-2022-02-18-05-31-26'

estimator = TensorFlow.attach(training_job_name)