rpand002 commited on
Commit
2a5a4b1
1 Parent(s): e61e639

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +107 -3
README.md CHANGED
@@ -1,3 +1,107 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: text-generation
3
+ inference: false
4
+ license: apache-2.0
5
+ library_name: transformers
6
+ tags:
7
+ - language
8
+ - granite-3.1
9
+ ---
10
+
11
+ # Granite-3.1-3B-A800M-Base
12
+
13
+ **Model Summary:**
14
+ Granite-3.1-3B-A800M-Base extends the context length of Granite-3.0-3B-A800M-Base from 4K to 128K using a progressive training strategy by increasing the supported context length in increments while adjusting RoPE theta until the model has successfully adapted to desired length of 128K. This long-context pre-training stage was performed using approximately 500B tokens.
15
+
16
+ - **Developers:** Granite Team, IBM
17
+ - **GitHub Repository:** [ibm-granite/granite-3.1-language-models](https://github.com/ibm-granite/granite-3.1-language-models)
18
+ - **Website**: [Granite Docs](https://www.ibm.com/granite/docs/)
19
+ - **Paper:** [Granite 3.1 Language Models (coming soon)](https://huggingface.co/collections/ibm-granite/granite-31-language-models-6751dbbf2f3389bec5c6f02d)
20
+ - **Release Date**: December 18th, 2024
21
+ - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
22
+
23
+ **Supported Languages:**
24
+ English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, and Chinese. Users may finetune Granite 3.1 models for languages beyond these 12 languages.
25
+
26
+ **Intended Use:**
27
+ Prominent use cases of LLMs in text-to-text generation include summarization, text classification, extraction, question-answering, and more. All Granite Base models are able to handle these tasks as they were trained on a large amount of data from various domains. Moreover, they can serve as baseline to create specialized models for specific application scenarios.
28
+
29
+ **Generation:**
30
+ This is a simple example of how to use Granite-3.1-3B-A800M-Base model.
31
+
32
+ Install the following libraries:
33
+
34
+ ```shell
35
+ pip install torch torchvision torchaudio
36
+ pip install accelerate
37
+ pip install transformers
38
+ ```
39
+ Then, copy the code snippet below to run the example.
40
+
41
+ ```python
42
+ from transformers import AutoModelForCausalLM, AutoTokenizer
43
+ device = "auto"
44
+ model_path = "ibm-granite/Granite-3.1-3B-A800M-base"
45
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
46
+ # drop device_map if running on CPU
47
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
48
+ model.eval()
49
+ # change input text as desired
50
+ input_text = "Where is the Thomas J. Watson Research Center located?"
51
+ # tokenize the text
52
+ input_tokens = tokenizer(input_text, return_tensors="pt").to(device)
53
+ # generate output tokens
54
+ output = model.generate(**input_tokens,
55
+ max_length=4000)
56
+ # decode output tokens into text
57
+ output = tokenizer.batch_decode(output)
58
+ # print output
59
+ print(output)
60
+ ```
61
+
62
+ **Model Architecture:**
63
+ Granite-3.1-3B-A800M-Base is based on a decoder-only sparse Mixture of Experts (MoE) transformer architecture. Core components of this architecture are: Fine-grained Experts, Dropless Token Routing, and Load Balancing Loss.
64
+
65
+ | Model | 2B Dense | 8B Dense | 1B MoE | 3B MoE |
66
+ | :-------- | :--------| :--------| :-------- | :--------|
67
+ | Embedding size | 2048 | 4096 | **1024** | 1536 |
68
+ | Number of layers | 40 | 40 | **24** | 32 |
69
+ | Attention head size | 64 | 128 | **64** | 64 |
70
+ | Number of attention heads | 32 | 32 | **16** | 24 |
71
+ | Number of KV heads | 8 | 8 | **8** | 8 |
72
+ | MLP hidden size | 8192 | 12800 | **512** | 512 |
73
+ | MLP activation | SwiGLU | SwiGLU | **SwiGLU** | SwiGLU |
74
+ | Number of experts | — | — | **32** | 40 |
75
+ | MoE TopK | — | — | **8** | 8 |
76
+ | Initialization std | 0.1 | 0.1 | **0.1** | 0.1 |
77
+ | Sequence length | 128K | 128k | **128k** | 128k |
78
+ | Position embedding | RoPE | RoPE | **RoPE** | RoPE |
79
+ | # Parameters | 2.5B | 8.1B | **1.3B** | 3.3B |
80
+ | # Active parameters | 2.5B | 8.1B | **400M** | 800M |
81
+ | # Training tokens | 12T | 12T | **10T** | 10T |
82
+
83
+ **Training Data:**
84
+ This model is trained on a mix of open source and proprietary data following a two-stage training strategy.
85
+ * Stage 1 data: The data for stage 1 is sourced from diverse domains, such as: web, code, academic sources, books, and math data.
86
+ * Stage 2 data: The data for stage 2 comprises a curated mix of high-quality data from the same domains, plus multilingual and instruction data. The goal of this second training phase is to enhance the model’s performance on specific tasks.
87
+ * Stage 3 data: The data for stage 3 consists of original stage-2 pretraining data with additional synthetic long-context data in form of QA/summary pairs where the answer contains a recitation of the related paragraph before the answer.
88
+
89
+ A detailed attribution of datasets can be found in the [Granite 3.0 Technical Report](https://github.com/ibm-granite/granite-3.0-language-models/blob/main/paper.pdf), [Granite 3.1 Technical Report (coming soon)](https://huggingface.co/collections/ibm-granite/granite-31-language-models-6751dbbf2f3389bec5c6f02d), and [Accompanying Author List](https://github.com/ibm-granite/granite-3.0-language-models/blob/main/author-ack.pdf).
90
+
91
+ **Infrastructure:**
92
+ We train Granite 3.1 Language Models using IBM's super computing cluster, Blue Vela, which is outfitted with NVIDIA H100 GPUs. This cluster provides a scalable and efficient infrastructure for training our models over thousands of GPUs.
93
+
94
+ **Ethical Considerations and Limitations:**
95
+ The use of Large Language Models involves risks and ethical considerations people must be aware of, including but not limited to: bias and fairness, misinformation, and autonomous decision-making. Granite-3.1-3B-A800M-Base model is not the exception in this regard. Even though this model is suited for multiple generative AI tasks, it has not undergone any safety alignment, there it may produce problematic outputs. Additionally, it remains uncertain whether smaller models might exhibit increased susceptibility to hallucination in generation scenarios by copying text verbatim from the training dataset due to their reduced sizes and memorization capacities. This aspect is currently an active area of research, and we anticipate more rigorous exploration, comprehension, and mitigations in this domain. Regarding ethics, a latent risk associated with all Large Language Models is their malicious utilization. We urge the community to use Granite-3.1-3B-A800M-Base model with ethical intentions and in a responsible way.
96
+
97
+ <!-- ## Citation
98
+ ```
99
+ @misc{granite-models,
100
+ author = {author 1, author2, ...},
101
+ title = {},
102
+ journal = {},
103
+ volume = {},
104
+ year = {2024},
105
+ url = {https://arxiv.org/abs/0000.00000},
106
+ }
107
+ ``` -->