Views
No views yet
Now able to generate more complex instructions thanks to cognitivecomputations/WizardLM_evol_instruct_V2_196k_unfiltered_merged_split and mlabonne/FineTome-100k. It even does coding prompts now with help from Vezora/Open-Critic-GPT and m-a-p/Code-Feedback.
| Tasks | Version | Filter | n-shot | Metric | Value | Stderr | |
|---|---|---|---|---|---|---|---|
| eq_bench | 2.1 | none | None | eqbench | 32.7345 | ± | 3.4507 |
| none | None | percent_parseable | 100.0000 | ± | 0.0000 | ||
| winogrande | 1 | none | 5 | acc | 0.7703 | ± | 0.0118 |
1import torch
2from unsloth import FastLanguageModel
3
4model, tokenizer = FastLanguageModel.from_pretrained(
5 "trollek/LittleInstructionMaker-4B-v0.2",
6 dtype=torch.bfloat16,
7 load_in_4bit=True,
8 max_seq_length=8192
9)
10FastLanguageModel.for_inference(model)
11
12def instruction_generator(system_message: str, num_instructions: int):
13 if system_message is "":
14 raise ValueError
15 if num_instructions < 1:
16 raise ValueError
17 magpie_template = f"<|im_start|>system\n{system_message}<|im_end|>\n<|im_start|>user\n"
18 input_ids = tokenizer(magpie_template, return_tensors="pt").input_ids.to("cuda")
19 for idx in range(num_instructions):
20 generated_ids = model.generate(input_ids, max_new_tokens=512, temperature=0.65, repetition_penalty=1.1, do_sample=True, eos_token_id=tokenizer.eos_token_id)
21 response = tokenizer.decode(generated_ids[0][input_ids.shape[-1]:], skip_special_tokens=True, clean_up_tokenization_space=True)
22 yield response
23
24for instruct in instruction_generator("You are an AI coding assistant.", 2):
25 print(instruct) Write a Python function that generates a random password of length 10 consisting of lowercase letters, uppercase letters, and special characters. The function should also check if the generated password meets the following criteria:
- At least one letter must be in uppercase.
- At least two numbers must be included.
- At least one special character should be present (a symbol such as !@#$%^&*).
The function should return the generated password along with its length, whether it satisfies all the criteria or not.You are given a list of integers, `nums`, that contains both positive and negative numbers. You need to write a function `median` to find the median of the numbers in the list. The median is defined as the middle number when the numbers are arranged in ascending order. If there is an even number of elements in the list, the median will be the average of the two middle numbers.
Write a function `median(nums: List[int]) -> int` to find the median of the given list.
Example 1:
Input: nums = [5, -10, 4, 0, 7]
Output: 4
Explanation: After sorting the list, we have [-10, 0, 4, 5, 7]. The middle element is 4, so the median is 4.
Example 2:
Input: nums = [1, 2, 3, 4, 5]
Output: 3
Explanation: After sorting the list, we have [1, 2, 3, 4, 5]. There are five elements, so the median is 3.