deepsparse-nightly


Namedeepsparse-nightly JSON
Version 1.8.0.20240502 PyPI version JSON
download
home_pagehttps://github.com/neuralmagic/deepsparse
SummaryAn inference runtime offering GPU-class performance on CPUs and APIs to integrate ML into your application
upload_time2024-05-06 19:42:19
maintainerNone
docs_urlNone
authorNeuralmagic, Inc.
requires_python<3.12,>=3.8
licenseNeural Magic DeepSparse Community License
keywords inference machine learning x86 x86_64 avx2 avx512 neural network sparse inference engine cpu runtime deepsparse computer vision object detection sparsity
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!--
Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->


<div style="display: flex; flex-direction: column; align-items: center;">
  <h1 style="display: flex; align-items: center;" >
     <img width="60" height="60" alt="tool icon" src="https://neuralmagic.com/wp-content/uploads/2024/03/icon_DeepSparse-005.png" />
      <span>&nbsp;&nbsp;DeepSparse</span>
  </h1>
  <h4>Sparsity-aware deep learning inference runtime for CPUs</h4>
  <div align="center">
  <a href="https://docs.neuralmagic.com/deepsparse/">
    <img alt="Documentation" src="https://img.shields.io/badge/documentation-darkred?&style=for-the-badge&logo=read-the-docs" height="20" />
  </a>
  <a href="https://neuralmagic.com/community/">
    <img alt="Slack" src="https://img.shields.io/badge/slack-purple?style=for-the-badge&logo=slack" height="20" />
  </a>
  <a href="https://github.com/neuralmagic/deepsparse/issues/">
    <img alt="Support" src="https://img.shields.io/badge/support%20forums-navy?style=for-the-badge&logo=github" height="20" />
  </a>
  <a href="https://www.youtube.com/channel/UCo8dO_WMGYbWCRnj_Dxr4EA">
    <img alt="YouTube" src="https://img.shields.io/badge/-YouTube-red?&style=for-the-badge&logo=youtube&logoColor=white" height="20" />
  </a>
  <a href="https://twitter.com/neuralmagic">
    <img alt="Twitter" src="https://img.shields.io/twitter/follow/neuralmagic?color=darkgreen&label=Follow&style=social" height="20" />
  </a>
</div>

[DeepSparse](https://github.com/neuralmagic/deepsparse) is a CPU inference runtime that takes advantage of sparsity to accelerate neural network inference. Coupled with [SparseML](https://github.com/neuralmagic/sparseml), our optimization library for pruning and quantizing your models, DeepSparse delivers exceptional inference performance on CPU hardware.

<p align="center">
   <img alt="NM Flow" src="https://github.com/neuralmagic/deepsparse/assets/3195154/51e62fe7-9d9a-4fa5-a774-877158da1e29" width="60%" />
</p>

## ✨NEW✨ DeepSparse LLMs

Neural Magic is excited to announce initial support for performant LLM inference in DeepSparse with:
- sparse kernels for speedups and memory savings from unstructured sparse weights.
- 8-bit weight and activation quantization support.
- efficient usage of cached attention keys and values for minimal memory movement.

![mpt-chat-comparison](https://github.com/neuralmagic/deepsparse/assets/3195154/ccf39323-4603-4489-8462-7b103872aeb3)

### Try It Now

Install (requires Linux):
```bash
pip install -U deepsparse-nightly[llm]
```

Run inference:
```python
from deepsparse import TextGeneration
pipeline = TextGeneration(model="zoo:mpt-7b-dolly_mpt_pretrain-pruned50_quantized")

prompt="""
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: what is sparsity? ### Response:
"""
print(pipeline(prompt, max_new_tokens=75).generations[0].text)

# Sparsity is the property of a matrix or other data structure in which a large number of elements are zero and a smaller number of elements are non-zero. In the context of machine learning, sparsity can be used to improve the efficiency of training and prediction.
```

Check out the [`TextGeneration` documentation for usage details](https://github.com/neuralmagic/deepsparse/blob/main/docs/llms/text-generation-pipeline.md) and get the [latest sparsified LLMs on our HF Collection](https://huggingface.co/collections/neuralmagic/deepsparse-sparse-llms-659d61e81774dd48343642bf).

### Sparsity :handshake: Performance

Developed in collaboration with IST Austria, [our recent paper](https://arxiv.org/abs/2310.06927) details a new technique called **Sparse Fine-Tuning**, which allows us to prune MPT-7B to 60% sparsity during fine-tuning without drop in accuracy. With our new support for LLMs, DeepSparse accelerates the sparse-quantized model 7x over the dense baseline:

<div align="center">
    <img src="https://github.com/neuralmagic/deepsparse/assets/3195154/8687401c-f479-4999-ba6b-e01c747dace9" width="60%"/>
</div>

> [Learn more about our Sparse Fine-Tuning research.](https://github.com/neuralmagic/deepsparse/blob/main/research/mpt#sparse-finetuned-llms-with-deepsparse)

> [Check out the model running live on Hugging Face.](https://huggingface.co/spaces/neuralmagic/sparse-mpt-7b-gsm8k)

### LLM Roadmap

Following this initial launch, we are rapidly expanding our support for LLMs, including:

1. Productizing Sparse Fine-Tuning: Enable external users to apply sparse fine-tuning to their datasets via SparseML.
2. Expanding model support: Apply our sparse fine-tuning results to Llama 2 and Mistral models.
3. Pushing for higher sparsity: Improving our pruning algorithms to reach even higher sparsity.

## Computer Vision and NLP Models

In addition to LLMs, DeepSparse supports many variants of CNNs and Transformer models, such as BERT, ViT, ResNet, EfficientNet, YOLOv5/8, and many more! Take a look at the [Computer Vision](https://sparsezoo.neuralmagic.com/?modelSet=computer_vision) and [Natural Language Processing](https://sparsezoo.neuralmagic.com/?modelSet=natural_language_processing) domains of [SparseZoo](https://sparsezoo.neuralmagic.com/), our home for optimized models.

### Installation

Install via [PyPI](https://pypi.org/project/deepsparse/) ([optional dependencies detailed here](https://github.com/neuralmagic/deepsparse/tree/main/docs/user-guide/installation.md)):

```bash
pip install deepsparse 
```

To experiment with the latest features, there is a nightly build available using `pip install deepsparse-nightly` or you can clone and install from source using `pip install -e path/to/deepsparse`.

#### System Requirements
- Hardware: [x86 AVX2, AVX-512, AVX-512 VNNI and ARM v8.2+](https://github.com/neuralmagic/deepsparse/tree/main/docs/user-guide/hardware-support.md)
- Operating System: Linux
- Python: 3.8-3.11
- ONNX versions 1.5.0-1.15.0, ONNX opset version 11 or higher

For those using Mac or Windows, we recommend using Linux containers with Docker.

## Deployment APIs

DeepSparse includes three deployment APIs:

- **Engine** is the lowest-level API. With Engine, you compile an ONNX model, pass tensors as input, and receive the raw outputs.
- **Pipeline** wraps the Engine with pre- and post-processing. With Pipeline, you pass raw data and receive the prediction.
- **Server** wraps Pipelines with a REST API using FastAPI. With Server, you send raw data over HTTP and receive the prediction.

### Engine

The example below downloads a 90% pruned-quantized BERT model for sentiment analysis in ONNX format from SparseZoo, compiles the model, and runs inference on randomly generated input. Users can provide their own ONNX models, whether dense or sparse.

```python
from deepsparse import Engine

# download onnx, compile
zoo_stub = "zoo:nlp/sentiment_analysis/obert-base/pytorch/huggingface/sst2/pruned90_quant-none"
compiled_model = Engine(model=zoo_stub, batch_size=1)

# run inference (input is raw numpy tensors, output is raw scores)
inputs = compiled_model.generate_random_inputs()
output = compiled_model(inputs)
print(output)

# > [array([[-0.3380675 ,  0.09602544]], dtype=float32)] << raw scores
```

### Pipeline

Pipelines wrap Engine with pre- and post-processing, enabling you to pass raw data and receive the post-processed prediction. The example below downloads a 90% pruned-quantized BERT model for sentiment analysis in ONNX format from SparseZoo, sets up a pipeline, and runs inference on sample data.

```python
from deepsparse import Pipeline

# download onnx, set up pipeline
zoo_stub = "zoo:nlp/sentiment_analysis/obert-base/pytorch/huggingface/sst2/pruned90_quant-none"  
sentiment_analysis_pipeline = Pipeline.create(
  task="sentiment-analysis",    # name of the task
  model_path=zoo_stub,          # zoo stub or path to local onnx file
)

# run inference (input is a sentence, output is the prediction)
prediction = sentiment_analysis_pipeline("I love using DeepSparse Pipelines")
print(prediction)
# > labels=['positive'] scores=[0.9954759478569031]
```

### Server

Server wraps Pipelines with REST APIs, enabling you to set up a model-serving endpoint running DeepSparse. This enables you to send raw data to DeepSparse over HTTP and receive the post-processed predictions. DeepSparse Server is launched from the command line and configured via arguments or a server configuration file. The following downloads a 90% pruned-quantized BERT model for sentiment analysis in ONNX format from SparseZoo and launches a sentiment analysis endpoint:

```bash
deepsparse.server \
  --task sentiment-analysis \
  --model_path zoo:nlp/sentiment_analysis/obert-base/pytorch/huggingface/sst2/pruned90_quant-none
```

Sending a request:

```python
import requests

url = "http://localhost:5543/v2/models/sentiment_analysis/infer" # Server's port default to 5543
obj = {"sequences": "Snorlax loves my Tesla!"}

response = requests.post(url, json=obj)
print(response.text)
# {"labels":["positive"],"scores":[0.9965094327926636]}
```

### Additional Resources
- [Use Cases Page](https://github.com/neuralmagic/deepsparse/tree/main/docs/use-cases) for more details on supported tasks
- [Pipelines User Guide](https://github.com/neuralmagic/deepsparse/tree/main/docs/user-guide/deepsparse-pipelines.md) for Pipeline documentation
- [Server User Guide](https://github.com/neuralmagic/deepsparse/tree/main/docs/user-guide/deepsparse-server.md) for Server documentation
- [Benchmarking User Guide](https://github.com/neuralmagic/deepsparse/tree/main/docs/user-guide/deepsparse-benchmarking.md) for benchmarking documentation
- [Cloud Deployments and Demos](https://github.com/neuralmagic/deepsparse/tree/main/examples/)
- [User Guide](https://github.com/neuralmagic/deepsparse/tree/main/docs/user-guide) for more detailed documentation


## Product Usage Analytics

DeepSparse gathers basic usage telemetry, including, but not limited to, Invocations, Package, Version, and IP Address, for Product Usage Analytics purposes. Review Neural Magic's [Products Privacy Policy](https://neuralmagic.com/legal/) for further details on how we process this data. 

To disable Product Usage Analytics, run:
```bash
export NM_DISABLE_ANALYTICS=True
```

Confirm that telemetry is shut off through info logs streamed with engine invocation by looking for the phrase "Skipping Neural Magic's latest package version check."

## Community

### Get In Touch

- [Contribution Guide](https://github.com/neuralmagic/deepsparse/blob/main/CONTRIBUTING.md)
- [Community Slack](https://neuralmagic.com/community/)
- [GitHub Issue Queue](https://github.com/neuralmagic/deepsparse/issues) 
- [Subscribe To Our Newsletter](https://neuralmagic.com/subscribe/)
- [Blog](https://www.neuralmagic.com/blog/) 

For more general questions about Neural Magic, [complete this form.](http://neuralmagic.com/contact/)

### License

- **DeepSparse Community** is free to use and is licensed under the [Neural Magic DeepSparse Community License.](https://github.com/neuralmagic/deepsparse/blob/main/LICENSE)
Some source code, example files, and scripts included in the DeepSparse GitHub repository or directory are licensed under the [Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0) as noted.

- **DeepSparse Enterprise** requires a Trial License or [can be fully licensed](https://neuralmagic.com/legal/master-software-license-and-service-agreement/) for production, commercial applications.

### Cite

Find this project useful in your research or other communications? Please consider citing:

```bibtex
@misc{kurtic2023sparse,
      title={Sparse Fine-Tuning for Inference Acceleration of Large Language Models}, 
      author={Eldar Kurtic and Denis Kuznedelev and Elias Frantar and Michael Goin and Dan Alistarh},
      year={2023},
      url={https://arxiv.org/abs/2310.06927},
      eprint={2310.06927},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

@misc{kurtic2022optimal,
      title={The Optimal BERT Surgeon: Scalable and Accurate Second-Order Pruning for Large Language Models}, 
      author={Eldar Kurtic and Daniel Campos and Tuan Nguyen and Elias Frantar and Mark Kurtz and Benjamin Fineran and Michael Goin and Dan Alistarh},
      year={2022},
      url={https://arxiv.org/abs/2203.07259},
      eprint={2203.07259},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

@InProceedings{
    pmlr-v119-kurtz20a, 
    title = {Inducing and Exploiting Activation Sparsity for Fast Inference on Deep Neural Networks}, 
    author = {Kurtz, Mark and Kopinsky, Justin and Gelashvili, Rati and Matveev, Alexander and Carr, John and Goin, Michael and Leiserson, William and Moore, Sage and Nell, Bill and Shavit, Nir and Alistarh, Dan}, 
    booktitle = {Proceedings of the 37th International Conference on Machine Learning}, 
    pages = {5533--5543}, 
    year = {2020}, 
    editor = {Hal Daumé III and Aarti Singh}, 
    volume = {119}, 
    series = {Proceedings of Machine Learning Research}, 
    address = {Virtual}, 
    month = {13--18 Jul}, 
    publisher = {PMLR}, 
    pdf = {http://proceedings.mlr.press/v119/kurtz20a/kurtz20a.pdf},
    url = {http://proceedings.mlr.press/v119/kurtz20a.html}
}

@article{DBLP:journals/corr/abs-2111-13445,
  author    = {Eugenia Iofinova and Alexandra Peste and Mark Kurtz and Dan Alistarh},
  title     = {How Well Do Sparse Imagenet Models Transfer?},
  journal   = {CoRR},
  volume    = {abs/2111.13445},
  year      = {2021},
  url       = {https://arxiv.org/abs/2111.13445},
  eprinttype = {arXiv},
  eprint    = {2111.13445},
  timestamp = {Wed, 01 Dec 2021 15:16:43 +0100},
  biburl    = {https://dblp.org/rec/journals/corr/abs-2111-13445.bib},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}
```
# All Thanks To Our Contributors

<a href="https://github.com/neuralmagic/deepsparse/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=neuralmagic/deepsparse" />
</a>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/neuralmagic/deepsparse",
    "name": "deepsparse-nightly",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.12,>=3.8",
    "maintainer_email": null,
    "keywords": "inference, machine learning, x86, x86_64, avx2, avx512, neural network, sparse, inference engine, cpu, runtime, deepsparse, computer vision, object detection, sparsity",
    "author": "Neuralmagic, Inc.",
    "author_email": "support@neuralmagic.com",
    "download_url": null,
    "platform": null,
    "description": "<!--\nCopyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing,\nsoftware distributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n\n\n<div style=\"display: flex; flex-direction: column; align-items: center;\">\n  <h1 style=\"display: flex; align-items: center;\" >\n     <img width=\"60\" height=\"60\" alt=\"tool icon\" src=\"https://neuralmagic.com/wp-content/uploads/2024/03/icon_DeepSparse-005.png\" />\n      <span>&nbsp;&nbsp;DeepSparse</span>\n  </h1>\n  <h4>Sparsity-aware deep learning inference runtime for CPUs</h4>\n  <div align=\"center\">\n  <a href=\"https://docs.neuralmagic.com/deepsparse/\">\n    <img alt=\"Documentation\" src=\"https://img.shields.io/badge/documentation-darkred?&style=for-the-badge&logo=read-the-docs\" height=\"20\" />\n  </a>\n  <a href=\"https://neuralmagic.com/community/\">\n    <img alt=\"Slack\" src=\"https://img.shields.io/badge/slack-purple?style=for-the-badge&logo=slack\" height=\"20\" />\n  </a>\n  <a href=\"https://github.com/neuralmagic/deepsparse/issues/\">\n    <img alt=\"Support\" src=\"https://img.shields.io/badge/support%20forums-navy?style=for-the-badge&logo=github\" height=\"20\" />\n  </a>\n  <a href=\"https://www.youtube.com/channel/UCo8dO_WMGYbWCRnj_Dxr4EA\">\n    <img alt=\"YouTube\" src=\"https://img.shields.io/badge/-YouTube-red?&style=for-the-badge&logo=youtube&logoColor=white\" height=\"20\" />\n  </a>\n  <a href=\"https://twitter.com/neuralmagic\">\n    <img alt=\"Twitter\" src=\"https://img.shields.io/twitter/follow/neuralmagic?color=darkgreen&label=Follow&style=social\" height=\"20\" />\n  </a>\n</div>\n\n[DeepSparse](https://github.com/neuralmagic/deepsparse) is a CPU inference runtime that takes advantage of sparsity to accelerate neural network inference. Coupled with [SparseML](https://github.com/neuralmagic/sparseml), our optimization library for pruning and quantizing your models, DeepSparse delivers exceptional inference performance on CPU hardware.\n\n<p align=\"center\">\n   <img alt=\"NM Flow\" src=\"https://github.com/neuralmagic/deepsparse/assets/3195154/51e62fe7-9d9a-4fa5-a774-877158da1e29\" width=\"60%\" />\n</p>\n\n## \u2728NEW\u2728 DeepSparse LLMs\n\nNeural Magic is excited to announce initial support for performant LLM inference in DeepSparse with:\n- sparse kernels for speedups and memory savings from unstructured sparse weights.\n- 8-bit weight and activation quantization support.\n- efficient usage of cached attention keys and values for minimal memory movement.\n\n![mpt-chat-comparison](https://github.com/neuralmagic/deepsparse/assets/3195154/ccf39323-4603-4489-8462-7b103872aeb3)\n\n### Try It Now\n\nInstall (requires Linux):\n```bash\npip install -U deepsparse-nightly[llm]\n```\n\nRun inference:\n```python\nfrom deepsparse import TextGeneration\npipeline = TextGeneration(model=\"zoo:mpt-7b-dolly_mpt_pretrain-pruned50_quantized\")\n\nprompt=\"\"\"\nBelow is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: what is sparsity? ### Response:\n\"\"\"\nprint(pipeline(prompt, max_new_tokens=75).generations[0].text)\n\n# Sparsity is the property of a matrix or other data structure in which a large number of elements are zero and a smaller number of elements are non-zero. In the context of machine learning, sparsity can be used to improve the efficiency of training and prediction.\n```\n\nCheck out the [`TextGeneration` documentation for usage details](https://github.com/neuralmagic/deepsparse/blob/main/docs/llms/text-generation-pipeline.md) and get the [latest sparsified LLMs on our HF Collection](https://huggingface.co/collections/neuralmagic/deepsparse-sparse-llms-659d61e81774dd48343642bf).\n\n### Sparsity :handshake: Performance\n\nDeveloped in collaboration with IST Austria, [our recent paper](https://arxiv.org/abs/2310.06927) details a new technique called **Sparse Fine-Tuning**, which allows us to prune MPT-7B to 60% sparsity during fine-tuning without drop in accuracy. With our new support for LLMs, DeepSparse accelerates the sparse-quantized model 7x over the dense baseline:\n\n<div align=\"center\">\n    <img src=\"https://github.com/neuralmagic/deepsparse/assets/3195154/8687401c-f479-4999-ba6b-e01c747dace9\" width=\"60%\"/>\n</div>\n\n> [Learn more about our Sparse Fine-Tuning research.](https://github.com/neuralmagic/deepsparse/blob/main/research/mpt#sparse-finetuned-llms-with-deepsparse)\n\n> [Check out the model running live on Hugging Face.](https://huggingface.co/spaces/neuralmagic/sparse-mpt-7b-gsm8k)\n\n### LLM Roadmap\n\nFollowing this initial launch, we are rapidly expanding our support for LLMs, including:\n\n1. Productizing Sparse Fine-Tuning: Enable external users to apply sparse fine-tuning to their datasets via SparseML.\n2. Expanding model support: Apply our sparse fine-tuning results to Llama 2 and Mistral models.\n3. Pushing for higher sparsity: Improving our pruning algorithms to reach even higher sparsity.\n\n## Computer Vision and NLP Models\n\nIn addition to LLMs, DeepSparse supports many variants of CNNs and Transformer models, such as BERT, ViT, ResNet, EfficientNet, YOLOv5/8, and many more! Take a look at the [Computer Vision](https://sparsezoo.neuralmagic.com/?modelSet=computer_vision) and [Natural Language Processing](https://sparsezoo.neuralmagic.com/?modelSet=natural_language_processing) domains of [SparseZoo](https://sparsezoo.neuralmagic.com/), our home for optimized models.\n\n### Installation\n\nInstall via [PyPI](https://pypi.org/project/deepsparse/) ([optional dependencies detailed here](https://github.com/neuralmagic/deepsparse/tree/main/docs/user-guide/installation.md)):\n\n```bash\npip install deepsparse \n```\n\nTo experiment with the latest features, there is a nightly build available using `pip install deepsparse-nightly` or you can clone and install from source using `pip install -e path/to/deepsparse`.\n\n#### System Requirements\n- Hardware: [x86 AVX2, AVX-512, AVX-512 VNNI and ARM v8.2+](https://github.com/neuralmagic/deepsparse/tree/main/docs/user-guide/hardware-support.md)\n- Operating System: Linux\n- Python: 3.8-3.11\n- ONNX versions 1.5.0-1.15.0, ONNX opset version 11 or higher\n\nFor those using Mac or Windows, we recommend using Linux containers with Docker.\n\n## Deployment APIs\n\nDeepSparse includes three deployment APIs:\n\n- **Engine** is the lowest-level API. With Engine, you compile an ONNX model, pass tensors as input, and receive the raw outputs.\n- **Pipeline** wraps the Engine with pre- and post-processing. With Pipeline, you pass raw data and receive the prediction.\n- **Server** wraps Pipelines with a REST API using FastAPI. With Server, you send raw data over HTTP and receive the prediction.\n\n### Engine\n\nThe example below downloads a 90% pruned-quantized BERT model for sentiment analysis in ONNX format from SparseZoo, compiles the model, and runs inference on randomly generated input. Users can provide their own ONNX models, whether dense or sparse.\n\n```python\nfrom deepsparse import Engine\n\n# download onnx, compile\nzoo_stub = \"zoo:nlp/sentiment_analysis/obert-base/pytorch/huggingface/sst2/pruned90_quant-none\"\ncompiled_model = Engine(model=zoo_stub, batch_size=1)\n\n# run inference (input is raw numpy tensors, output is raw scores)\ninputs = compiled_model.generate_random_inputs()\noutput = compiled_model(inputs)\nprint(output)\n\n# > [array([[-0.3380675 ,  0.09602544]], dtype=float32)] << raw scores\n```\n\n### Pipeline\n\nPipelines wrap Engine with pre- and post-processing, enabling you to pass raw data and receive the post-processed prediction. The example below downloads a 90% pruned-quantized BERT model for sentiment analysis in ONNX format from SparseZoo, sets up a pipeline, and runs inference on sample data.\n\n```python\nfrom deepsparse import Pipeline\n\n# download onnx, set up pipeline\nzoo_stub = \"zoo:nlp/sentiment_analysis/obert-base/pytorch/huggingface/sst2/pruned90_quant-none\"  \nsentiment_analysis_pipeline = Pipeline.create(\n  task=\"sentiment-analysis\",    # name of the task\n  model_path=zoo_stub,          # zoo stub or path to local onnx file\n)\n\n# run inference (input is a sentence, output is the prediction)\nprediction = sentiment_analysis_pipeline(\"I love using DeepSparse Pipelines\")\nprint(prediction)\n# > labels=['positive'] scores=[0.9954759478569031]\n```\n\n### Server\n\nServer wraps Pipelines with REST APIs, enabling you to set up a model-serving endpoint running DeepSparse. This enables you to send raw data to DeepSparse over HTTP and receive the post-processed predictions. DeepSparse Server is launched from the command line and configured via arguments or a server configuration file. The following downloads a 90% pruned-quantized BERT model for sentiment analysis in ONNX format from SparseZoo and launches a sentiment analysis endpoint:\n\n```bash\ndeepsparse.server \\\n  --task sentiment-analysis \\\n  --model_path zoo:nlp/sentiment_analysis/obert-base/pytorch/huggingface/sst2/pruned90_quant-none\n```\n\nSending a request:\n\n```python\nimport requests\n\nurl = \"http://localhost:5543/v2/models/sentiment_analysis/infer\" # Server's port default to 5543\nobj = {\"sequences\": \"Snorlax loves my Tesla!\"}\n\nresponse = requests.post(url, json=obj)\nprint(response.text)\n# {\"labels\":[\"positive\"],\"scores\":[0.9965094327926636]}\n```\n\n### Additional Resources\n- [Use Cases Page](https://github.com/neuralmagic/deepsparse/tree/main/docs/use-cases) for more details on supported tasks\n- [Pipelines User Guide](https://github.com/neuralmagic/deepsparse/tree/main/docs/user-guide/deepsparse-pipelines.md) for Pipeline documentation\n- [Server User Guide](https://github.com/neuralmagic/deepsparse/tree/main/docs/user-guide/deepsparse-server.md) for Server documentation\n- [Benchmarking User Guide](https://github.com/neuralmagic/deepsparse/tree/main/docs/user-guide/deepsparse-benchmarking.md) for benchmarking documentation\n- [Cloud Deployments and Demos](https://github.com/neuralmagic/deepsparse/tree/main/examples/)\n- [User Guide](https://github.com/neuralmagic/deepsparse/tree/main/docs/user-guide) for more detailed documentation\n\n\n## Product Usage Analytics\n\nDeepSparse gathers basic usage telemetry, including, but not limited to, Invocations, Package, Version, and IP Address, for Product Usage Analytics purposes. Review Neural Magic's [Products Privacy Policy](https://neuralmagic.com/legal/) for further details on how we process this data. \n\nTo disable Product Usage Analytics, run:\n```bash\nexport NM_DISABLE_ANALYTICS=True\n```\n\nConfirm that telemetry is shut off through info logs streamed with engine invocation by looking for the phrase \"Skipping Neural Magic's latest package version check.\"\n\n## Community\n\n### Get In Touch\n\n- [Contribution Guide](https://github.com/neuralmagic/deepsparse/blob/main/CONTRIBUTING.md)\n- [Community Slack](https://neuralmagic.com/community/)\n- [GitHub Issue Queue](https://github.com/neuralmagic/deepsparse/issues) \n- [Subscribe To Our Newsletter](https://neuralmagic.com/subscribe/)\n- [Blog](https://www.neuralmagic.com/blog/) \n\nFor more general questions about Neural Magic, [complete this form.](http://neuralmagic.com/contact/)\n\n### License\n\n- **DeepSparse Community** is free to use and is licensed under the [Neural Magic DeepSparse Community License.](https://github.com/neuralmagic/deepsparse/blob/main/LICENSE)\nSome source code, example files, and scripts included in the DeepSparse GitHub repository or directory are licensed under the [Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0) as noted.\n\n- **DeepSparse Enterprise** requires a Trial License or [can be fully licensed](https://neuralmagic.com/legal/master-software-license-and-service-agreement/) for production, commercial applications.\n\n### Cite\n\nFind this project useful in your research or other communications? Please consider citing:\n\n```bibtex\n@misc{kurtic2023sparse,\n      title={Sparse Fine-Tuning for Inference Acceleration of Large Language Models}, \n      author={Eldar Kurtic and Denis Kuznedelev and Elias Frantar and Michael Goin and Dan Alistarh},\n      year={2023},\n      url={https://arxiv.org/abs/2310.06927},\n      eprint={2310.06927},\n      archivePrefix={arXiv},\n      primaryClass={cs.CL}\n}\n\n@misc{kurtic2022optimal,\n      title={The Optimal BERT Surgeon: Scalable and Accurate Second-Order Pruning for Large Language Models}, \n      author={Eldar Kurtic and Daniel Campos and Tuan Nguyen and Elias Frantar and Mark Kurtz and Benjamin Fineran and Michael Goin and Dan Alistarh},\n      year={2022},\n      url={https://arxiv.org/abs/2203.07259},\n      eprint={2203.07259},\n      archivePrefix={arXiv},\n      primaryClass={cs.CL}\n}\n\n@InProceedings{\n    pmlr-v119-kurtz20a, \n    title = {Inducing and Exploiting Activation Sparsity for Fast Inference on Deep Neural Networks}, \n    author = {Kurtz, Mark and Kopinsky, Justin and Gelashvili, Rati and Matveev, Alexander and Carr, John and Goin, Michael and Leiserson, William and Moore, Sage and Nell, Bill and Shavit, Nir and Alistarh, Dan}, \n    booktitle = {Proceedings of the 37th International Conference on Machine Learning}, \n    pages = {5533--5543}, \n    year = {2020}, \n    editor = {Hal Daum\u00e9 III and Aarti Singh}, \n    volume = {119}, \n    series = {Proceedings of Machine Learning Research}, \n    address = {Virtual}, \n    month = {13--18 Jul}, \n    publisher = {PMLR}, \n    pdf = {http://proceedings.mlr.press/v119/kurtz20a/kurtz20a.pdf},\n    url = {http://proceedings.mlr.press/v119/kurtz20a.html}\n}\n\n@article{DBLP:journals/corr/abs-2111-13445,\n  author    = {Eugenia Iofinova and Alexandra Peste and Mark Kurtz and Dan Alistarh},\n  title     = {How Well Do Sparse Imagenet Models Transfer?},\n  journal   = {CoRR},\n  volume    = {abs/2111.13445},\n  year      = {2021},\n  url       = {https://arxiv.org/abs/2111.13445},\n  eprinttype = {arXiv},\n  eprint    = {2111.13445},\n  timestamp = {Wed, 01 Dec 2021 15:16:43 +0100},\n  biburl    = {https://dblp.org/rec/journals/corr/abs-2111-13445.bib},\n  bibsource = {dblp computer science bibliography, https://dblp.org}\n}\n```\n# All Thanks To Our Contributors\n\n<a href=\"https://github.com/neuralmagic/deepsparse/graphs/contributors\">\n  <img src=\"https://contrib.rocks/image?repo=neuralmagic/deepsparse\" />\n</a>\n",
    "bugtrack_url": null,
    "license": "Neural Magic DeepSparse Community License",
    "summary": "An inference runtime offering GPU-class performance on CPUs and APIs to integrate ML into your application",
    "version": "1.8.0.20240502",
    "project_urls": {
        "Homepage": "https://github.com/neuralmagic/deepsparse"
    },
    "split_keywords": [
        "inference",
        " machine learning",
        " x86",
        " x86_64",
        " avx2",
        " avx512",
        " neural network",
        " sparse",
        " inference engine",
        " cpu",
        " runtime",
        " deepsparse",
        " computer vision",
        " object detection",
        " sparsity"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c15e882cb32e8033db909de1458b638c422385a877530867ce370927c40ba218",
                "md5": "5d4b25ab729c702dd53c8acfe73a114b",
                "sha256": "6425ae23eee217d27c1fc5efae869493aa17a72e7c2f613416df778e1e20bd37"
            },
            "downloads": -1,
            "filename": "deepsparse_nightly-1.8.0.20240502-cp310-cp310-macosx_13_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "5d4b25ab729c702dd53c8acfe73a114b",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": "<3.12,>=3.8",
            "size": 33515187,
            "upload_time": "2024-05-06T19:42:19",
            "upload_time_iso_8601": "2024-05-06T19:42:19.857938Z",
            "url": "https://files.pythonhosted.org/packages/c1/5e/882cb32e8033db909de1458b638c422385a877530867ce370927c40ba218/deepsparse_nightly-1.8.0.20240502-cp310-cp310-macosx_13_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6dcb22c1b1519ef3e0caf71f5d7dcac14bf0f6f5c9930a19f9603677175e67c5",
                "md5": "76154180d04c9565ba776e45a1aba2f7",
                "sha256": "259f2b0646c750c150b8ed636f4b9b53e8f6bd2098f2477c2c8160c3264663c3"
            },
            "downloads": -1,
            "filename": "deepsparse_nightly-1.8.0.20240502-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
            "has_sig": false,
            "md5_digest": "76154180d04c9565ba776e45a1aba2f7",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": "<3.12,>=3.8",
            "size": 40597363,
            "upload_time": "2024-05-06T19:42:05",
            "upload_time_iso_8601": "2024-05-06T19:42:05.562416Z",
            "url": "https://files.pythonhosted.org/packages/6d/cb/22c1b1519ef3e0caf71f5d7dcac14bf0f6f5c9930a19f9603677175e67c5/deepsparse_nightly-1.8.0.20240502-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8dfc69c888f1c0be1e6ed6d49aecdeca044ba67c0101cc8ba499fa139748a0dd",
                "md5": "0040c7e1a1457d481c2934e23e233050",
                "sha256": "53e752fda6fa949a4221009d2bd668a6f04a89288a1b1ea445659a1d1b5e6366"
            },
            "downloads": -1,
            "filename": "deepsparse_nightly-1.8.0.20240502-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "0040c7e1a1457d481c2934e23e233050",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": "<3.12,>=3.8",
            "size": 47374745,
            "upload_time": "2024-05-06T19:41:48",
            "upload_time_iso_8601": "2024-05-06T19:41:48.745752Z",
            "url": "https://files.pythonhosted.org/packages/8d/fc/69c888f1c0be1e6ed6d49aecdeca044ba67c0101cc8ba499fa139748a0dd/deepsparse_nightly-1.8.0.20240502-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bb9e1c0c6167387d9662df936074395044a753ee11acc5763c52839d218eec74",
                "md5": "eea0884d5c2dc594efde10260d6a5ae7",
                "sha256": "3cd678bfc534126de899a35cabcdade5f2d91dc5c64b9d29af8e4221478d89ff"
            },
            "downloads": -1,
            "filename": "deepsparse_nightly-1.8.0.20240502-cp311-cp311-macosx_13_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "eea0884d5c2dc594efde10260d6a5ae7",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": "<3.12,>=3.8",
            "size": 33515216,
            "upload_time": "2024-05-06T19:43:20",
            "upload_time_iso_8601": "2024-05-06T19:43:20.864980Z",
            "url": "https://files.pythonhosted.org/packages/bb/9e/1c0c6167387d9662df936074395044a753ee11acc5763c52839d218eec74/deepsparse_nightly-1.8.0.20240502-cp311-cp311-macosx_13_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6f085ecbdd9e1c129db7f872d3006cf9a39eb7b6e8a57b0028a2a9a99dc4d902",
                "md5": "4da8c9ce75587522bea4c98f5e1cb5d8",
                "sha256": "43af216b86be392521d19e6683b6f880970e826a016876acb27432ca2ec34d3f"
            },
            "downloads": -1,
            "filename": "deepsparse_nightly-1.8.0.20240502-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
            "has_sig": false,
            "md5_digest": "4da8c9ce75587522bea4c98f5e1cb5d8",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": "<3.12,>=3.8",
            "size": 40597415,
            "upload_time": "2024-05-06T19:43:06",
            "upload_time_iso_8601": "2024-05-06T19:43:06.458782Z",
            "url": "https://files.pythonhosted.org/packages/6f/08/5ecbdd9e1c129db7f872d3006cf9a39eb7b6e8a57b0028a2a9a99dc4d902/deepsparse_nightly-1.8.0.20240502-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7a962151f0e9a7f593d6456d1b7ecf125bd363fea4ebef99e0e56b99c49baebb",
                "md5": "5699af87bc291c205bc993529d895bf3",
                "sha256": "60fffbfc5259f01e19ebcef0cc07bc4ba4ea702364709c2e6bf83ced8e12224c"
            },
            "downloads": -1,
            "filename": "deepsparse_nightly-1.8.0.20240502-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "5699af87bc291c205bc993529d895bf3",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": "<3.12,>=3.8",
            "size": 47374564,
            "upload_time": "2024-05-06T19:42:51",
            "upload_time_iso_8601": "2024-05-06T19:42:51.117393Z",
            "url": "https://files.pythonhosted.org/packages/7a/96/2151f0e9a7f593d6456d1b7ecf125bd363fea4ebef99e0e56b99c49baebb/deepsparse_nightly-1.8.0.20240502-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e8e1992d108f22c223090a98a15216517ef78aaa4d222fdd69a69d4503971aa1",
                "md5": "1384b72d3e8c6ef042c362a96c6d56c3",
                "sha256": "f3d1f7d4247cca0538e8746bd27d5a4a8b50896acfb4827c5ed9bbf06b5f84ad"
            },
            "downloads": -1,
            "filename": "deepsparse_nightly-1.8.0.20240502-cp38-cp38-macosx_13_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "1384b72d3e8c6ef042c362a96c6d56c3",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": "<3.12,>=3.8",
            "size": 33514873,
            "upload_time": "2024-05-06T19:39:26",
            "upload_time_iso_8601": "2024-05-06T19:39:26.863712Z",
            "url": "https://files.pythonhosted.org/packages/e8/e1/992d108f22c223090a98a15216517ef78aaa4d222fdd69a69d4503971aa1/deepsparse_nightly-1.8.0.20240502-cp38-cp38-macosx_13_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "28368517721265e075b55162bf5e3b789f2e992df6bb991ac6ed3253c87d6d05",
                "md5": "78717220b454f86daa1d836800832dec",
                "sha256": "17ea2c5ee559afbbeabbbec575988e9a93a7363e8808b107514609bc3672c6af"
            },
            "downloads": -1,
            "filename": "deepsparse_nightly-1.8.0.20240502-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
            "has_sig": false,
            "md5_digest": "78717220b454f86daa1d836800832dec",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": "<3.12,>=3.8",
            "size": 40596846,
            "upload_time": "2024-05-06T19:39:08",
            "upload_time_iso_8601": "2024-05-06T19:39:08.627235Z",
            "url": "https://files.pythonhosted.org/packages/28/36/8517721265e075b55162bf5e3b789f2e992df6bb991ac6ed3253c87d6d05/deepsparse_nightly-1.8.0.20240502-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2df03872417dbec264a2d37ec6a29f0e8b84a3064730120d9dfd19108d5818db",
                "md5": "1bceb1259a963e2f08d571606e3ed16f",
                "sha256": "0c8399e229a8402f30bed50068b4fece65122379a31d8576fba2cb4cbedd8a75"
            },
            "downloads": -1,
            "filename": "deepsparse_nightly-1.8.0.20240502-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "1bceb1259a963e2f08d571606e3ed16f",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": "<3.12,>=3.8",
            "size": 47374732,
            "upload_time": "2024-05-06T19:38:43",
            "upload_time_iso_8601": "2024-05-06T19:38:43.324454Z",
            "url": "https://files.pythonhosted.org/packages/2d/f0/3872417dbec264a2d37ec6a29f0e8b84a3064730120d9dfd19108d5818db/deepsparse_nightly-1.8.0.20240502-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d0a3e56a0634606d5e7d402d097b52daea0fe3af685fc6f285b794e1f4d04841",
                "md5": "155d9ccab1dc50d61609fffc93592e15",
                "sha256": "1b6d9ce1566f6642864d03e8e5952b1df31d3f4233810dae7639830ea8446f20"
            },
            "downloads": -1,
            "filename": "deepsparse_nightly-1.8.0.20240502-cp39-cp39-macosx_13_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "155d9ccab1dc50d61609fffc93592e15",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": "<3.12,>=3.8",
            "size": 33515374,
            "upload_time": "2024-05-06T19:41:12",
            "upload_time_iso_8601": "2024-05-06T19:41:12.414882Z",
            "url": "https://files.pythonhosted.org/packages/d0/a3/e56a0634606d5e7d402d097b52daea0fe3af685fc6f285b794e1f4d04841/deepsparse_nightly-1.8.0.20240502-cp39-cp39-macosx_13_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9dfb5f2991731de3611fa5bbe640b298ffe680d4b3b99e6165c99a07a975ee81",
                "md5": "16086d38b80786ec77bafeb13e0f942e",
                "sha256": "dd3953b26f40883e8978204cf64a81a6b479375f56c738d1371c3632823460f7"
            },
            "downloads": -1,
            "filename": "deepsparse_nightly-1.8.0.20240502-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
            "has_sig": false,
            "md5_digest": "16086d38b80786ec77bafeb13e0f942e",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": "<3.12,>=3.8",
            "size": 40597393,
            "upload_time": "2024-05-06T19:40:55",
            "upload_time_iso_8601": "2024-05-06T19:40:55.721710Z",
            "url": "https://files.pythonhosted.org/packages/9d/fb/5f2991731de3611fa5bbe640b298ffe680d4b3b99e6165c99a07a975ee81/deepsparse_nightly-1.8.0.20240502-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "567589a573cf63eb62f7634e602661aa7248f5d33ea5a0b7e5b6074720fba147",
                "md5": "2dc712d5725767256a6fbb20c723cd57",
                "sha256": "ce92567c4054b3b1bb72526d4d2f52ac8fc280d34a8b7f9e9e61fc18c061278d"
            },
            "downloads": -1,
            "filename": "deepsparse_nightly-1.8.0.20240502-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "2dc712d5725767256a6fbb20c723cd57",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": "<3.12,>=3.8",
            "size": 47375790,
            "upload_time": "2024-05-06T19:39:43",
            "upload_time_iso_8601": "2024-05-06T19:39:43.125518Z",
            "url": "https://files.pythonhosted.org/packages/56/75/89a573cf63eb62f7634e602661aa7248f5d33ea5a0b7e5b6074720fba147/deepsparse_nightly-1.8.0.20240502-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-06 19:42:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "neuralmagic",
    "github_project": "deepsparse",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "deepsparse-nightly"
}
        
Elapsed time: 0.26727s