Commit
·
a6c9537
1
Parent(s):
3c336f3
Update README.md
Browse files
README.md
CHANGED
|
@@ -75,7 +75,20 @@ text_gen = pipeline(task="text-generation", model=model, tokenizer=tokenizer, ma
|
|
| 75 |
output = text_gen(f"<s>[INST]{query}[/INST]")
|
| 76 |
print(output[0]['generated_text'])
|
| 77 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
"""
|
| 80 |
```
|
| 81 |
## Metrics
|
|
|
|
| 75 |
output = text_gen(f"<s>[INST]{query}[/INST]")
|
| 76 |
print(output[0]['generated_text'])
|
| 77 |
"""
|
| 78 |
+
<s>[INST]Write a quick sort algorithm in Python[/INST]
|
| 79 |
+
Quick sort is a divide and conquer algorithm that sorts an array in-place.
|
| 80 |
+
It works by repeatedly dividing the array into two sub-arrays, sorting them, and then merging them back together.
|
| 81 |
+
Here's a Python implementation of the quick sort algorithm:
|
| 82 |
|
| 83 |
+
```python
|
| 84 |
+
def quick_sort(arr):
|
| 85 |
+
if len(arr) <= 1:
|
| 86 |
+
return arr
|
| 87 |
+
else:
|
| 88 |
+
pivot = arr[len(arr) // 2]
|
| 89 |
+
left = [x for x in arr if x < pivot]
|
| 90 |
+
right = [x for x in arr if x > pivot]
|
| 91 |
+
return quick_sort(left) + [pivot] + quick_sort
|
| 92 |
"""
|
| 93 |
```
|
| 94 |
## Metrics
|