Triangle104
commited on
Commit
•
4363d65
1
Parent(s):
679642c
Update README.md
Browse files
README.md
CHANGED
@@ -13,6 +13,82 @@ base_model: ibm-granite/granite-3.1-2b-base
|
|
13 |
This model was converted to GGUF format from [`ibm-granite/granite-3.1-2b-base`](https://huggingface.co/ibm-granite/granite-3.1-2b-base) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
|
14 |
Refer to the [original model card](https://huggingface.co/ibm-granite/granite-3.1-2b-base) for more details on the model.
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
## Use with llama.cpp
|
17 |
Install llama.cpp through brew (works on Mac and Linux)
|
18 |
|
|
|
13 |
This model was converted to GGUF format from [`ibm-granite/granite-3.1-2b-base`](https://huggingface.co/ibm-granite/granite-3.1-2b-base) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
|
14 |
Refer to the [original model card](https://huggingface.co/ibm-granite/granite-3.1-2b-base) for more details on the model.
|
15 |
|
16 |
+
---
|
17 |
+
Model details:
|
18 |
+
-
|
19 |
+
Granite-3.1-2B-Base extends the context length of Granite-3.0-2B-Base
|
20 |
+
from 4K to 128K using a progressive training strategy by increasing the
|
21 |
+
supported context length in increments while adjusting RoPE theta until
|
22 |
+
the model has successfully adapted to desired length of 128K. This
|
23 |
+
long-context pre-training stage was performed using approximately 500B
|
24 |
+
tokens.
|
25 |
+
|
26 |
+
Developers: Granite Team, IBM
|
27 |
+
GitHub Repository: ibm-granite/granite-3.1-language-models
|
28 |
+
Website: Granite Docs
|
29 |
+
Paper: Granite 3.1 Language Models (coming soon)
|
30 |
+
Release Date: December 18th, 2024
|
31 |
+
License: Apache 2.0
|
32 |
+
|
33 |
+
|
34 |
+
Supported Languages:
|
35 |
+
English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech,
|
36 |
+
Italian, Korean, Dutch, and Chinese. Users may finetune Granite 3.1
|
37 |
+
models for languages beyond these 12 languages.
|
38 |
+
|
39 |
+
|
40 |
+
Intended Use:
|
41 |
+
Prominent use cases of LLMs in text-to-text generation include
|
42 |
+
summarization, text classification, extraction, question-answering, and
|
43 |
+
other long-context tasks. All Granite Base models are able to handle
|
44 |
+
these tasks as they were trained on a large amount of data from various
|
45 |
+
domains. Moreover, they can serve as baseline to create specialized
|
46 |
+
models for specific application scenarios.
|
47 |
+
|
48 |
+
|
49 |
+
Generation:
|
50 |
+
This is a simple example of how to use Granite-3.1-2B-Base model.
|
51 |
+
|
52 |
+
|
53 |
+
Install the following libraries:
|
54 |
+
|
55 |
+
|
56 |
+
pip install torch torchvision torchaudio
|
57 |
+
pip install accelerate
|
58 |
+
pip install transformers
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
Then, copy the code snippet below to run the example.
|
63 |
+
|
64 |
+
|
65 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
66 |
+
device = "auto"
|
67 |
+
model_path = "ibm-granite/granite-3.1-2b-base"
|
68 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
69 |
+
# drop device_map if running on CPU
|
70 |
+
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
|
71 |
+
model.eval()
|
72 |
+
# change input text as desired
|
73 |
+
input_text = "Where is the Thomas J. Watson Research Center located?"
|
74 |
+
# tokenize the text
|
75 |
+
input_tokens = tokenizer(input_text, return_tensors="pt").to(device)
|
76 |
+
# generate output tokens
|
77 |
+
output = model.generate(**input_tokens,
|
78 |
+
max_length=4000)
|
79 |
+
# decode output tokens into text
|
80 |
+
output = tokenizer.batch_decode(output)
|
81 |
+
# print output
|
82 |
+
print(output)
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
Model Architecture:
|
87 |
+
Granite-3.1-2B-Base is based on a decoder-only dense transformer
|
88 |
+
architecture. Core components of this architecture are: GQA and RoPE,
|
89 |
+
MLP with SwiGLU, RMSNorm, and shared input/output embeddings.
|
90 |
+
|
91 |
+
---
|
92 |
## Use with llama.cpp
|
93 |
Install llama.cpp through brew (works on Mac and Linux)
|
94 |
|