Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction: {instruction}
### Input: {input}
### Response: {response}
主要我們需要填入的地方是大括號的部分:
instruction: 我們要 LLM 為我們解決的問題
input: LLM 要解決這個問題需要知道的事情, 這個部分可以留白
response: 我們期望 LLM 給出的回答
這裡要注意的是資料的品質要求越高越好, 就像 QLoRA 的 paper 說的:
Data quality is far more important than dataset size, e.g., a 9k sample dataset (OASST1) outperformed a 450k sample dataset (FLAN v2, subsampled) on chatbot performance, even when both are meant to support instruction following generalization.
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction: How do I build a campfire?
### Response: Safety should always come first when starting a campfire. Ensure you have water or another way to extinguish your fire readily available. Use a campfire ring, pit, or clear a large area around your campfire location. Also, make sure campfires are permitted in your area.
With safety out of the way, all a fire needs are heat, fuel, and oxygen. Any combustible material will start a fire, but good campfire fuel sources include tinder, kindling, and dry logs.
Use stuff like dry pine needles, dry leaves, grasses, and wood shavings for tinder. You could also use newspaper (orany paper), dryer lint, or cardboard. For kindling, use smaller pieces of wood, such as twigs and sticks no thicker than 1 inch in diameter (about the thickness of your thumb).
Dry or well-seasoned logs will ensure a good burn. Stack the wood in a way that guarantees oxygen can easily reach your flame. Many prefer a teepee or log cabin stacking design. Now, use a heat source to create a flame or spark and apply this to your tinder. Once the tinder combusts, it should light the kindling, and the kindling should eventually ignite your logs. If all goes well, you should now be enjoying your campfire.
Brainstorming
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction: Instead of making a peanut butter and jelly sandwich, what else could I combine peanut butter within a sandwich? Give five ideas.
### Response: Instead of jelly, try one of the following with peanut butter in a sandwich:
1. Honey
2. Raisins
3. Fruit preserves
4. Bananas
5. Sliced apples
Closed QA
1 2 3 4 5 6 7 8 9 10
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction: According to this paragraph about bull sharks, how long are male adult sharks in meters?
### Input: Bull sharks are large and stout, with females being larger than males. The bull shark can be up to 81 cm (2 ft 8in) in length at birth. Adult female bull sharks average 2.4 m (8 ft) long and typically weigh 130 kg (290 lb), whereas the slightly smaller adult male averages 2.25 m (7 ft) and95 kg (209 lb). While a maximum size of 3.5 m (11 ft) is commonly reported, a single record exists of a female specimen of exactly 4.0 m (13 ft). A 3.25 m (10.7 ft) long pregnant individual reached 450 kg (990 lb). Bull sharks are wider and heavier than other requiem sharks of comparable length, and are grey on top and white below. The second dorsal fin is smaller than the first. The bull shark's caudal fin is longer and lower than that of the larger sharks, and it has a small snout, and lacks an interdorsal ridge. ### Response: Male adult bull sharks average 2.25 meters in length.
{ "instruction":"Why are most plants green?", "context":"", "response":"Plants and algae are green due to a vital energy producing pigment in their leaves called chlorophyll. Chlorophyll molecules absorb light energy across the electromagnetic spectrum of sunshine but reflect light in the green part of the spectrum. As a result, plants appear to be green to human eyes. As an interesting side note, many animals and insects can see beyond the visible light spectrum that human's can see so that they may not view plants as being what we call 'green'.", "category":"general_qa" }
# Stanford Alpaca 的形式 INTRO_BLURB = "Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request." INTRO_BLURB_WITHOUT_INPUT = "Below is an instruction that describes a task. Write a response that appropriately completes the request." INSTRUCTION_KEY = "### Instruction:" INPUT_KEY = "### Input:" RESPONSE_KEY = "### Response:" defformatting_prompts_func(example): output_texts = [] for i inrange(len(example['instruction'])): blurb = f"{INTRO_BLURB}"if example["input"][i] elsef"{INTRO_BLURB_WITHOUT_INPUT}" instruction = f"{INSTRUCTION_KEY}\n{example['instruction'][i]}" input_context = f"{INPUT_KEY}\n{example['input'][i]}"if example["input"][i] elseNone response = f"{RESPONSE_KEY}\n{example['output'][i]}"
parts = [part for part in [blurb, instruction, input_context, response] if part] formatted_prompt = "\n\n".join(parts) output_texts.append(formatted_prompt)