YikangS commited on
Commit
97aed77
1 Parent(s): 02e1b1a

First model version

Browse files
README.md CHANGED
@@ -1,3 +1,79 @@
1
  ---
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+ # **MoLM**
5
+ MoLM is a collection of MoE-based language models ranging in scale from 4 billion to 8 billion parameters. This is the repository for the MoLM-700M-4B pretrained model, converted for the Hugging Face Transformers format. Links to other models can be found in the index at the bottom.
6
+
7
+ **Model Usage**
8
+ To load the model, you need install the [ModuleFormer package](https://github.com/IBM/ModuleFormer). Then you can load the model with the following code:
9
+ ```
10
+ from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig, AutoModelForSequenceClassification
11
+ from moduleformer import ModuleFormerForCausalLM, ModuleFormerConfig, ModuleFormerForSequenceClassification
12
+ AutoConfig.register("moduleformer", ModuleFormerConfig)
13
+ AutoModelForCausalLM.register(ModuleFormerConfig, ModuleFormerForCausalLM)
14
+ AutoModelForSequenceClassification.register(ModuleFormerConfig, ModuleFormerForSequenceClassification)
15
+
16
+ tokenizer = AutoTokenizer.from_pretrained('ibm/MoLM-350M-4B')
17
+ model = AutoModelForCausalLM.from_pretrained('ibm/MoLM-350M-4B')
18
+ ```
19
+
20
+ **Model Details**
21
+ MoLM-350M-4B is a MoE-based language models. It has 4 billion parameters, but each input token only use 350M parameteres during its inference. Thus, it's computationally equivelant to a 350M dense model.
22
+ MoLM-700M-4B has 4 billion parameters and computationally equivelant to a 700M dense model.
23
+ MoLM-700M-8B has 8 billion parameters and computationally equivelant to a 700M dense model.
24
+ Both models are trained on 300 billion tokens from publicly available sources, with a learning rate of 3.0 x 10<sup>-4</sup> and a global batch-size of 3M tokens.
25
+
26
+ **Model Developers** IBM
27
+
28
+ **Variations** MoLM comes in two different parameter sizes — 4B and 8B. The 4B models has two variants with different computation cost — 350M and 700M.
29
+
30
+ **Input** Models input text only.
31
+
32
+ **Output** Models generate text only.
33
+
34
+ **Model Architecture** MoLM is an auto-regressive language model that uses the ModuleFormer architecture. It has 16 attention modules in each attention layer and 32 MLP modules in each MLP layer. During inference, in each layer, MoLM-350M-4B and MoLM-700M-8B activate 2 modules for each token, while MoLM-700M-4B activate 4 modules. MoLM-350M-4B and MoLM-700M-4B has 24 blocks and MoLM-700M-8B has 48 blocks.
35
+
36
+ **Status** This is a static model trained on an offline dataset. Future versions of the tuned models will be released as we improve model safety with community feedback.
37
+
38
+ **Research Paper** ["ModuleFormer: Modularity Emerges from Mixture-of-Experts"](https://arxiv.org/abs/2306.04640)
39
+
40
+ ## Training Data
41
+ MoLM models are pretrained on 300 billion tokens of data from publicly available sources.
42
+
43
+ ## Evaluation Results
44
+
45
+ In this section, we report the results for the MoLM models on standard academic benchmarks. For all the evaluations, we use [LM evaluations Harness](https://github.com/EleutherAI/lm-evaluation-harness).
46
+
47
+ |Model|Latency|Memory|Throughput|Hellaswag|PIQA|ARC-e|ARC-c|OBQA|
48
+ |---|---|---|---|---|---|---|---|---|
49
+ ||ms|GB|tokens/sec|acc|acc|acc|acc|acc|
50
+ |Pythia 410M|554|25|59594|33.72|66.70|51.89|21.42|18.2|
51
+ |GPT-Neo 1.3B|991|23|32857|38.66|71.11|56.19|23.12|21.4|
52
+ |Pythia 1.4B|918|42|35559|40.41|70.84|60.52|26.11|22.2|
53
+ |MoLM-350M-4B|497|27|71017|39.21|70.13|56.44|23.55|20.8|
54
+ |GPT-Neo 2.7B|1737|35|18788|42.71|72.2|61.07|27.47|23.2|
55
+ |Pythia 2.8B|2111|70|15522|45.34|73.99|64.35|29.35|23.8|
56
+ |MoLM-700M-4B|863|27|39931|42.20|73.01|60.82|25.94|22.6|
57
+ |MoLM-700M-8B|939|38|37419|43.33|72.91|62.46|27.90|23.8|
58
+
59
+ |Model| |TriviaQA| | | HumanEval| |Wikitext|
60
+ |---|---|---|---|---|---|---|---|
61
+ ||0-shot |1-shot |5-shot |pass@1 |pass@10 |pass@100 |PPL|
62
+ |Pythia 410M |2.32 |5.02 |6.42 |1.20 |3.85 |9.98 |20.09 |
63
+ |GPT-Neo 1.3B |5.24 |8.01 |9.74 |3.62 |6.87 |14.50 |16.16 |
64
+ |Pythia 1.4B |5.30 |9.87 |12.84 |2.19 |7.31 |14.33 |14.71|
65
+ |MoLM-350M-4B |5.40 |11.12 |13.70 |3.04 |6.99 |13.79 |15.15 |
66
+ |GPT-Neo 2.7B |4.82 |11.23 |13.67 |4.89 |9.54 |17.90 |13.93 |
67
+ |Pythia 2.8B |7.38 |15.58 |18.98 |4.91 |11.76 |21.54 |12.68|
68
+ |MoLM-700M-4B|9.07|14.24|16.49|5.50|10.65|20.27|13.20|
69
+ |MoLM-700M-8B |11.47 |16.73 |20.75 |5.51 |12.58 |20.40 |12.97 |
70
+
71
+ ## Ethical Considerations and Limitations
72
+ MoLM is a new technology that carries risks with use. Testing conducted to date has been in English, and has not covered, nor could it cover all scenarios. For these reasons, as with all LLMs, MoLM’s potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses to user prompts. Therefore, before deploying any applications of MoLM, developers should perform safety testing and tuning tailored to their specific applications of the model.
73
+
74
+ ## MoLM Model Index
75
+ |Model|MoLM|
76
+ |---|---|
77
+ |350M-4B| [Link](https://huggingface.co/ibm/MoLM-350M-4B) |
78
+ |700M-4B| [Link](https://huggingface.co/ibm/MoLM-700M-4B) |
79
+ |700M-8B| [Link](https://huggingface.co/ibm/MoLM-700M-8B) |
added_tokens.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "\t\t": 50294,
3
+ "\t\t\t": 50293,
4
+ "\t\t\t\t": 50292,
5
+ "\t\t\t\t\t": 50291,
6
+ "\t\t\t\t\t\t": 50290,
7
+ "\t\t\t\t\t\t\t": 50289,
8
+ "\t\t\t\t\t\t\t\t": 50288,
9
+ "\t\t\t\t\t\t\t\t\t": 50287,
10
+ " ": 50286,
11
+ " ": 50285,
12
+ " ": 50284,
13
+ " ": 50283,
14
+ " ": 50282,
15
+ " ": 50281,
16
+ " ": 50280,
17
+ " ": 50279,
18
+ " ": 50278,
19
+ " ": 50277,
20
+ " ": 50276,
21
+ " ": 50275,
22
+ " ": 50274,
23
+ " ": 50273,
24
+ " ": 50272,
25
+ " ": 50271,
26
+ " ": 50270,
27
+ " ": 50269,
28
+ " ": 50268,
29
+ " ": 50267,
30
+ " ": 50266,
31
+ " ": 50265,
32
+ " ": 50264,
33
+ " ": 50263,
34
+ " ": 50262,
35
+ " ": 50261,
36
+ " ": 50260,
37
+ " ": 50259,
38
+ " ": 50258,
39
+ " ": 50257
40
+ }
config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "./MoLM-700M-4B",
3
+ "activation_function": "gelu_new",
4
+ "architectures": [
5
+ "ModuleFormerForCausalLM"
6
+ ],
7
+ "att_func": "stickbreaking",
8
+ "att_hidden": 1024,
9
+ "attn_pdrop": 0,
10
+ "aux_loss_type": "mi",
11
+ "aux_loss_weight": 0,
12
+ "block_size": 512,
13
+ "bos_token_id": 50256,
14
+ "embd_pdrop": 0,
15
+ "eos_token_id": 50256,
16
+ "ffd_hidden": 2048,
17
+ "gate_type": "mlp",
18
+ "gating_size": 256,
19
+ "history_length": 512,
20
+ "initializer_range": 0.02,
21
+ "k_att": 4,
22
+ "k_mlp": 4,
23
+ "layer_norm_epsilon": 1e-05,
24
+ "local_size": 1,
25
+ "model_type": "moduleformer",
26
+ "moe_pdrop": 0,
27
+ "moe_type": "moe",
28
+ "n_att_experts": 16,
29
+ "n_ctx": 12288,
30
+ "n_embd": 1024,
31
+ "n_head": 1,
32
+ "n_layer": 24,
33
+ "n_mlp_experts": 32,
34
+ "pre_norm": true,
35
+ "resid_pdrop": 0,
36
+ "sample_topk": 0,
37
+ "tie_word_embeddings": false,
38
+ "torch_dtype": "bfloat16",
39
+ "transformers_version": "4.28.1",
40
+ "universal": false,
41
+ "use_cache": true,
42
+ "vocab_size": 50295,
43
+ "world_size": null
44
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 50256,
4
+ "eos_token_id": 50256,
5
+ "transformers_version": "4.28.1"
6
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e08644f7a0d5fe671efea6e788a3b799f645b6a520790362315ef6c7ea99b74
3
+ size 8360677801
special_tokens_map.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<|endoftext|>",
3
+ "eos_token": "<|endoftext|>",
4
+ "unk_token": "<|endoftext|>"
5
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "bos_token": "<|endoftext|>",
4
+ "clean_up_tokenization_spaces": true,
5
+ "eos_token": "<|endoftext|>",
6
+ "model_max_length": 2048,
7
+ "tokenizer_class": "CodeGenTokenizer",
8
+ "unk_token": "<|endoftext|>"
9
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff