|
|
|
|
|
by tarruda
1188 days ago
|
|
Didn't explore much, but it seems alpaca-lora has better results for coding tasks. One example I've used was: "Implement quicksort in python.". This is the result with Code alpaca: def quicksort(arr):
if len(arr) < 2:
return arr
else:
pivot = arr[len(arr) / 2]
left_index = 0
right_index = len(arr) - 1
while left_index <= right_index:
while arr[left_index] < pivot:
left_index += 1
while arr[right_index] > pivot:
right_index -= 1
if left_index <= right_index:
temp = arr[left_index]
arr[left_index] = arr[right_index]
arr[right_index] = temp
left_index += 1
right_index -= 1
return quicksort(arr[:left_index]) + [arr[left_index]] + quicksort(arr[right_index + 1:])
Alpaca lora result: def quicksort(arr):
if len(arr) <= 1:
return arr
pivot = arr[0]
left = [arr[i] for i in range(1, len(arr)) if arr[i] < pivot]
right = [arr[i] for i in range(1, len(arr)) if arr[i] > pivot]
return quicksort(left) + [pivot] + quicksort(right)
Shorter and much cleaner, not to mention it works (code alpaca version is broken). Also it matches what ChatGPT generates for me. |
|