macadeliccc
commited on
Commit
•
635af30
1
Parent(s):
f4bc673
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc
|
3 |
+
datasets:
|
4 |
+
- jondurbin/truthy-dpo-v0.1
|
5 |
+
---
|
6 |
+
# WestLake-7B-laser-truthy-dpo-GGUF
|
7 |
+
|
8 |
+
|
9 |
+
## Chat Template
|
10 |
+
|
11 |
+
*I am using ooba (text generation web ui) for inference
|
12 |
+
|
13 |
+
The GGUF version defaults to alpaca:
|
14 |
+
|
15 |
+
11:40:53-940260 INFO LOADER: llama.cpp
|
16 |
+
11:40:53-940970 INFO TRUNCATION LENGTH: 32768
|
17 |
+
11:40:53-941299 INFO INSTRUCTION TEMPLATE: Alpaca
|
18 |
+
11:40:53-941580 INFO Loaded the model in 4.55 seconds.
|
19 |
+
```
|
20 |
+
{%- set ns = namespace(found=false) -%}
|
21 |
+
{%- for message in messages -%}
|
22 |
+
{%- if message['role'] == 'system' -%}
|
23 |
+
{%- set ns.found = true -%}
|
24 |
+
{%- endif -%}
|
25 |
+
{%- endfor -%}
|
26 |
+
{%- if not ns.found -%}
|
27 |
+
{{- '' + 'Below is an instruction that describes a task. Write a response that appropriately completes the request.' + '\n\n' -}}
|
28 |
+
{%- endif %}
|
29 |
+
{%- for message in messages %}
|
30 |
+
{%- if message['role'] == 'system' -%}
|
31 |
+
{{- '' + message['content'] + '\n\n' -}}
|
32 |
+
{%- else -%}
|
33 |
+
{%- if message['role'] == 'user' -%}
|
34 |
+
{{-'### Instruction:\n' + message['content'] + '\n\n'-}}
|
35 |
+
{%- else -%}
|
36 |
+
{{-'### Response:\n' + message['content'] + '\n\n' -}}
|
37 |
+
{%- endif -%}
|
38 |
+
{%- endif -%}
|
39 |
+
{%- endfor -%}
|
40 |
+
{%- if add_generation_prompt -%}
|
41 |
+
{{-'### Response:\n'-}}
|
42 |
+
{%- endif -%}
|
43 |
+
```
|
44 |
+
And can be manually overridden to chatML successfully:
|
45 |
+
|
46 |
+
```
|
47 |
+
{%- set ns = namespace(found=false) -%}
|
48 |
+
{%- for message in messages -%}
|
49 |
+
{%- if message['role'] == 'system' -%}
|
50 |
+
{%- set ns.found = true -%}
|
51 |
+
{%- endif -%}
|
52 |
+
{%- endfor -%}
|
53 |
+
{%- if not ns.found -%}
|
54 |
+
{{- '<|im_start|>system\n' + '' + '<|im_end|>\n' -}}
|
55 |
+
{%- endif %}
|
56 |
+
{%- for message in messages %}
|
57 |
+
{%- if message['role'] == 'system' -%}
|
58 |
+
{{- '<|im_start|>system\n' + message['content'] + '<|im_end|>\n' -}}
|
59 |
+
{%- else -%}
|
60 |
+
{%- if message['role'] == 'user' -%}
|
61 |
+
{{-'<|im_start|>user\n' + message['content'] + '<|im_end|>\n'-}}
|
62 |
+
{%- else -%}
|
63 |
+
{{-'<|im_start|>assistant\n' + message['content'] + '<|im_end|>\n' -}}
|
64 |
+
{%- endif -%}
|
65 |
+
{%- endif -%}
|
66 |
+
{%- endfor -%}
|
67 |
+
{%- if add_generation_prompt -%}
|
68 |
+
{{-'<|im_start|>assistant\n'-}}
|
69 |
+
{%- endif -%}
|
70 |
+
```
|
71 |
+
|
72 |
+
Here is the output of the model when I override the chat template to chatML
|
73 |
+
|
74 |
+
<|im_start|>system
|
75 |
+
<|im_end|>
|
76 |
+
<|im_start|>user
|
77 |
+
write me a quicksort algorithm in python<|im_end|>
|
78 |
+
<|im_start|>assistant
|
79 |
+
Sure, here's a basic implementation of Quicksort algorithm in Python:
|
80 |
+
```python
|
81 |
+
def partition(array, low, high):
|
82 |
+
"""Sorts elements around pivot"""
|
83 |
+
i = (low - 1) # Index of smaller element
|
84 |
+
pivot = array[high] # Select rightmost element as pivot
|
85 |
+
|
86 |
+
for j in range(low, high):
|
87 |
+
if array[j] <= pivot:
|
88 |
+
i += 1
|
89 |
+
array[i], array[j] = array[j], array[i]
|
90 |
+
|
91 |
+
array[i + 1], array[high] = array[high], array[i + 1] # Put the pivot where it belongs
|
92 |
+
return (i + 1) # Return index after pivot point
|
93 |
+
|
94 |
+
def quicksort(array, low, high):
|
95 |
+
"""Implementing Quicksort"""
|
96 |
+
if len(array) == 1 or low >= high: # Base conditions
|
97 |
+
return array
|
98 |
+
elif low < high: # Recursive step
|
99 |
+
pi = partition(array, low, high) # Separate smaller and greater elements around pivot point
|
100 |
+
quicksort(array, low, pi - 1) # Sort first half
|
101 |
+
quicksort(array, pi + 1, high) # Sort second half
|
102 |
+
return array # After recursion ends we have a sorted list
|
103 |
+
```
|
104 |
+
To use it:
|
105 |
+
```python
|
106 |
+
arr = [45, 23, 76, 89, 32, 65] # Your unsorted array
|
107 |
+
print("Original Array:", arr) # Print original array
|
108 |
+
quicksort(arr, 0, len(arr)-1) # Call Quicksort function with given range for sorting the entire array.
|
109 |
+
print("Sorted Array:", arr) # Print sorted array
|
110 |
+
```
|
111 |
+
<|im_end|>
|
112 |
+
```
|