This message was deleted.
# ask-for-help
s
This message was deleted.
🍱 1
👀 1
a
Hi there, you are correct, the inputs arguments of your API function depends on the order of how you define multipart args Learn more https://docs.bentoml.org/en/latest/reference/api_io_descriptors.html#multipart-payloads
s
Hi! That shouldn't be the case. What's the error you're getting?
u
@sauyon I have following error message. bentoml/_internal/io_descriptors/image.py”, line 252, in from_http_request val_content_type = val.content_type # type: ignore (bad starlette types) AttributeError: ‘bytes’ object has no attribute ‘content_type’
@Aaron Pham Thank you for your answer. I have an additional question, do you know a solution to apply aws credentials when building a docker image? I tried two methods about this problem in BentoML, but there was an error.
a
The feature you need is mounting credentials to the docker image, which you can found here https://docs.bentoml.org/en/latest/guides/containerization.html#access-aws-credentials-during-image-build
u
@Aaron Pham Thank you for your quick reply. I tried both methods on the link you gave me and got an error. I tried using the “Mount credentials from host” method and got the following error. Can you tell me what I’m missing?
a
you have to update the s3 path you want to copy right?
u
I don’t understand what this command is doing.. Can you explain?🙏🏻
“RUN aws s3 cp s3://path/to/file /home/bentoml/bento”
a
What are you trying to do? That command tries to copy an artifact on a s3 bucket to the $BENTO_PATH on the docker images
to run the aws cli you need to have credentials setup at
~/.aws/credentials
, hence the
--mount
option
u
What I’m going to do is upload an object to s3 using the boto3 library inside the custom runner.
and I got error “”botocore.exceptions.ProfileNotFound: The config profile (default) could not be found”
a
Can you share your custom runner code here?
you can use triple backticks to format the code
u
My code is as follows. and I have already set up my credentials locally.
self.s3 is a client object of boto3 defined in the init function as follows.
@Aaron Pham Thank you for accepting the question at code level🥹
a
Thanks for the code segment. I believe that the solution here is to move the s3 client logic outside of the runner. You can put it after the runner inference call See this as we provide a quick overview of the workflow.
u
@Aaron Pham I applied it as I told you, and “bentoml service:svc” it works well. But when docker run, I got the same error “botocore.exceptions.NoCredentialsError: Unable to locate credentials”
Should I add the mounting credentials?
a
yes. You need to mount the credentials via a custom dockerfile.
Dm’ @이주연, so this is an issue at
docker run
instead of
bentoml containerize
. This means that one should mount the credential as volume for
docker run
Copy code
docker run -v ~/.aws/credentials:~/.aws/crendentials ...
See mounting volume here https://docs.docker.com/storage/volumes/
u
@sauyon Hi, Can you suggest a solution to the multi-part order dependency I mentioned above? This is because the order of image and user_id is not always guaranteed when sending API requests.
s
I think this is something we're probably going to fix soon. Unfortunately there's not really a workaround I can think of right now other than writing your own IO descriptor. If you're able to run off of main we might have that in soon.
u
@sauyon Thank you for your response. Then, is there a way to get the file name of the image in API request? (If I only get images, not multi-part)
s
The file name should be
file.name
, I believe.
u
I mean Image() class, is it possible here?