dfurman commited on
Commit
1db8c05
1 Parent(s): b548a4e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +63 -123
README.md CHANGED
@@ -1,35 +1,22 @@
1
  ---
 
2
  license: other
3
  ---
4
 
5
- LLaMA-7B converted to work with Transformers/HuggingFace. This is under a special license, please see the LICENSE file for details.
6
 
7
- --
8
- license: other
9
- ---
10
- # LLaMA Model Card
11
-
12
- ## Model details
13
- **Organization developing the model**
14
- The FAIR team of Meta AI.
15
-
16
- **Model date**
17
- LLaMA was trained between December. 2022 and Feb. 2023.
18
-
19
- **Model version**
20
- This is version 1 of the model.
21
 
22
- **Model type**
23
- LLaMA is an auto-regressive language model, based on the transformer architecture. The model comes in different sizes: 7B, 13B, 33B and 65B parameters.
24
 
25
- **Paper or resources for more information**
26
- More information can be found in the paper “LLaMA, Open and Efficient Foundation Language Models”, available at https://research.facebook.com/publications/llama-open-and-efficient-foundation-language-models/.
27
 
28
- **Citations details**
29
- https://research.facebook.com/publications/llama-open-and-efficient-foundation-language-models/
30
 
31
- **License**
32
- Non-commercial bespoke license
 
 
 
33
 
34
  **Where to send questions or comments about the model**
35
  Questions and comments about LLaMA can be sent via the [GitHub repository](https://github.com/facebookresearch/llama) of the project , by opening an issue.
@@ -37,116 +24,21 @@ Questions and comments about LLaMA can be sent via the [GitHub repository](https
37
  ## Intended use
38
  **Primary intended uses**
39
  The primary use of LLaMA is research on large language models, including:
40
- exploring potential applications such as question answering, natural language understanding or reading comprehension,
41
- understanding capabilities and limitations of current language models, and developing techniques to improve those,
42
  evaluating and mitigating biases, risks, toxic and harmful content generations, hallucinations.
43
 
44
  **Primary intended users**
45
  The primary intended users of the model are researchers in natural language processing, machine learning and artificial intelligence.
46
 
47
  **Out-of-scope use cases**
48
- LLaMA is a base, or foundational, model. As such, it should not be used on downstream applications without further risk evaluation and mitigation. In particular, our model has not been trained with human feedback, and can thus generate toxic or offensive content, incorrect information or generally unhelpful answers.
49
 
50
  ## Factors
51
  **Relevant factors**
52
- One of the most relevant factors for which model performance may vary is which language is used. Although we included 20 languages in the training data, most of our dataset is made of English text, and we thus expect the model to perform better for English than other languages. Relatedly, it has been shown in previous studies that performance might vary for different dialects, and we expect that it will be the case for our model.
53
 
54
  **Evaluation factors**
55
- As our model is trained on data from the Web, we expect that it reflects biases from this source. We thus evaluated on RAI datasets to measure biases exhibited by the model for gender, religion, race, sexual orientation, age, nationality, disability, physical appearance and socio-economic status. We also measure the toxicity of model generations, depending on the toxicity of the context used to prompt the model.
56
-
57
- ## Metrics
58
- **Model performance measures**
59
- We use the following measure to evaluate the model:
60
- - Accuracy for common sense reasoning, reading comprehension, natural language understanding (MMLU), BIG-bench hard, WinoGender and CrowS-Pairs,
61
- - Exact match for question answering,
62
- - The toxicity score from Perspective API on RealToxicityPrompts.
63
-
64
- **Decision thresholds**
65
- Not applicable.
66
-
67
- **Approaches to uncertainty and variability**
68
- Due to the high computational requirements of training LLMs, we trained only one model of each size, and thus could not evaluate variability of pre-training.
69
-
70
- ## Evaluation datasets
71
- The model was evaluated on the following benchmarks: BoolQ, PIQA, SIQA, HellaSwag, WinoGrande, ARC, OpenBookQA, NaturalQuestions, TriviaQA, RACE, MMLU, BIG-bench hard, GSM8k, RealToxicityPrompts, WinoGender, CrowS-Pairs.
72
-
73
- ## Training dataset
74
- The model was trained using the following source of data: CCNet [67%], C4 [15%], GitHub [4.5%], Wikipedia [4.5%], Books [4.5%], ArXiv [2.5%], Stack Exchange[2%]. The Wikipedia and Books domains include data in the following languages: bg, ca, cs, da, de, en, es, fr, hr, hu, it, nl, pl, pt, ro, ru, sl, sr, sv, uk. See the paper for more details about the training set and corresponding preprocessing.
75
-
76
- ## Quantitative analysis
77
- Hyperparameters for the model architecture
78
-
79
-
80
- <table>
81
- <thead>
82
- <tr>
83
- <th >LLaMA</th> <th colspan=6>Model hyper parameters </th>
84
- </tr>
85
- <tr>
86
- <th>Number of parameters</th><th>dimension</th><th>n heads</th><th>n layers</th><th>Learn rate</th><th>Batch size</th><th>n tokens</th>
87
- </tr>
88
- </thead>
89
- <tbody>
90
- <tr>
91
- <th>7B</th> <th>4096</th> <th>32</th> <th>32</th> <th>3.0E-04</th><th>4M</th><th>1T
92
- </tr>
93
- <tr>
94
- <th>13B</th><th>5120</th><th>40</th><th>40</th><th>3.0E-04</th><th>4M</th><th>1T
95
- </tr>
96
- <tr>
97
- <th>33B</th><th>6656</th><th>52</th><th>60</th><th>1.5.E-04</th><th>4M</th><th>1.4T
98
- </tr>
99
- <tr>
100
- <th>65B</th><th>8192</th><th>64</th><th>80</th><th>1.5.E-04</th><th>4M</th><th>1.4T
101
- </tr>
102
- </tbody>
103
- </table>
104
-
105
- *Table 1 - Summary of LLama Model Hyperparameters*
106
-
107
- We present our results on eight standard common sense reasoning benchmarks in the table below.
108
- <table>
109
- <thead>
110
- <tr>
111
- <th>LLaMA</th> <th colspan=9>Reasoning tasks </th>
112
- </tr>
113
- <tr>
114
- <th>Number of parameters</th> <th>BoolQ</th><th>PIQA</th><th>SIQA</th><th>HellaSwag</th><th>WinoGrande</th><th>ARC-e</th><th>ARC-c</th><th>OBQA</th><th>COPA</th>
115
- </tr>
116
- </thead>
117
- <tbody>
118
- <tr>
119
- <th>7B</th><th>76.5</th><th>79.8</th><th>48.9</th><th>76.1</th><th>70.1</th><th>76.7</th><th>47.6</th><th>57.2</th><th>93
120
- </th>
121
- <tr><th>13B</th><th>78.1</th><th>80.1</th><th>50.4</th><th>79.2</th><th>73</th><th>78.1</th><th>52.7</th><th>56.4</th><th>94
122
- </th>
123
- <tr><th>33B</th><th>83.1</th><th>82.3</th><th>50.4</th><th>82.8</th><th>76</th><th>81.4</th><th>57.8</th><th>58.6</th><th>92
124
- </th>
125
- <tr><th>65B</th><th>85.3</th><th>82.8</th><th>52.3</th><th>84.2</th><th>77</th><th>81.5</th><th>56</th><th>60.2</th><th>94</th></tr>
126
- </tbody>
127
- </table>
128
- *Table 2 - Summary of LLama Model Performance on Reasoning tasks*
129
-
130
-
131
- We present our results on bias in the table below. Note that lower value is better indicating lower bias.
132
-
133
-
134
- | No | Category | FAIR LLM |
135
- | --- | -------------------- | -------- |
136
- | 1 | Gender | 70.6 |
137
- | 2 | Religion | 79 |
138
- | 3 | Race/Color | 57 |
139
- | 4 | Sexual orientation | 81 |
140
- | 5 | Age | 70.1 |
141
- | 6 | Nationality | 64.2 |
142
- | 7 | Disability | 66.7 |
143
- | 8 | Physical appearance | 77.8 |
144
- | 9 | Socioeconomic status | 71.5 |
145
- | | LLaMA Average | 66.6 |
146
-
147
- *Table 3 - Summary bias of our model output*
148
-
149
-
150
 
151
  ## Ethical considerations
152
  **Data**
@@ -159,8 +51,56 @@ The model is not intended to inform decisions about matters central to human lif
159
  We filtered the data from the Web based on its proximity to Wikipedia text and references. For this, we used a Kneser-Ney language model and a fastText linear classifier.
160
 
161
  **Risks and harms**
162
- Risks and harms of large language models include the generation of harmful, offensive or biased content. These models are often prone to generating incorrect information, sometimes referred to as hallucinations. We do not expect our model to be an exception in this regard.
163
 
164
  **Use cases**
165
  LLaMA is a foundational model, and as such, it should not be used for downstream applications without further investigation and mitigations of risks. These risks and potential fraught use cases include, but are not limited to: generation of misinformation and generation of harmful, biased or offensive content.
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ pipeline_tag: text-generation
3
  license: other
4
  ---
5
 
6
+ # 🚀 LLaMA-7B
7
 
8
+ LLaMA-7B is a base model for text generation. It was built by the FAIR team at Meta AI and released alongside "LLaMA: Open and Efficient Foundation Language Models" ([link](https://arxiv.org/abs/2302.13971)).
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
+ This model repo was converted to work with the Hugging Face transformers package. It is under a bespoke **non-commercial** license, please see the LICENSE file for more details.
 
11
 
 
 
12
 
13
+ ## Model Summary
 
14
 
15
+ - **Model Type:** Causal decoder-only.
16
+ - **Dataset:** The model was trained on 1T tokens using the following data sources: CCNet [67%], C4 [15%], GitHub [4.5%], Wikipedia [4.5%], Books [4.5%], ArXiv [2.5%], Stack Exchange[2%].
17
+ - **Language(s):** The Wikipedia and Books domains include data in the following languages: bg, ca, cs, da, de, en, es, fr, hr, hu, it, nl, pl, pt, ro, ru, sl, sr, sv, uk.
18
+ - **License:** Bespoke non-commercial license, see LICENSE file.
19
+ - **Model date:** LLaMA was trained between Dec 2022 and Feb 2023.
20
 
21
  **Where to send questions or comments about the model**
22
  Questions and comments about LLaMA can be sent via the [GitHub repository](https://github.com/facebookresearch/llama) of the project , by opening an issue.
 
24
  ## Intended use
25
  **Primary intended uses**
26
  The primary use of LLaMA is research on large language models, including:
27
+ exploring potential applications such as question answering, natural language understanding or reading comprehension, understanding capabilities and limitations of current language models, and developing techniques to improve those,
 
28
  evaluating and mitigating biases, risks, toxic and harmful content generations, hallucinations.
29
 
30
  **Primary intended users**
31
  The primary intended users of the model are researchers in natural language processing, machine learning and artificial intelligence.
32
 
33
  **Out-of-scope use cases**
34
+ LLaMA is a foundation model (a base model). As such, it should not be used on downstream applications without further risk evaluation and mitigation. In particular, the model has not been trained with human feedback, and can thus generate toxic or offensive content, incorrect information or generally unhelpful answers.
35
 
36
  ## Factors
37
  **Relevant factors**
38
+ One of the most relevant factors for which model performance may vary is which language is used. Although we included 20 languages in the training data, most of the LLaMA dataset is made of English text, and we thus expect the model to perform better for English than other languages. Relatedly, it has been shown in previous studies that performance might vary for different dialects, and we expect that it will be the case for LLaMA.
39
 
40
  **Evaluation factors**
41
+ As LLaMA is trained on data from the Web, we expect that it reflects biases from this source. We thus evaluated on RAI datasets to measure biases exhibited by the model for gender, religion, race, sexual orientation, age, nationality, disability, physical appearance and socio-economic status. We also measure the toxicity of model generations, depending on the toxicity of the context used to prompt the model.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  ## Ethical considerations
44
  **Data**
 
51
  We filtered the data from the Web based on its proximity to Wikipedia text and references. For this, we used a Kneser-Ney language model and a fastText linear classifier.
52
 
53
  **Risks and harms**
54
+ Risks and harms of large language models include the generation of harmful, offensive or biased content. These models are often prone to generating incorrect information, sometimes referred to as hallucinations. We do not expect LLaMA to be an exception in this regard.
55
 
56
  **Use cases**
57
  LLaMA is a foundational model, and as such, it should not be used for downstream applications without further investigation and mitigations of risks. These risks and potential fraught use cases include, but are not limited to: generation of misinformation and generation of harmful, biased or offensive content.
58
 
59
+ ## How to Get Started with the Model
60
+
61
+ ### Setup
62
+ ```python
63
+ # Install packages
64
+ !pip install -q -U transformers accelerate torch
65
+ ```
66
+ ### GPU Inference in fp16
67
+
68
+ This requires a GPU with at least 15GB memory.
69
+
70
+ ### First, Load the Model
71
+
72
+ ```python
73
+ import transformers
74
+ import torch
75
+
76
+ model_name = "dfurman/llama-7b"
77
+
78
+ tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)
79
+ streamer = transformers.TextStreamer(tokenizer)
80
+
81
+ model = transformers.LlamaForCausalLM.from_pretrained(
82
+ model_name,
83
+ torch_dtype=torch.bfloat16,
84
+ device_map="auto"
85
+ )
86
+ ```
87
+
88
+ ### Next, Run the Model
89
+
90
+ ```python
91
+ prompt = "An increasing sequence: one,"
92
+
93
+ inputs = tokenizer(
94
+ prompt,
95
+ padding=True,
96
+ truncation=True,
97
+ return_tensors='pt',
98
+ return_token_type_ids=False,
99
+ ).to("cuda")
100
+
101
+ _ = model.generate(
102
+ **inputs,
103
+ max_new_tokens=20,
104
+ streamer=streamer,
105
+ )
106
+ ```