Views
No views yet
prompt = f"### Instruction:{input}### Response:"1from deepsparse import TextGeneration
2model = TextGeneration(model="hf:mgoin/deepseek-coder-1.3b-instruct-ds")
3print(model("#write a quick sort algorithm in python", max_new_tokens=200).generations[0].text)
4
5"""
6def quick_sort(arr):
7 if len(arr) <= 1:
8 return arr
9 else:
10 pivot = arr[len(arr) // 2]
11 left = [x for x in arr if x < pivot]
12 middle = [x for x in arr if x == pivot]
13 right = [x for x in arr if x > pivot]
14 return quick_sort(left) + middle + quick_sort(right)
15
16print(quick_sort([3,6,8,10,1,2,1]))
17#output: [1, 1, 2, 3, 6, 8, 10]
18
19#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
20"""