Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
library_name: peft
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
---
|
8 |
+
|
9 |
+
|
10 |
+
# Load the Model
|
11 |
+
```
|
12 |
+
from peft import LoraConfig, PeftModel
|
13 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
14 |
+
import torch
|
15 |
+
|
16 |
+
|
17 |
+
base_model_path = "/storage/ukp/shared/shared_model_weights/models--llama-2-hf/7B"
|
18 |
+
model = AutoModelForCausalLM.from_pretrained(
|
19 |
+
base_model_path,
|
20 |
+
torch_dtype=torch.bfloat16,
|
21 |
+
device_map="auto",
|
22 |
+
)
|
23 |
+
peft_model_id = "haritzpuerto/LLaMA2-7B-dcot"
|
24 |
+
model.load_adapter(peft_model_id)
|
25 |
+
|
26 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_path)
|
27 |
+
```
|
28 |
+
|
29 |
+
# Run the model
|
30 |
+
```
|
31 |
+
prompt = "[Question] Juan and LaKeisha roll a few objects down a ramp. They want to see which object rolls the farthest. What should they do so they can repeat their investigation?\n[Options] A) Put the objects in groups. B) Change the height of the ramp. C) Choose different objects to roll. D) Record the details of the investigation.\n[Number of answers] 2\n[Answer 1] "
|
32 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
33 |
+
output = model.generate(**inputs.to("cuda"), max_length=1024)
|
34 |
+
print(tokenizer.decode(output[0]))
|
35 |
+
```
|
36 |
+
|
37 |
+
You should get an output similar to:
|
38 |
+
```
|
39 |
+
<s> [Question] Juan and LaKeisha roll a few objects down a ramp. They want to see which object rolls the farthest. What should they do so they can repeat their investigation?
|
40 |
+
[Options] A) Put the objects in groups. B) Change the height of the ramp. C) Choose different objects to roll. D) Record the details of the investigation.
|
41 |
+
[Number of answers] 2
|
42 |
+
[Answer 1] 1. Juan and LaKeisha want to see which object rolls the farthest.
|
43 |
+
2. They have already rolled a few objects down the ramp.
|
44 |
+
3. To repeat their investigation, they need to do something that will affect the outcome of the experiment.
|
45 |
+
4. Putting the objects in groups will not affect the outcome of the experiment.
|
46 |
+
5. Changing the height of the ramp may affect the outcome, but it is not the best option as it requires changing the setup of the experiment.
|
47 |
+
6. Choosing different objects to roll may also affect the outcome, but it is not the best option as it does not address the issue of repeating the experiment.
|
48 |
+
7. The best option is to record the details of the investigation. This includes the objects used, the height of the ramp, and any other relevant information. By recording the details, Juan and LaKeisha can repeat the experiment with the same conditions and compare the results.
|
49 |
+
[Answer 2] Step 1: Identify the problem and the question.
|
50 |
+
|
51 |
+
Problem: Juan and LaKeisha want to see which object rolls the farthest.
|
52 |
+
|
53 |
+
Question: What should they do to repeat their investigation?
|
54 |
+
|
55 |
+
Step 2: Evaluate the options.
|
56 |
+
|
57 |
+
A) Put the objects in groups. - This option does not directly relate to the question of which object rolls the farthest, so it can be eliminated.
|
58 |
+
|
59 |
+
B) Change the height of the ramp. - This option also does not directly relate to the question of which object rolls the farthest, so it can be eliminated.
|
60 |
+
|
61 |
+
C) Choose different objects to roll. - This option is a possible solution to the question, but it does not guarantee that the object will roll the farthest.
|
62 |
+
|
63 |
+
D) Record the details of the investigation. - This option is a necessary step to repeat the investigation.
|
64 |
+
|
65 |
+
Step 3: Choose the best option.
|
66 |
+
|
67 |
+
The best option to repeat the investigation is to record the details of the investigation. This will allow them to replicate the conditions of the original experiment and compare the results.
|
68 |
+
|
69 |
+
[Final answer] D) Record the details of the investigation.</s>
|
70 |
+
```
|