Update README.md
Browse files
README.md
CHANGED
@@ -1,7 +1,30 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
4 |
|
5 |
-
LLama-2-7b model finetuned with miniguanaco datasets.
|
6 |
|
7 |
This is a simple finetune based off a Google Colab notebook. Finetune instructions were from Labonne's first tutorial.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
## llama-2-7b-miniguanaco
|
5 |
|
6 |
+
This is my first model, with LLama-2-7b model finetuned with miniguanaco datasets.
|
7 |
|
8 |
This is a simple finetune based off a Google Colab notebook. Finetune instructions were from Labonne's first tutorial.
|
9 |
+
|
10 |
+
To run it:
|
11 |
+
import torch
|
12 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
13 |
+
import math
|
14 |
+
|
15 |
+
model_path = "decruz07/llama-2-7b-miniguanaco"
|
16 |
+
|
17 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, use_default_system_prompt=False)
|
18 |
+
model = AutoModelForCausalLM.from_pretrained(
|
19 |
+
model_path, torch_dtype=torch.float32, device_map='auto',local_files_only=False, load_in_4bit=True
|
20 |
+
)
|
21 |
+
print(model)
|
22 |
+
prompt = input("please input prompt:")
|
23 |
+
while len(prompt) > 0:
|
24 |
+
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to("cuda")
|
25 |
+
|
26 |
+
generation_output = model.generate(
|
27 |
+
input_ids=input_ids, max_new_tokens=500,repetition_penalty=1.2
|
28 |
+
)
|
29 |
+
print(tokenizer.decode(generation_output[0]))
|
30 |
+
prompt = input("please input prompt:")
|