{"id":19023677,"url":"https://github.com/neuralmagic/deepsparse-digitalocean-image","last_synced_at":"2026-06-07T16:31:20.260Z","repository":{"id":181047529,"uuid":"659732888","full_name":"neuralmagic/deepsparse-digitalocean-image","owner":"neuralmagic","description":"Repo for building and packaging a 1-click app for DigitalOcean","archived":false,"fork":false,"pushed_at":"2023-07-13T20:18:10.000Z","size":6767,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-01-02T01:24:28.232Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neuralmagic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-06-28T12:50:03.000Z","updated_at":"2023-07-13T19:45:00.000Z","dependencies_parsed_at":"2023-07-13T20:45:45.781Z","dependency_job_id":null,"html_url":"https://github.com/neuralmagic/deepsparse-digitalocean-image","commit_stats":null,"previous_names":["neuralmagic/deepsparse-22-10"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuralmagic%2Fdeepsparse-digitalocean-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuralmagic%2Fdeepsparse-digitalocean-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuralmagic%2Fdeepsparse-digitalocean-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuralmagic%2Fdeepsparse-digitalocean-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neuralmagic","download_url":"https://codeload.github.com/neuralmagic/deepsparse-digitalocean-image/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240072068,"owners_count":19743527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T20:31:53.912Z","updated_at":"2026-04-29T12:30:18.306Z","avatar_url":"https://github.com/neuralmagic.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DeepSparse Image Repository for DigitalOcean's 1-Click App\n\nThis README highlights the dependencies and flow for building an image on the DigitalOcean marketplace.\n\n[Intro.md](https://github.com/neuralmagic/deepsparse-digitalocean-image/blob/main/Intro.md): is the DigitalOcean README currently found on NM's marketplace profile.  \n[template.json](https://github.com/neuralmagic/deepsparse-digitalocean-image/blob/main/template.json): config file for configuring the droplet to build the image, Ubuntu installs/dependencies and which scripts are to be pushed into the image.  \n[deepsparse.sh](https://github.com/neuralmagic/deepsparse-digitalocean-image/blob/main/scripts/deepsparse.sh): is the script for installing deepsparse.  \n[99-one-click](https://github.com/neuralmagic/deepsparse-digitalocean-image/blob/main/files/etc/update-motd.d/99-one-click): is the script that for populating text when the Droplet boots up.  \n[90-cleanup.sh](https://github.com/neuralmagic/deepsparse-digitalocean-image/blob/main/scripts/90-cleanup.sh) | [99-img-check.sh](https://github.com/neuralmagic/deepsparse-digitalocean-image/blob/main/scripts/99-img-check.sh): DO scripts used for image check and compliance.\n\n## Installing Packages for App Creation\n\nTo install `make` and `Packer` on Ubuntu, you can follow the steps below:\n\n**Installing make:**\n\n1. Open a terminal on your Ubuntu system.\n\n2. Run the following command to install `make`:\n   ```bash\n   sudo apt update\n   sudo apt install make\n   ```\n\n**Installing Packer:**\n\n1. Open a terminal on your Ubuntu system.\n\n2. Download the latest version of Packer for Linux by executing the following command:\n   ```bash\n   wget https://releases.hashicorp.com/packer/\u003cVERSION\u003e/packer_\u003cVERSION\u003e_linux_amd64.zip\n   ```\n\n   Replace `\u003cVERSION\u003e` with the specific version number you want to install. You can check for the latest version by visiting the Packer releases page: https://releases.hashicorp.com/packer/\n\n3. Install the unzip utility if it's not already installed:\n   ```bash\n   sudo apt install unzip\n   ```\n\n4. Extract the Packer binary from the downloaded ZIP file:\n   ```bash\n   unzip packer_\u003cVERSION\u003e_linux_amd64.zip\n   ```\n\n5. Move the extracted binary to the `/usr/local/bin/` directory:\n   ```bash\n   sudo mv packer /usr/local/bin/\n   ```\n\n6. Verify that Packer is installed correctly by running the following command:\n   ```bash\n   packer version\n   ```\n\n## Creating a Personal Access Token\n\nTo create a DigitalOcean personal access token and set it to the `DIGITALOCEAN_API_TOKEN` environment variable, you can follow these steps:\n\n1. Log in to your DigitalOcean account at https://cloud.digitalocean.com/login.\n\n2. After logging in, click on your account avatar in the top right corner of the control panel and select \"API\" from the dropdown menu.\n\n3. In the API section, click on the \"Generate New Token\" button.\n\n4. Enter a name for your token in the \"Token Name\" field. You can choose any name that helps you identify the purpose of the token.\n\n5. Choose the appropriate permissions based on the tasks you plan to perform. For working with Packer, you will need the \"Write\" and \"Read\" permissions for Droplets, Images, and Snapshots.\n\n6. Once you have selected the desired permissions, click on the \"Generate Token\" button at the bottom of the page.\n\n7. DigitalOcean will generate a new personal access token for you. Make sure to copy the token as it will not be displayed again for security reasons.\n\n8. Open a terminal or command prompt on your local machine.\n\n9. Set the `DIGITALOCEAN_API_TOKEN` environment variable by running the following command:\n\n   ```bash\n   export DIGITALOCEAN_API_TOKEN=your-access-token\n   ```\n\n10. The `DIGITALOCEAN_API_TOKEN` environment variable is now set, and you can use it in your Packer configuration or any other scripts that interact with the DigitalOcean API.\n\n## Installing Doctl - CLI SDK\n\nThis [flow ](https://docs.digitalocean.com/reference/doctl/how-to/install/)installs Doctl for WSL Ubuntu. For Ubuntu not installed on WSL, use this [flow](https://docs.digitalocean.com/reference/doctl/how-to/install/).\n\nAfterwards, connect with DigitalOcean by passing in your Personal Access Token:\n\n```bash\ndoctl auth init --access-token YOUR_API_TOKEN\n```\n\n## Build Automation with Packer\n\n[Packer](https://www.packer.io/intro) is a tool for creating images from a single source configuration. Using this Packer template reduces the entire process of creating, configuring, validating, and snapshotting a build Droplet to a single command:\n\nInstall Repo\n\n```bash\ngit clone https://github.com/neuralmagic/deepsparse-digitalocean-image.git\ncd deepsparse-digitalocean-image\n```\nInitialize DigitalOcean as a builder:\n\n```bash\npacker init ./config.pkr.hcl\n```\nNow build image:\n\n```bash\npacker build template.json\n```\n\nThis command will build an image with DeepSparse, run a few health checks for marketplace integration which are found in the `scripts` directory and save the image as a snapshot onto your DO account.\n\n## Smoke Test\n\nBefore starting make sure you have an [SSH key](https://docs.digitalocean.com/products/droplets/how-to/add-ssh-keys/create-with-openssh/) with your DO account.\n\n**TIP**: to find a list of SSH fingerprints run:\n\n```bash\ndoctl compute ssh-key list\n```\n\nRun the following command to get a list of snapshots in order to obtain the ID of the newly built image:\n\n```bash\ndoctl compute snapshot list\n```\nFinally, pass the `Snapshot-ID` of the DeepSparse image and the SSH `fingerprint` into the following command to create a Droplet using a compute optimized instance:\n\n*(FYI the region where the snapshot is saved, needs to be the same as the region where the droplet is created, which in this example was `nyc3`)*\n\n```bash\ndoctl compute droplet create deepsparse-droplet --image \u003cSNAPSHOT-ID\u003e --region nyc3 --size c-4-intel --ssh-keys \u003cFINGERPRINT\u003e\n```\n\nAfter staging, SSH into Droplet.\n\n**TIP**: To find the IP address of the droplet, run the following commmand:\n\n```bash\ndoctl compute droplet list\n```\nNow, pass the IP address into the following command:\n```bash\nssh root@\u003cIP-ADDRESS\u003e\n```\n---\n\n**NLP Benchmark example**:\n\n```bash\ndeepsparse.benchmark zoo:nlp/question_answering/bert-base/pytorch/huggingface/squad/pruned95_obs_quant-none -i [64,128] -b 64 -nstreams 1 -s sync\n```\n---\n\n**CV Server example**:\n\n```bash\ndeepsparse.server \\\n    task image_classification \\\n    --model_path \"zoo:cv/classification/resnet_v1-50/pytorch/sparseml/imagenet/pruned95-none\"\n```\n\nAfter server is up and running pass in our droplet's IP address and default port number (5543) to the URL to check out swagger:\n\n```\nhttp://\u003cIP-ADDRESS@5543/docs\n```\n---\n\n**NLP Inline Python example**:\n\nopen Python in shell:\n\n```bash\npython3\n```\n\npaste the following code snippet:\n\n```python\nfrom deepsparse import Pipeline\n\nqa_pipeline = Pipeline.create(task=\"question-answering\")\ninference = qa_pipeline(question=\"What's my name?\", context=\"My name is Snorlax\")\nprint(inference)\n```\n---\n\n**CV Inline Python example**:\n\nGet an example image:\n\n```bash\nwget -O basilica.jpg https://raw.githubusercontent.com/neuralmagic/deepsparse/main/src/deepsparse/yolo/sample_images/basilica.jpg\n```\n\nRun inference:\n\n```python\nfrom deepsparse import Pipeline\n\nmodel_path = \"zoo:cv/detection/yolov8-s/pytorch/ultralytics/coco/pruned50_quant-none\" \nimages = [\"basilica.jpg\"]\nyolo_pipeline = Pipeline.create(\n    task=\"yolov8\",\n    model_path=model_path,\n)\npipeline_outputs = yolo_pipeline(images=images)\nprint(pipeline_outputs)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuralmagic%2Fdeepsparse-digitalocean-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneuralmagic%2Fdeepsparse-digitalocean-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuralmagic%2Fdeepsparse-digitalocean-image/lists"}