emre commited on
Commit
7bfc572
β€’
1 Parent(s): e122e84

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +65 -0
README.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - emre/llama-2-13b-code-chat
5
+ tags:
6
+ - code
7
+ ---
8
+
9
+ # πŸ¦™πŸ’» CodeLlama
10
+
11
+
12
+ `emre/llama-2-13b-code-chat` is a Llama 2 version of [**CodeAlpaca**](https://github.com/sahil280114/codealpaca).
13
+
14
+ ## πŸ”§ Training
15
+
16
+ This model is based on the `llama-2-13b-chat-hf` model, fine-tuned using QLoRA on the [`mlabonne/CodeLlama-2-20k`](https://huggingface.co/datasets/mlabonne/CodeLlama-2-20k) dataset.
17
+ It was trained on an Colab Pro+It was trained Colab Pro+.
18
+ It is mainly designed for educational purposes, not for inference but can be used exclusively with BBVA Group, GarantiBBVA and its subsidiaries.
19
+
20
+
21
+ ## πŸ’» Usage
22
+
23
+ ``` python
24
+ # pip install transformers accelerate
25
+
26
+ from transformers import AutoTokenizer
27
+ import transformers
28
+ import torch
29
+
30
+ model = "emre/llama-2-13b-code-chat"
31
+ prompt = "Write Python code to generate an array with all the numbers from 1 to 100"
32
+
33
+ tokenizer = AutoTokenizer.from_pretrained(model)
34
+ pipeline = transformers.pipeline(
35
+ "text-generation",
36
+ model=model,
37
+ torch_dtype=torch.float16,
38
+ device_map="auto",
39
+ )
40
+
41
+ sequences = pipeline(
42
+ f'<s>[INST] {prompt} [/INST]',
43
+ do_sample=True,
44
+ top_k=10,
45
+ num_return_sequences=1,
46
+ eos_token_id=tokenizer.eos_token_id,
47
+ max_length=200,
48
+ )
49
+ for seq in sequences:
50
+ print(f"Result: {seq['generated_text']}")
51
+ ```
52
+
53
+ Ouput:
54
+ ```
55
+ Here is a Python code to generate an array with all the numbers from 1 to 100:
56
+
57
+ β€…```
58
+ numbers = []
59
+ for i in range(1,101):
60
+ numbers.append(i)
61
+ β€…```
62
+
63
+ 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).
64
+
65
+ ```