Exception while calling predict method in linear learner. TypeError: can only join an iterable

0

(1) As a part of learning pagemaker. I tried to run a notebook copied from medium(https://towardsdatascience.com/using-aws-sagemakers-linear-learner-to-solve-regression-problems-36732d802ba6). (2) Based on the article, it ran successfully in Year 2020. Now I am getting the following error. I have made 2 changes for imports. They are -----------------------------Import change from sagemaker.serializers import CSVSerializer from sagemaker.deserializers import JSONDeserializer

#need to make sure data is in correct format for deployed model linear_regressor.serializer = CSVSerializer linear_regressor.deserializer = JSONDeserializer ----------------------------------------------Error-------- TypeError Traceback (most recent call last) Cell In[17], line 1 ----> 1 result = linear_regressor.predict(X_test) 2 result

File ~/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/base_predictor.py:164, in Predictor.predict(self, data, initial_args, target_model, target_variant, inference_id) 129 def predict( 130 self, 131 data, (...) 135 inference_id=None, 136 ): 137 """Return the inference from the specified endpoint. 138 139 Args: (...) 161 as is. 162 """ --> 164 request_args = self._create_request_args( 165 data, initial_args, target_model, target_variant, inference_id 166 ) 167 response = self.sagemaker_session.sagemaker_runtime_client.invoke_endpoint(**request_args) 168 return self._handle_response(response)

File ~/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/base_predictor.py:194, in Predictor._create_request_args(self, data, initial_args, target_model, target_variant, inference_id) 188 args["EndpointName"] = self.endpoint_name 190 if "ContentType" not in args: 191 args["ContentType"] = ( 192 self.content_type 193 if isinstance(self.content_type, str) --> 194 else ", ".join(self.content_type) 195 ) 197 if "Accept" not in args: 198 args["Accept"] = self.accept if isinstance(self.accept, str) else ", ".join(self.accept)

TypeError: can only join an iterable

Thank you.

asked 8 months ago42 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions