Your question: Write a function in python that splits a list into 3 equal parts and returns a list with a random element of each sublist. is actually flawed if you wanted 123 456 789 Write a function in python that splits a list into 3 contiguous equal parts and returns a list with a random element of each sublist. would be more likely to furnish that actual answer. The previous request "splits a list into 3 equal parts " can just split it into 3 random groups anyway, you only specify "equal parts" and do not quality the type of equality you expect.
@twobob
Жыл бұрын
Conclusion Ghat GPT4 still absolutely crushes every else for the typical end user. Maybe Palm 2 comes close? I tried a couple of these with bard Sure, here is the Python function to split a list into 3 equal parts and returns a list with a random element of each sublist: Python def split_list_and_get_random_elements(list1): """ Splits a list into 3 equal parts and returns a list with a random element of each sublist. Args: list1: The list to split. Returns: A list with a random element of each sublist. """ # Get the number of elements in the list. n = len(list1) # If the number of elements is not divisible by 3, pad the list with None values. if n % 3 != 0: list1.extend([None] * (3 - n % 3)) # Split the list into 3 equal parts. sublists = [list1[i:i + n // 3] for i in range(0, n, n // 3)] # Get a random element from each sublist. random_elements = [random.choice(sublist) for sublist in sublists] return random_elements Use code with caution. Learn more Here is an example of how to use the function: Python list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] random_elements = split_list_and_get_random_elements(list1) print(random_elements) Use code with caution. Learn more This will print the following output: [4, 6, 9] The output shows that the function has randomly chosen the elements 4, 6, and 9 from the list. it also gave a very wordy precis until corrected. so... yeah. GPT4 for just "Generally everything" and maybe specilist models for scalpel work
@KEKW-lc4xi
Жыл бұрын
why would you say the best open llm yet when you are looking at the leaderboard and it is all the way down there in the ranking?
@twobob
Жыл бұрын
GPT4: (Use the data from the markdown table:) # Given data for Llama 1 and Llama 2 with 7B size on Reading Comprehension llama1_7B_reading_comprehension = 58.5 llama2_7B_reading_comprehension = 61.3 # Calculate the percentage increase in Reading Comprehension from Llama 1 7B to Llama 2 7B percentage_increase = ((llama2_7B_reading_comprehension - llama1_7B_reading_comprehension) / llama1_7B_reading_comprehension) * 100 percentage_increase RESULT 4.786324786324782 The Reading Comprehension score for Llama 2 with 7B size is approximately 4.79% better than that for Llama 1 with 7B size.
@twobob
Жыл бұрын
GPT 4, with custom instructions fwiw that tell it to output code by default cos thats how I like it. import random def split_and_pick(lst): """ Splits a list into 3 equal parts and returns a list containing one random element from each part. """ n = len(lst) if n < 3: return "ERROR MADE: Input list too short, needs at least 3 elements." # Calculate the size of each split split_size = n // 3 # Split the list into 3 parts part1 = lst[:split_size] part2 = lst[split_size:2*split_size] part3 = lst[2*split_size:] # Pick a random element from each part element1 = random.choice(part1) element2 = random.choice(part2) element3 = random.choice(part3) return [element1, element2, element3] # Test the function lst = [1, 2, 3, 4, 5, 6, 7, 8, 9] result = split_and_pick(lst) print("Random elements from each part:", result) The function split_and_pick has been implemented. It takes a list, splits it into 3 equal parts, and returns a list with a random element from each part. The complete code has been saved to a file. You can download the code here. and that links to fileserviceuploadsperm blob core windows net slash files slash filename%3Dsplit_and_pick_function dot py and a bunch of auth noise
@twobob
Жыл бұрын
#adding the words "with mocks" class TestSplitAndPick(unittest.TestCase): @patch('random.choice') def test_split_and_pick(self, mock_choice): mock_choice.side_effect = [1, 4, 9] lst = [1, 2, 3, 4, 5, 6, 7, 8, 9] result = split_and_pick(lst) self.assertEqual(result, [1, 4, 9]) def test_short_list(self): lst = [1, 2] result = split_and_pick(lst) self.assertEqual(result, "ERROR MADE: Input list too short, needs at least 3 elements.") if __name__ == "__main__": unittest.main() #might as well include the test to test itself, after all.
@twobob
Жыл бұрын
I would have preferred @patch('random.choice') def test_split_and_pick_argument_check(self, mock_choice): lst = [1, 2, 3, 4, 5, 6, 7, 8, 9] _ = split_and_pick(lst) calls = [call([1, 2, 3]), call([4, 5, 6]), call([7, 8, 9])] mock_choice.assert_has_calls(calls) but eh.
@venelin_valkov
Жыл бұрын
Free text tutorial: www.mlexpert.io/prompt-engineering/falcon-180b Learn how to fine-tune Llama 2 on your own data: www.mlexpert.io/prompt-engineering/fine-tuning-llama-2-on-custom-dataset
@masoudmaani
Жыл бұрын
this is a pretrained model. you need to fine tune it on your own. it's a base model, which any corp can fine tune to their own data. you don't even know what you are looking at. who on the seven hells compares a pretrained model to a fully trained model that has undergone extensive RLHF for more than a year?! this is technically misleading and wrong.
@fiorellamachado5639
Жыл бұрын
Hi, is falcon 180b better than gpt 3.5 in your opinion? (im talking obviously of prettained models)
@masoudmaani
Жыл бұрын
@@fiorellamachado5639 GPT3.5 is not pretrained. it's trained and RLHFed. that's why it's not scientifical to compare GPT3.5 to pretrained Falcon. still, Falcon can do stuff that GPT4 can't do sometimes.
Пікірлер: 11