python -m venv .venv
source .venv/bin/activate
func init SentiTweetSentimentAPILocalProject --python
func new --name SentiTweetSentimentAPI --template "HTTP trigger" --authlevel "function"
It will automatically provide some useful bolierplate.
az login --use-device-code
If you don't have az installed run
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
Either with: Remote build:
func azure functionapp publish SentiTweetSentimentAPI --build remote
Local build:
pip install --target="./.python_packages/lib/site-packages" -r requirements.txt
func azure functionapp publish SentiTweetSentimentAPI --no-build
We recommend installing the Azure Extension (with Functions) for the VSC.
It is also recommended to use the onnx runtime instead of the standard huggingface pytorch version. Read the documentation first.
The useful commands are either:
Just hidden state as last layer
python -m transformers.onnx --model=cardiffnlp/twitter-roberta-base-sentiment-latest onnx/
Normal task-specific logits
python -m transformers.onnx --model=cardiffnlp/twitter-roberta-base-sentiment-latest --feature=sequence-classification onnx/
We used the following (cause we had already downloaded model):
python3 -m transformers.onnx --model=twitter-roberta-base-sentiment.bin onnx
Serverless deployment of PyTorch on Azure- medium.com
Credits to the model used.