Update README.md
Browse files
README.md
CHANGED
|
@@ -18,6 +18,34 @@ finetuinng with
|
|
| 18 |
|
| 19 |
|
| 20 |
# code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
Formated text
|
| 22 |
''python
|
| 23 |
formatted_text = f"""Below is an instruction that describes a task. \
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
# code
|
| 21 |
+
|
| 22 |
+
''python
|
| 23 |
+
from unsloth import FastLanguageModel
|
| 24 |
+
|
| 25 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 26 |
+
model_name = "EpistemeAI/EpistemeAI-codegemma-2-9b", # YOUR MODEL YOU USED FOR TRAINING
|
| 27 |
+
max_seq_length = max_seq_length,
|
| 28 |
+
dtype = dtype,
|
| 29 |
+
load_in_4bit = load_in_4bit,
|
| 30 |
+
)
|
| 31 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
| 32 |
+
|
| 33 |
+
# alpaca_prompt = You MUST copy from above!
|
| 34 |
+
|
| 35 |
+
inputs = tokenizer(
|
| 36 |
+
[
|
| 37 |
+
alpaca_prompt.format(
|
| 38 |
+
"Create a function to calculate the sum of a sequence of integers.", # instruction
|
| 39 |
+
"", # input
|
| 40 |
+
"", # output - leave this blank for generation!
|
| 41 |
+
)
|
| 42 |
+
], return_tensors = "pt").to("cuda")
|
| 43 |
+
|
| 44 |
+
outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
|
| 45 |
+
tokenizer.batch_decode(outputs)
|
| 46 |
+
|
| 47 |
+
''
|
| 48 |
+
|
| 49 |
Formated text
|
| 50 |
''python
|
| 51 |
formatted_text = f"""Below is an instruction that describes a task. \
|