TypeError: ESM3SageMakerClient._post() got an unexpected keyword argument 'return_bytes'
I am using Cloudformation to deploy ESMC-300M. Then, I am using the code snippet as shared in the Readme of this repo to invoke the model endpoint but I am getting the following error: TypeError: ESM3SageMakerClient._post() got an unexpected keyword argument 'return_bytes'
Here is the code snippet:
I am also explicitly setting the return_bytes as False but still it isn't working.
Here is the error trace:
TypeError Traceback (most recent call last) Cell In[62], line 13 11 protein = ESMProtein(sequence="AAAAA") 12 protein_tensor = sagemaker_client.encode(protein) ---> 13 logits_output = sagemaker_client.logits( 14 protein_tensor, LogitsConfig(sequence=True, return_embeddings=True), False, 15 ) 16 print(logits_output.logits, logits_output.embeddings)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/esm/sdk/forge.py:199, in ESM3ForgeInferenceClient.retry_decorator.
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/tenacity/init.py:336, in BaseRetrying.wraps.
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/tenacity/init.py:475, in Retrying.call(self, fn, *args, **kwargs) 473 retry_state = RetryCallState(retry_object=self, fn=fn, args=args, kwargs=kwargs) 474 while True: --> 475 do = self.iter(retry_state=retry_state) 476 if isinstance(do, DoAttempt): 477 try:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/tenacity/init.py:376, in BaseRetrying.iter(self, retry_state) 374 result = None 375 for action in self.iter_state.actions: --> 376 result = action(retry_state) 377 return result
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/tenacity/init.py:398, in BaseRetrying._post_retry_check_actions.
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/concurrent/futures/_base.py:451, in Future.result(self, timeout) 449 raise CancelledError() 450 elif self._state == FINISHED: --> 451 return self.__get_result() 453 self._condition.wait(timeout) 455 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/concurrent/futures/_base.py:403, in Future.__get_result(self) 401 if self._exception: 402 try: --> 403 raise self._exception 404 finally: 405 # Break a reference cycle with the exception in self._exception 406 self = None
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/tenacity/init.py:478, in Retrying.call(self, fn, *args, **kwargs) 476 if isinstance(do, DoAttempt): 477 try: --> 478 result = fn(*args, **kwargs) 479 except BaseException: # noqa: B902 480 retry_state.set_exception(sys.exc_info()) # type: ignore[arg-type]
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/esm/sdk/forge.py:537, in ESM3ForgeInferenceClient.logits(self, input, config, return_bytes) 535 request = {"model": self.model, "inputs": req, "logits_config": logits_config} 536 try: --> 537 data = self._post( 538 "logits", 539 request, 540 input.potential_sequence_of_concern, 541 return_bytes=return_bytes, 542 ) 543 except ESMProteinError as e: 544 return e
TypeError: ESM3SageMakerClient._post() got an unexpected keyword argument 'return_bytes'
Would be happy to share any more requirement needed to debug this issue.
Ah this is a known issue between 3.1.2 and our sagemaker packages. Mind downgrading to 3.1.1?
In the meantime, we're working on a fix.
Thanks @cmishra , it worked!!
Forgot to update this - but it was fixed in the January update to sagemaker. If folks see this issue they should create a new issue.