|
--- |
|
tags: |
|
- deepsparse |
|
--- |
|
## DeepSparse Export of https://huggingface.co/deepseek-ai/deepseek-coder-1.3b-instruct |
|
|
|
Prompt Template: |
|
```python |
|
prompt = f"### Instruction:{input}### Response:" |
|
``` |
|
|
|
## Usage |
|
|
|
```python |
|
from deepsparse import TextGeneration |
|
model = TextGeneration(model="hf:mgoin/deepseek-coder-1.3b-instruct-ds") |
|
print(model("#write a quick sort algorithm in python", max_new_tokens=200).generations[0].text) |
|
|
|
""" |
|
def quick_sort(arr): |
|
if len(arr) <= 1: |
|
return arr |
|
else: |
|
pivot = arr[len(arr) // 2] |
|
left = [x for x in arr if x < pivot] |
|
middle = [x for x in arr if x == pivot] |
|
right = [x for x in arr if x > pivot] |
|
return quick_sort(left) + middle + quick_sort(right) |
|
|
|
print(quick_sort([3,6,8,10,1,2,1])) |
|
#output: [1, 1, 2, 3, 6, 8, 10] |
|
|
|
#This is a simple implementation of the Quick Sort algorithm in Python. It works by selecting a 'pivot' element from the array and partitioning the other elements into two sub-arrays |
|
""" |
|
``` |