towhee-io / towhee

Towhee is a framework that is dedicated to making neural data processing pipelines simple and fast.
https://towhee.io
Apache License 2.0
3.16k stars 246 forks source link

[Feature]: AWS Lambda support | pre download model or specify the path where the models will be downloaded #2657

Closed BenSpex closed 11 months ago

BenSpex commented 1 year ago

Is there an existing issue for this?

Is your feature request related to a problem? Please describe.

I want to integrate a Towhee Pipeline into a lambda function.

However towhee is downloading the ops and models required on the first run to ~/.towhee a folder that can not be created during a lambda call.

Describe the solution you'd like.

Pre download the ops needed and store them with the python package.

Describe an alternate solution.

Specify the download folder eg. /tmp/.towhee

Anything else? (Additional Context)

No response

junjiejiangjjj commented 1 year ago

You can adjust the cache directory of towhee by setting the TOWHEE_HOME environment variable.

BenSpex commented 1 year ago

@junjiejiangjjj This is not really a great solution for this problem. It works kind of, but it actually then also installs additional dependencies via pip on the fly, which then fails, as again pip is not allowed to write.

And it then fails with module OpenAI not found.

image

It would be great to change the logic of the additional ops and modules, and have the option to do something like pip install towhee[openai, milvus] etc.

BenSpex commented 1 year ago

@junjiejiangjjj Quick Update Even with OpenAI installed before the call of the code, the ops still goes ahead and tries to install it again:

image

Which to no surprise fails. I really hope that there is a different path forward to be able to use towhee within Lambda calls

junjiejiangjjj commented 1 year ago

One way is to change pip's installation path through the PIP_TARGET environment variable and set PYTHONPATH when starting python.

junjiejiangjjj commented 1 year ago

Or run towhee locally first, then copy the files under ~/.towhee to the actual running environment, and make sure the relevant dependencies are installed properly.

stale[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Close the stale issues and pull requests after 7 days of inactivity. Reopen the issue with /reopen.