简体   繁体   中英

Python machine learning API - Microsoft Azure / AWS Lambda

I created a Machine Learning classifier with Python, using word2vec and I want to create an API to use it in production. What's the easiest way to do that please ?

I heard of AWS Lambda and Microsoft Azure Machine Learning Studio but I am not sure it would work with word2vec. For example with AWS Lambda, would I need to reload the libraries each time (it takes a while to do that). And can I install any Python package with Microsoft Azure Machine Learning Studio and choose any kind of machine (need a lot of RAM for word2vec) ?

Thanks

By now, according to the offical document Execute Python machine learning scripts in Azure Machine Learning Studio about limitations for customizing Python installation (No.4 item), as below.

Inability to customize Python installation . Currently, the only way to add custom Python modules is via the zip file mechanism described earlier. While this is feasible for small modules, it is cumbersome for large modules (especially those with native DLLs) or a large number of modules.

Unfortunately, the python package like word2vec which includes some C modules could not be installed customize on Azure ML studio.

The only workaround way is to create a VM to install word2vec for Python and create a webservice in Python for calling in the Execute Python Script module of Azure ML studio via network IO, that as the answer of Azure ML Execute Python Module: Network I/O Disabled? said Azure ML studio support Network IO for Execute Python Script module now.

BentoML is a framework designed to solve exactly this problem: Build Machine Learning APIs for your models: https://github.com/bentoml/BentoML

It supports deploying models trained with any ML framework to many different cloud platforms, including AWS Lambda and Azure ML.

For word2vec models, I'd recommend using BentoML to create an API model server docker image, and then deploy the docker container to services like AWS ECS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM