Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
datasets:
|
| 4 |
+
- emre/llama-2-13b-code-122k
|
| 5 |
+
tags:
|
| 6 |
+
- code
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# 🦙💻 CodeLlama
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
`llama-2-13b-code-122k` is a Llama 2 version
|
| 13 |
+
|
| 14 |
+
## 🔧 Training
|
| 15 |
+
|
| 16 |
+
This model is based on the `llama-2-13b-chat-hf` model, fine-tuned using QLoRA. It was trained on an Colab Pro+It was trained Colab Pro+. It is mainly designed for educational purposes, not for inference but can be used exclusively with BBVA Group, GarantiBBVA and its subsidiaries.
|
| 17 |
+
|
| 18 |
+
## 💻 Usage
|
| 19 |
+
|
| 20 |
+
``` python
|
| 21 |
+
# pip install transformers accelerate
|
| 22 |
+
|
| 23 |
+
from transformers import AutoTokenizer
|
| 24 |
+
import transformers
|
| 25 |
+
import torch
|
| 26 |
+
|
| 27 |
+
model = "emre/llama-2-13b-code-122k"
|
| 28 |
+
prompt = "Write Python code to generate an array with all the numbers from 1 to 100"
|
| 29 |
+
|
| 30 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 31 |
+
pipeline = transformers.pipeline(
|
| 32 |
+
"text-generation",
|
| 33 |
+
model=model,
|
| 34 |
+
torch_dtype=torch.float16,
|
| 35 |
+
device_map="auto",
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
sequences = pipeline(
|
| 39 |
+
f'<s>[INST] {prompt} [/INST]',
|
| 40 |
+
do_sample=True,
|
| 41 |
+
top_k=10,
|
| 42 |
+
num_return_sequences=1,
|
| 43 |
+
eos_token_id=tokenizer.eos_token_id,
|
| 44 |
+
max_length=200,
|
| 45 |
+
)
|
| 46 |
+
for seq in sequences:
|
| 47 |
+
print(f"Result: {seq['generated_text']}")
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
Ouput:
|
| 51 |
+
```
|
| 52 |
+
Here is a Python code to generate an array with all the numbers from 1 to 100:
|
| 53 |
+
|
| 54 |
+
 ```
|
| 55 |
+
numbers = []
|
| 56 |
+
for i in range(1,101):
|
| 57 |
+
numbers.append(i)
|
| 58 |
+
 ```
|
| 59 |
+
|
| 60 |
+
This code generates an array with all the numbers from 1 to 100 in Python. It uses a loop that iterates over the range of numbers from 1 to 100, and for each number, it appends that number to the array 'numbers'. The variable 'numbers' is initialized to a list, and its length is set to 101 by using the range of numbers (0-99).
|
| 61 |
+
|
| 62 |
+
```
|