okuchaiev commited on
Commit
b3c6946
1 Parent(s): 3cf50a4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +123 -0
README.md CHANGED
@@ -1,3 +1,126 @@
1
  ---
 
 
 
 
 
 
 
 
 
2
  license: cc-by-4.0
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
+ library_name: nemo
5
+ datasets:
6
+ - the_pile
7
+ tags:
8
+ - text generation
9
+ - pytorch
10
+ - causal-lm
11
  license: cc-by-4.0
12
+
13
  ---
14
+ # NeMo Megatron-GPT 20B
15
+
16
+ <style>
17
+ img {
18
+ display: inline;
19
+ }
20
+ </style>
21
+
22
+ |[![Model architecture](https://img.shields.io/badge/Model%20Arch-Transformer%20Decoder-green)](#model-architecture)|[![Model size](https://img.shields.io/badge/Params-20B-green)](#model-architecture)|[![Language](https://img.shields.io/badge/Language-en--US-lightgrey#model-badge)](#datasets)
23
+
24
+
25
+ ## Model Description
26
+
27
+ Megatron-GPT 20B is a transformer-based language model. GPT refers to a class of transformer decoder-only models similar to GPT-2 and 3 while 20B refers to the total trainable parameter count (20 Billion) [1, 2].
28
+
29
+ This model was trained with [NeMo Megatron](https://docs.nvidia.com/deeplearning/nemo/user-guide/docs/en/stable/nlp/nemo_megatron/intro.html).
30
+
31
+
32
+ ## Getting started
33
+
34
+ ### Step 1: Install NeMo and dependencies
35
+
36
+ You will need to install NVIDIA Apex and NeMo.
37
+
38
+ ```
39
+ git clone https://github.com/ericharper/apex.git
40
+ cd apex
41
+ git checkout nm_v1.11.0
42
+ pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" --global-option="--fast_layer_norm" --global-option="--distributed_adam" --global-option="--deprecated_fused_adam" ./
43
+ ```
44
+
45
+ ```
46
+ pip install nemo_toolkit['nlp']==1.11.0
47
+ ```
48
+
49
+ Alternatively, you can use NeMo Megatron training docker container with all dependencies pre-installed.
50
+
51
+ ### Step 2: Launch eval server
52
+
53
+ **Note.** The example below launches a model variant with Tensor Parallelism (TP) of 8 and Pipeline Parallelism (PP) of 1 on 8 GPUs.
54
+
55
+
56
+ ```
57
+ git clone https://github.com/NVIDIA/NeMo.git
58
+ cd NeMo/examples/nlp/language_modeling
59
+ git checkout v1.11.0
60
+ python megatron_gpt_eval.py gpt_model_file=nemo_gpt20B_fp16_tp8.nemo server=True tensor_model_parallel_size=2 trainer.devices=2
61
+ ```
62
+
63
+ ### Step 3: Send prompts to you model!
64
+ ```python
65
+ import json
66
+ import requests
67
+
68
+ port_num = 5555
69
+ headers = {"Content-Type": "application/json"}
70
+
71
+ def request_data(data):
72
+ resp = requests.put('http://localhost:{}/generate'.format(port_num),
73
+ data=json.dumps(data),
74
+ headers=headers)
75
+ sentences = resp.json()['sentences']
76
+ return sentences
77
+
78
+
79
+ data = {
80
+ "sentences": ["Tell me an interesting fact about space travel."]*1,
81
+ "tokens_to_generate": 50,
82
+ "temperature": 1.0,
83
+ "add_BOS": True,
84
+ "top_k": 0,
85
+ "top_p": 0.9,
86
+ "greedy": False,
87
+ "all_probs": False,
88
+ "repetition_penalty": 1.2,
89
+ "min_tokens_to_generate": 2,
90
+ }
91
+
92
+ sentences = request_data(data)
93
+ print(sentences)
94
+ ```
95
+
96
+
97
+ ## Training Data
98
+
99
+ The model was trained on ["The Piles" dataset prepared by Eleuther.AI](https://pile.eleuther.ai/). [4]
100
+
101
+ ## Evaluation results
102
+
103
+ *Zero-shot performance.* Evaluated using [LM Evaluation Test Suite from AI21](https://github.com/AI21Labs/lm-evaluation)
104
+
105
+ | ARC-Challenge | ARC-Easy | RACE-middle | RACE-high | Winogrande | RTE | BoolQA | HellaSwag | PiQA |
106
+ | ------------- | -------- | ----------- | --------- | ---------- | --- | ------ | --------- | ---- |
107
+ | 0.4403 | 0.6141 | 0.5188 | 0.4277 | 0.659 | 0.5704 | 0.6954 | 0.721 | 0.7688 |
108
+
109
+ ## Limitations
110
+
111
+ The model was trained on the data originally crawled from the Internet. This data contains toxic language and societal biases. Therefore, the model may amplify those biases and return toxic responses especially when prompted with toxic prompts.
112
+
113
+ ## References
114
+
115
+ [1] [Improving Language Understanding by Generative Pre-Training](https://s3-us-west-2.amazonaws.com/openai-assets/research-covers/language-unsupervised/language_understanding_paper.pdf)
116
+
117
+ [2] [Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism](https://arxiv.org/pdf/1909.08053.pdf)
118
+
119
+ [3] [NVIDIA NeMo Toolkit](https://github.com/NVIDIA/NeMo)
120
+
121
+ [4] [The Pile: An 800GB Dataset of Diverse Text for Language Modeling](https://arxiv.org/abs/2101.00027)
122
+
123
+ ## Licence
124
+
125
+ License to use this model is covered by the [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/). By downloading the public and release version of the model, you accept the terms and conditions of the [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) license.
126
+