Views
No views yet
all support autoscaling
| platform | prediction speed | charges | deploy handiness |
|---|---|---|---|
| huggingface | fast:20s | high:$0.6/hr (without autoscaling) | easy:git push |
| replicate | fast if used frequently: 30s, slow if needs initialization: 5min | low: $0.02 per generation | difficult: build image and upload |
| lightning.ai | fast with app running: 20s, slow if idle: XXs | low: free $30 per month, $0.18 per init, $0.02 per run | easy: one command |
requirements.txtinit() and predict() function: use handler.py, implement the EndpointHandler classhandler.py for requests and inference and explore more highly-customized featureshandler.pycog.yamlinit() and predict() function: use predict.py, implement the Predictor classpredict.pygit pull the current repository from huggingface, including large model filespredict.py and cog.yaml is correctly coded, run cog login, cog push, then cog will build a docker image locally and push the image to replicate. As the image could take 30GB or so disk space, it would cost a lot network bandwidth.requirements_lightning.txt, because some requirements are different from those in huggingface. Rename it to requirements.txtclass CustomBuildConfig(BuildConfig) in app.py. In a custom build config you can use many linux commands such as wget and sudo apt-get update. The custom build config will be executed on the __init__() of the PythonServer classinit() and predict() function: use app.py, implement the PythonServer class. Note:
__init__() is called), so some import code should be in the function, not at the top of the file, or you may get import errors.PythonServer.self unless it's predifined in the variables, so don't assign any self-defined variables to selfPythonServer's __init()__ yourself, so don't forget to use the correct function signaturepip install lightning.lightningignore file to avoid big file upload and save deploy time costlightning run app app.py --cloud in the local terminal, and it will upload the files in the directory to lightning cloud, and start deploying on the cloudall logssettings page of the web-ui. Open that url, and you can see the apicurl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs