Update README.md
Browse files
README.md
CHANGED
@@ -11,3 +11,33 @@ tags:
|
|
11 |
base_model: unsloth/gemma-7b-bnb-4bit
|
12 |
---
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
base_model: unsloth/gemma-7b-bnb-4bit
|
12 |
---
|
13 |
|
14 |
+
|
15 |
+
```python
|
16 |
+
from unsloth import FastLanguageModel
|
17 |
+
import torch
|
18 |
+
|
19 |
+
|
20 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
21 |
+
model_name = "Ashishkr/Gemma-7B-COT-LoRA-1024R",
|
22 |
+
max_seq_length = max_seq_length,
|
23 |
+
dtype = dtype,
|
24 |
+
load_in_4bit = load_in_4bit,
|
25 |
+
)
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
FastLanguageModel.for_inference(model)
|
30 |
+
inputs = tokenizer(
|
31 |
+
[
|
32 |
+
alpaca_prompt.format(
|
33 |
+
"given a number identify if it is an even number, if its even, square it and add 5 to it. if its odd , get me the square root of the number", # instruction
|
34 |
+
"12", # input
|
35 |
+
"", # output - leave this blank for generation!
|
36 |
+
)
|
37 |
+
], return_tensors = "pt").to("cuda")
|
38 |
+
|
39 |
+
outputs = model.generate(**inputs, max_new_tokens = 2048, use_cache = True)
|
40 |
+
tokenizer.batch_decode(outputs)
|
41 |
+
|
42 |
+
|
43 |
+
```
|