Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- deepsparse
|
| 4 |
+
---
|
| 5 |
+
## DeepSparse One-Shot and Export of https://huggingface.co/deepseek-ai/deepseek-coder-1.3b-instruct
|
| 6 |
+
|
| 7 |
+
Prompt Template:
|
| 8 |
+
```python
|
| 9 |
+
prompt = f"### Instruction:{input}### Response:"
|
| 10 |
+
```
|
| 11 |
+
|
| 12 |
+
## Usage
|
| 13 |
+
|
| 14 |
+
```python
|
| 15 |
+
from deepsparse import TextGeneration
|
| 16 |
+
model = TextGeneration(model="hf:mgoin/deepseek-coder-1.3b-instruct-pruned50-quant-ds")
|
| 17 |
+
print(model("#write a quick sort algorithm in python", max_new_tokens=200).generations[0].text)
|
| 18 |
+
|
| 19 |
+
"""
|
| 20 |
+
def quick_sort(arr):
|
| 21 |
+
if len(arr) == 0:
|
| 22 |
+
return arr
|
| 23 |
+
else:
|
| 24 |
+
pivot = arr[0]
|
| 25 |
+
left = []
|
| 26 |
+
right = []
|
| 27 |
+
for i in range(1, len(arr)):
|
| 28 |
+
if arr[i] < pivot:
|
| 29 |
+
left.append(arr[i])
|
| 30 |
+
else:
|
| 31 |
+
right.append(arr[i])
|
| 32 |
+
return quick_sort(left) + [pivot] + quick_sort(right)
|
| 33 |
+
|
| 34 |
+
print(quick_sort([3, 9, 2, 5, 4, 7, 1]))
|
| 35 |
+
print(quick_sort([1, 2, 3, 4, 5, 6]))
|
| 36 |
+
print(quick_sort([6, 5, 4, 3, 2, 1]))
|
| 37 |
+
"""
|
| 38 |
+
```
|