AaronWard / mlops-practice

Practice repo for MLOps on Azure using terraform.
1 stars 0 forks source link

Azure Function not working with ChromaDB #6

Open AaronWard opened 7 months ago

AaronWard commented 7 months ago

Was unable to deploy the FastAPI to the function when installing Chromadb - two initial problems:


Dumping all the links i focused on to troubleshoot:

Useful commands:

AaronWard commented 7 months ago

az functionapp config appsettings set --name awazfunctionapp --resource-group awazfunctionapp --settings SCM_DO_BUILD_DURING_DEPLOYMENT=false ENABLE_ORYX_BUILD=true

AaronWard commented 7 months ago

export PATH=/Applications/Docker.app/Contents/Resources/bin:$PATH

AaronWard commented 7 months ago

The "AlwaysOn" setting is not supported in Consumption Plan. i want this to be basically free to implement so i can't go with the docker option it seems. I will need to find an alternative to querying chroma db that doesn't use sqlite3. User a docker container would get around the dependency issues, but would require a premium plan because the the container can't be "cold started" like a regular function can.

AaronWard commented 7 months ago

https://gist.github.com/defulmere/8b9695e415a44271061cc8e272f3c300 https://docs.trychroma.com/troubleshooting

AaronWard commented 7 months ago

FUNCTIONS_WORKER_RUNTIME to from ~3.10 to python.

AaronWard commented 7 months ago

The dependencies require torch to run, which is pretty big - causing a OOM issue on the free-to-use runner. IE: Need to pay for basic plan šŸ¤¬

But the API works now at least

AaronWard commented 7 months ago
20:04:57 ****: cp: failed to close '/home/data/SitePackages/20231222200237.zip': No space left on device
20:04:57 ****: cp: failed to close '/home/data/SitePackages/20231222200237.zip': No space left on device\n/opt/Kudu/Scripts/starter.sh cp /tmp/build/expressbuild/20231222200237.zip /home/data/SitePackages/20231222200237.zip

went into the ssh tab and and rm -rf'd the site packages folder

AaronWard commented 7 months ago

note to self, the sentence-transformers/all-mpnet-base-v2 embeddings are too big to zip into a function app, therefore i went back to using sentence-transformers/all-MiniLM-L6-v2

AaronWard commented 7 months ago

Appears that sometimes the API is working and sometimes it fails to return a response. Testing with thunder client on vs code, i got a 504.0 GatewayTimeout when making this request: https://awazfunctionapp2.azurewebsites.net/query/What%20is%20autogen%?

Here are some relevant links:

Screenshot 2023-12-23 at 10 37 50 Screenshot 2023-12-23 at 10 34 03
AaronWard commented 7 months ago

To read: