How to deploy large python packages with AWS Lambda?

前端 未结 3 1666
伪装坚强ぢ
伪装坚强ぢ 2021-01-07 05:39

I need some advice.

I trained an image classifier using Tensorflow and wanted to deploy it to AWS Lambda using serverless. The directory includes the model, some py

3条回答
  •  花落未央
    2021-01-07 06:24

    I know I am answering it very late .. just putting it here for reference for other people.. I did the following things -

    1. Delete /external/* /tensorflow/contrib/* /tensorflow/include/unsupported/* files as suggested here.
    2. Strip all .so files especially two files in site-packages/numpy/core - _multiarray_umath.cpython-36m-x86_64-linux-gnu.so and _multiarray_tests.cpython-36m-x86_64-linux-gnu.so. Strip considerably reduces their size.
    3. You can put your model in S3 bucket and download it at runtime. This will reduce the size of the zip. This is explained in detail here.

    If this does not work then there are some additional things that can be done like removing pyc files etc as mentioned here

提交回复
热议问题