aashish1904 commited on
Commit
f51f937
•
1 Parent(s): d8da8ff

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +132 -0
README.md ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+
4
+ pipeline_tag: text-generation
5
+ inference: false
6
+ license: apache-2.0
7
+ library_name: transformers
8
+ tags:
9
+ - language
10
+ - granite-3.1
11
+ base_model:
12
+ - ibm-granite/granite-3.1-2b-base
13
+
14
+ ---
15
+
16
+ [![QuantFactory Banner](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)](https://hf.co/QuantFactory)
17
+
18
+
19
+ # QuantFactory/granite-3.1-2b-instruct-GGUF
20
+ This is quantized version of [ibm-granite/granite-3.1-2b-instruct](https://huggingface.co/ibm-granite/granite-3.1-2b-instruct) created using llama.cpp
21
+
22
+ # Original Model Card
23
+
24
+
25
+ # Granite-3.1-2B-Instruct
26
+
27
+ **Model Summary:**
28
+ Granite-3.1-2B-Instruct is a 2B parameter long-context instruct model finetuned from Granite-3.1-2B-Base using a combination of open source instruction datasets with permissive license and internally collected synthetic datasets tailored for solving long context problems. 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.
29
+
30
+ - **Developers:** Granite Team, IBM
31
+ - **GitHub Repository:** [ibm-granite/granite-3.1-language-models](https://github.com/ibm-granite/granite-3.1-language-models)
32
+ - **Website**: [Granite Docs](https://www.ibm.com/granite/docs/)
33
+ - **Paper:** [Granite 3.1 Language Models (coming soon)](https://huggingface.co/collections/ibm-granite/granite-31-language-models-6751dbbf2f3389bec5c6f02d)
34
+ - **Release Date**: December 18th, 2024
35
+ - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
36
+
37
+ **Supported Languages:**
38
+ 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.
39
+
40
+ **Intended Use:**
41
+ The model is designed to respond to general instructions and can be used to build AI assistants for multiple domains, including business applications.
42
+
43
+ *Capabilities*
44
+ * Summarization
45
+ * Text classification
46
+ * Text extraction
47
+ * Question-answering
48
+ * Retrieval Augmented Generation (RAG)
49
+ * Code related tasks
50
+ * Function-calling tasks
51
+ * Multilingual dialog use cases
52
+ * Long-context tasks including long document/meeting summarization, long document QA, etc.
53
+
54
+ **Generation:**
55
+ This is a simple example of how to use Granite-3.1-2B-Instruct model.
56
+
57
+ Install the following libraries:
58
+
59
+ ```shell
60
+ pip install torch torchvision torchaudio
61
+ pip install accelerate
62
+ pip install transformers
63
+ ```
64
+ Then, copy the snippet from the section that is relevant for your use case.
65
+
66
+ ```python
67
+ import torch
68
+ from transformers import AutoModelForCausalLM, AutoTokenizer
69
+
70
+ device = "auto"
71
+ model_path = "ibm-granite/granite-3.1-2b-instruct"
72
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
73
+ # drop device_map if running on CPU
74
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
75
+ model.eval()
76
+ # change input text as desired
77
+ chat = [
78
+ { "role": "user", "content": "Please list one IBM Research laboratory located in the United States. You should only output its name and location." },
79
+ ]
80
+ chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
81
+ # tokenize the text
82
+ input_tokens = tokenizer(chat, return_tensors="pt").to(device)
83
+ # generate output tokens
84
+ output = model.generate(**input_tokens,
85
+ max_new_tokens=100)
86
+ # decode output tokens into text
87
+ output = tokenizer.batch_decode(output)
88
+ # print output
89
+ print(output)
90
+ ```
91
+
92
+ **Model Architecture:**
93
+ Granite-3.1-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.
94
+
95
+ | Model | 2B Dense | 8B Dense | 1B MoE | 3B MoE |
96
+ | :-------- | :--------| :-------- | :------| :------|
97
+ | Embedding size | **2048** | 4096 | 1024 | 1536 |
98
+ | Number of layers | **40** | 40 | 24 | 32 |
99
+ | Attention head size | **64** | 128 | 64 | 64 |
100
+ | Number of attention heads | **32** | 32 | 16 | 24 |
101
+ | Number of KV heads | **8** | 8 | 8 | 8 |
102
+ | MLP hidden size | **8192** | 12800 | 512 | 512 |
103
+ | MLP activation | **SwiGLU** | SwiGLU | SwiGLU | SwiGLU |
104
+ | Number of experts | **—** | — | 32 | 40 |
105
+ | MoE TopK | **—** | — | 8 | 8 |
106
+ | Initialization std | **0.1** | 0.1 | 0.1 | 0.1 |
107
+ | Sequence length | **128K** | 128K | 128K | 128K |
108
+ | Position embedding | **RoPE** | RoPE | RoPE | RoPE |
109
+ | # Parameters | **2.5B** | 8.1B | 1.3B | 3.3B |
110
+ | # Active parameters | **2.5B** | 8.1B | 400M | 800M |
111
+ | # Training tokens | **12T** | 12T | 10T | 10T |
112
+
113
+ **Training Data:**
114
+ 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 including long-context tasks, and (3) very small amounts of human-curated data. 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).
115
+
116
+ **Infrastructure:**
117
+ 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.
118
+
119
+ **Ethical Considerations and Limitations:**
120
+ Granite 3.1 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.
121
+
122
+ <!-- ## Citation
123
+ ```
124
+ @misc{granite-models,
125
+ author = {author 1, author2, ...},
126
+ title = {},
127
+ journal = {},
128
+ volume = {},
129
+ year = {2024},
130
+ url = {https://arxiv.org/abs/0000.00000},
131
+ }
132
+ ``` -->