AWS LambdaΒΆ
The security policy of AWS Lambda restricts writing outside the /tmp directory.
To make docTR work on Lambda, you need to perform the following two steps:
Disable the usage of the
multiprocessingpackage by setting theDOCTR_MULTIPROCESSING_DISABLEenvironment variable toTRUE. This step is necessary because the package uses the/dev/shmdirectory for shared memory.Change the caching directory used by docTR for models. By default, it is set to
~/.cache/doctr, which is outside the/tmpdirectory on AWS Lambda. You can modify this by setting theDOCTR_CACHE_DIRenvironment variable.