Triangle104
commited on
Commit
•
e15c2b8
1
Parent(s):
196f658
Update README.md
Browse files
README.md
CHANGED
@@ -135,6 +135,90 @@ model-index:
|
|
135 |
This model was converted to GGUF format from [`ibm-granite/granite-3.0-2b-instruct`](https://huggingface.co/ibm-granite/granite-3.0-2b-instruct) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
|
136 |
Refer to the [original model card](https://huggingface.co/ibm-granite/granite-3.0-2b-instruct) for more details on the model.
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
## Use with llama.cpp
|
139 |
Install llama.cpp through brew (works on Mac and Linux)
|
140 |
|
|
|
135 |
This model was converted to GGUF format from [`ibm-granite/granite-3.0-2b-instruct`](https://huggingface.co/ibm-granite/granite-3.0-2b-instruct) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
|
136 |
Refer to the [original model card](https://huggingface.co/ibm-granite/granite-3.0-2b-instruct) for more details on the model.
|
137 |
|
138 |
+
---
|
139 |
+
Model Summary: Granite-3.0-2B-Instruct is a 2B parameter model finetuned from Granite-3.0-2B-Base using a combination of open source instruction datasets with permissive license and internally collected synthetic datasets. This model is developed using a diverse set of techniques with a structured chat format, including supervised finetuning, model alignment using reinforcement learning, and model merging.
|
140 |
+
|
141 |
+
Developers: Granite Team, IBM
|
142 |
+
GitHub Repository: ibm-granite/granite-3.0-language-models
|
143 |
+
Website: Granite Docs
|
144 |
+
Paper: Granite 3.0 Language Models
|
145 |
+
Release Date: October 21st, 2024
|
146 |
+
License: Apache 2.0
|
147 |
+
|
148 |
+
Supported Languages: English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, and Chinese. Users may finetune Granite 3.0 models for languages beyond these 12 languages.
|
149 |
+
|
150 |
+
Intended use: The model is designed to respond to general instructions and can be used to build AI assistants for multiple domains, including business applications.
|
151 |
+
|
152 |
+
Capabilities
|
153 |
+
|
154 |
+
Summarization
|
155 |
+
Text classification
|
156 |
+
Text extraction
|
157 |
+
Question-answering
|
158 |
+
Retrieval Augmented Generation (RAG)
|
159 |
+
Code related tasks
|
160 |
+
Function-calling tasks
|
161 |
+
Multilingual dialog use cases
|
162 |
+
|
163 |
+
Generation: This is a simple example of how to use Granite-3.0-2B-Instruct model.
|
164 |
+
|
165 |
+
Install the following libraries:
|
166 |
+
|
167 |
+
pip install torch torchvision torchaudio
|
168 |
+
pip install accelerate
|
169 |
+
pip install transformers
|
170 |
+
|
171 |
+
Then, copy the snippet from the section that is relevant for your use case.
|
172 |
+
|
173 |
+
import torch
|
174 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
175 |
+
|
176 |
+
device = "auto"
|
177 |
+
model_path = "ibm-granite/granite-3.0-2b-instruct"
|
178 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
179 |
+
# drop device_map if running on CPU
|
180 |
+
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
|
181 |
+
model.eval()
|
182 |
+
# change input text as desired
|
183 |
+
chat = [
|
184 |
+
{ "role": "user", "content": "Please list one IBM Research laboratory located in the United States. You should only output its name and location." },
|
185 |
+
]
|
186 |
+
chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
|
187 |
+
# tokenize the text
|
188 |
+
input_tokens = tokenizer(chat, return_tensors="pt").to(device)
|
189 |
+
# generate output tokens
|
190 |
+
output = model.generate(**input_tokens,
|
191 |
+
max_new_tokens=100)
|
192 |
+
# decode output tokens into text
|
193 |
+
output = tokenizer.batch_decode(output)
|
194 |
+
# print output
|
195 |
+
print(output)
|
196 |
+
|
197 |
+
Model Architecture: Granite-3.0-2B-Instruct is based on a decoder-only dense transformer architecture. Core components of this architecture are: GQA and RoPE, MLP with SwiGLU, RMSNorm, and shared input/output embeddings.
|
198 |
+
Model 2B Dense 8B Dense 1B MoE 3B MoE
|
199 |
+
Embedding size 2048 4096 1024 1536
|
200 |
+
Number of layers 40 40 24 32
|
201 |
+
Attention head size 64 128 64 64
|
202 |
+
Number of attention heads 32 32 16 24
|
203 |
+
Number of KV heads 8 8 8 8
|
204 |
+
MLP hidden size 8192 12800 512 512
|
205 |
+
MLP activation SwiGLU SwiGLU SwiGLU SwiGLU
|
206 |
+
Number of Experts — — 32 40
|
207 |
+
MoE TopK — — 8 8
|
208 |
+
Initialization std 0.1 0.1 0.1 0.1
|
209 |
+
Sequence Length 4096 4096 4096 4096
|
210 |
+
Position Embedding RoPE RoPE RoPE RoPE
|
211 |
+
# Paremeters 2.5B 8.1B 1.3B 3.3B
|
212 |
+
# Active Parameters 2.5B 8.1B 400M 800M
|
213 |
+
# Training tokens 12T 12T 10T 10T
|
214 |
+
|
215 |
+
Training Data: Overall, our SFT data is largely comprised of three key sources: (1) publicly available datasets with permissive license, (2) internal synthetic data targeting specific capabilities, and (3) very small amounts of human-curated data. A detailed attribution of datasets can be found in the Granite Technical Report and Accompanying Author List.
|
216 |
+
|
217 |
+
Infrastructure: We train Granite 3.0 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 while minimizing environmental impact by utilizing 100% renewable energy sources.
|
218 |
+
|
219 |
+
Ethical Considerations and Limitations: Granite 3.0 Instruct Models are primarily finetuned using instruction-response pairs mostly in English, but also multilingual data covering eleven languages. Although this model can handle multilingual dialog use cases, its performance might not be similar to English tasks. In such case, introducing a small number of examples (few-shot) can help the model in generating more accurate outputs. While this model has been aligned by keeping safety in consideration, the model may in some cases produce inaccurate, biased, or unsafe responses to user prompts. So we urge the community to use this model with proper safety testing and tuning tailored for their specific tasks.
|
220 |
+
|
221 |
+
---
|
222 |
## Use with llama.cpp
|
223 |
Install llama.cpp through brew (works on Mac and Linux)
|
224 |
|