Text Generation
Transformers
PyTorch
English
mistral
text-generation-inference
Inference Endpoints
instruction-pretrain commited on
Commit
6bcbd8a
1 Parent(s): d916a1f

Upload 8 files

Browse files
README.md CHANGED
@@ -1,3 +1,53 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Instruction Pre-Training: Language Models are Supervised Multitask Learners
2
+ This repo contains the **context-based instruction synthesizer** used in our paper **Instruction Pre-Training: Language Models are Supervised Multitask Learners**.
3
+
4
+ We explore supervised multitask pre-training by proposing ***Instruction Pre-Training***, a framework that scalably augments massive raw corpora with instruction-response pairs to pre-train language models. The instruction-response pairs are generated by an efficient instruction synthesizer built on open-source models. In our experiments, we synthesize 200M instruction-response pairs covering 40+ task categories to verify the effectiveness of *Instruction Pre-Training*. Instruction Pre-Training* outperforms *Vanilla Pre-training* in both general pre-training from scratch and domain-adaptive continued pre-training. **In pre-training from scratch, *Instruction Pre-Training* not only improves pre-trained base models but also benefits more from further instruction tuning.** In continual pre-training, *Instruction Pre-Training* enables Llama3-8B to be comparable to or even outperform Llama3-70B.
5
+
6
+ <p align='center'>
7
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/66711d2ee12fa6cc5f5dfc89/j1hlqGreoZrBsK7sz3oG9.png" width="500">
8
+ </p>
9
+
10
+ ## General Pre-Training From Scratch
11
+ We augment the RefinedWeb corproa with instruction-response pairs generated by our [context-based instruction synthesizer](https://huggingface.co/instruction-pretrain/instruction-synthesizer) to pre-train a general langauge model from scratch.
12
+
13
+ To evaluate our general base model using the [lm-evaluation-harness framework](https://github.com/EleutherAI/lm-evaluation-harness)
14
+
15
+ 1. Setup dependencies:
16
+ ```bash
17
+ git clone https://github.com/EleutherAI/lm-evaluation-harness
18
+ cd lm-evaluation-harness
19
+ pip install -e .
20
+ ```
21
+
22
+ 2. Evalaute
23
+ ```bash
24
+ MODEL=instruction-pretrain/InstructLM-500M
25
+ add_bos_token=True # this flag is needed because lm-eval-harness set add_bos_token to False by default, but ours require add_bos_token to be True
26
+
27
+ accelerate launch -m lm_eval --model hf \
28
+ --model_args pretrained=${MODEL},add_bos_token=${add_bos_token},dtype=float16 \
29
+ --gen_kwargs do_sample=False \
30
+ --tasks piqa,hellaswag,winogrande \
31
+ --batch_size auto \
32
+ --num_fewshot 0
33
+
34
+ accelerate launch -m lm_eval --model hf \
35
+ --model_args pretrained=${MODEL},add_bos_token=${add_bos_token},dtype=float16 \
36
+ --gen_kwargs do_sample=False \
37
+ --tasks social_iqa,ai2_arc,openbookqa,boolq,mmlu \
38
+ --batch_size auto \
39
+ --num_fewshot 5
40
+ ```
41
+
42
+ ## Citation
43
+ If you find our work helpful, please cite us:
44
+ ```bibtex
45
+ @inproceedings{
46
+ cheng2024adapting,
47
+ title={Adapting Large Language Models via Reading Comprehension},
48
+ author={Daixuan Cheng and Shaohan Huang and Furu Wei},
49
+ booktitle={The Twelfth International Conference on Learning Representations},
50
+ year={2024},
51
+ url={https://openreview.net/forum?id=y886UXPEZ0}
52
+ }
53
+ ```
config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MistralForCausalLM"
4
+ ],
5
+ "bos_token_id": 1,
6
+ "eos_token_id": 2,
7
+ "hidden_act": "silu",
8
+ "hidden_size": 1536,
9
+ "initializer_range": 0.02,
10
+ "intermediate_size": 4320,
11
+ "max_position_embeddings": 2048,
12
+ "model_type": "mistral",
13
+ "num_attention_heads": 24,
14
+ "num_hidden_layers": 16,
15
+ "num_key_value_heads": 24,
16
+ "rms_norm_eps": 1e-05,
17
+ "rope_theta": 10000.0,
18
+ "sliding_window": 2048,
19
+ "tie_word_embeddings": false,
20
+ "torch_dtype": "float16",
21
+ "transformers_version": "4.34.0.dev0",
22
+ "use_cache": true,
23
+ "vocab_size": 32000
24
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "transformers_version": "4.34.0.dev0"
6
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ef58dc140a03cd4f99a0f72cbf9830d81d55138dc01a77b7e834ea6b82d72dc
3
+ size 2271376918
special_tokens_map.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "eos_token": "</s>",
4
+ "unk_token": "<unk>"
5
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055
3
+ size 493443
tokenizer_config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ }
29
+ },
30
+ "additional_special_tokens": [],
31
+ "bos_token": "<s>",
32
+ "clean_up_tokenization_spaces": false,
33
+ "eos_token": "</s>",
34
+ "legacy": true,
35
+ "model_max_length": 2048,
36
+ "pad_token": null,
37
+ "sp_model_kwargs": {},
38
+ "spaces_between_special_tokens": false,
39
+ "tokenizer_class": "LlamaTokenizer",
40
+ "unk_token": "<unk>",
41
+ "use_default_system_prompt": false
42
+ }