Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- mlabonne/guanaco-llama2-1k
|
5 |
+
pipeline_tag: text-generation
|
6 |
+
---
|
7 |
+
# 🦙🧠 emre/llama-2-13b-mini
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
This is a `Llama-2-13b-chat-hf` model fine-tuned using QLoRA (4-bit precision).
|
12 |
+
|
13 |
+
## 🔧 Training
|
14 |
+
|
15 |
+
It was trained Colab Pro+. It is mainly designed for educational purposes, not for inference but can be used exclusivly with BBVA Group, GarantiBBVA and its subsidiaries.
|
16 |
+
Parameters:
|
17 |
+
|
18 |
+
```
|
19 |
+
max_seq_length = 2048
|
20 |
+
use_nested_quant = True
|
21 |
+
bnb_4bit_compute_dtype=bfloat16
|
22 |
+
lora_r=8
|
23 |
+
lora_alpha=16
|
24 |
+
lora_dropout=0.05
|
25 |
+
per_device_train_batch_size=2
|
26 |
+
```
|
27 |
+
|
28 |
+
## 💻 Usage
|
29 |
+
|
30 |
+
``` python
|
31 |
+
# pip install transformers accelerate
|
32 |
+
|
33 |
+
from transformers import AutoTokenizer
|
34 |
+
import transformers
|
35 |
+
import torch
|
36 |
+
|
37 |
+
model = "emre/llama-2-13b-mini"
|
38 |
+
prompt = "What is a large language model?"
|
39 |
+
|
40 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
41 |
+
pipeline = transformers.pipeline(
|
42 |
+
"text-generation",
|
43 |
+
model=model,
|
44 |
+
torch_dtype=torch.float16,
|
45 |
+
device_map="auto",
|
46 |
+
)
|
47 |
+
|
48 |
+
sequences = pipeline(
|
49 |
+
f'<s>[INST] {prompt} [/INST]',
|
50 |
+
do_sample=True,
|
51 |
+
top_k=10,
|
52 |
+
num_return_sequences=1,
|
53 |
+
eos_token_id=tokenizer.eos_token_id,
|
54 |
+
max_length=200,
|
55 |
+
)
|
56 |
+
for seq in sequences:
|
57 |
+
print(f"Result: {seq['generated_text']}")
|
58 |
+
```
|