Downloads · 30 days
8
3% of all-time downloads
metrosir/sd
sd is a machine learning model from metrosir. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
consider deploy on: - huggingface inference point - replicate api - lightning.ai
Downloads · 30 days
8
3% of all-time downloads
All-time downloads
285
Public
Repo size
5.1 GB
Likes
0
Public
Click a slice to open those files.
.safetensors4.7 GB · 93%
From the Hugging Face model README
consider deploy on:
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.txt, note that some requirements are different from those in huggingface, and you need to modify some lines in requirements.txt according to the comment in the 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 apiinstall docker:
install git-lfs:
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs