rembg
rembg copied to clipboard
[Question] How to host on AWS Lambda?
Currently trying to host this ono AWS Lambda.
Steps I've done:
- Clone image from dockerhub and push to private ECS repository
- Create Lambda from Docker container on architecture x86_64 and expose port 5000
- Added NUMBA_CACHE_DIR environment variable with value
/tmp
After doing this configuration and running the Lambda, I get the following error:
/usr/local/lib/python3.9/dist-packages/numba/np/ufunc/parallel.py:323: UserWarning: Could not obtain multiprocessing lock due to OS level error: [Errno 38] Function not implemented
According to my research, this is because Lambda's can not run on multiple cores in Python (even when raising Lambda RAM to > 1769MB). A fix could be to downgrade to Python 3.7, but that would mean getting an older version of this library.
I've tried to search the source code for usage of Multiprocessing.Pools
, which could be replaced by Multiprocessing.Queue
as a fix, but I think that's in a library that rembg makes use of.
Does anyone have an idea how to fix this?