Triangle104 commited on
Commit
1ed61fe
·
verified ·
1 Parent(s): ac839a9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +171 -0
README.md CHANGED
@@ -15,6 +15,177 @@ base_model: ibm-granite/granite-3.2-2b-instruct
15
  This model was converted to GGUF format from [`ibm-granite/granite-3.2-2b-instruct`](https://huggingface.co/ibm-granite/granite-3.2-2b-instruct) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
16
  Refer to the [original model card](https://huggingface.co/ibm-granite/granite-3.2-2b-instruct) for more details on the model.
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  ## Use with llama.cpp
19
  Install llama.cpp through brew (works on Mac and Linux)
20
 
 
15
  This model was converted to GGUF format from [`ibm-granite/granite-3.2-2b-instruct`](https://huggingface.co/ibm-granite/granite-3.2-2b-instruct) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
16
  Refer to the [original model card](https://huggingface.co/ibm-granite/granite-3.2-2b-instruct) for more details on the model.
17
 
18
+ ---
19
+ Model Summary:
20
+ -
21
+ Granite-3.2-2B-Instruct is an 2-billion-parameter, long-context AI model fine-tuned for thinking capabilities. Built on top of Granite-3.1-2B-Instruct,
22
+ it has been trained using a mix of permissively licensed open-source
23
+ datasets and internally generated synthetic data designed for reasoning
24
+ tasks. The model allows controllability of its thinking capability,
25
+ ensuring it is applied only when required.
26
+
27
+
28
+ Developers: Granite Team, IBM
29
+ Website: Granite Docs
30
+ Release Date: February 26th, 2025
31
+ License: Apache 2.0
32
+
33
+
34
+ Supported Languages:
35
+ -
36
+ English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech,
37
+ Italian, Korean, Dutch, and Chinese. However, users may finetune this
38
+ Granite model for languages beyond these 12 languages.
39
+
40
+
41
+ Intended Use:
42
+ -
43
+ This model is designed to handle general instruction-following tasks and
44
+ can be integrated into AI assistants across various domains, including
45
+ business applications.
46
+
47
+
48
+ Capabilities
49
+ -
50
+ Thinking
51
+ Summarization
52
+ Text classification
53
+ Text extraction
54
+ Question-answering
55
+ Retrieval Augmented Generation (RAG)
56
+ Code related tasks
57
+ Function-calling tasks
58
+ Multilingual dialog use cases
59
+ Long-context tasks including long document/meeting summarization, long document QA, etc.
60
+
61
+
62
+ Generation:
63
+ -
64
+ This is a simple example of how to use Granite-3.2-2B-Instruct model.
65
+
66
+
67
+ Install the following libraries:
68
+ -
69
+
70
+ pip install torch torchvision torchaudio
71
+ pip install accelerate
72
+ pip install transformers
73
+
74
+ Then, copy the snippet from the section that is relevant for your use case.
75
+
76
+
77
+ from transformers import AutoModelForCausalLM, AutoTokenizer, set_seed
78
+ import torch
79
+
80
+ model_path="ibm-granite/granite-3.2-2b-instruct"
81
+ device="cuda"
82
+ model = AutoModelForCausalLM.from_pretrained(
83
+ model_path,
84
+ device_map=device,
85
+ torch_dtype=torch.bfloat16,
86
+ )
87
+ tokenizer = AutoTokenizer.from_pretrained(
88
+ model_path
89
+ )
90
+
91
+ conv = [{"role": "user", "content":"You have 10 liters of a 30% acid solution. How many liters of a 70% acid solution must be added to achieve a 50% acid mixture?"}]
92
+
93
+ input_ids = tokenizer.apply_chat_template(conv, return_tensors="pt", thinking=True, return_dict=True, add_generation_prompt=True).to(device)
94
+
95
+ set_seed(42)
96
+ output = model.generate(
97
+ **input_ids,
98
+ max_new_tokens=8192,
99
+ )
100
+
101
+ prediction = tokenizer.decode(output[0, input_ids["input_ids"].shape[1]:], skip_special_tokens=True)
102
+ print(prediction)
103
+
104
+ Example Outputs
105
+
106
+
107
+ thinking=True
108
+
109
+
110
+ Here is my thought process:
111
+
112
+ 1. First, let's understand the composition of the initial 10 liters of 30% acid solution:
113
+ - Acid content = 30% of 10 liters = 0.30 * 10 = 3 liters
114
+
115
+ 2. We want to end up with a 50% acid solution. Let's denote the volume of the 70% acid solution to be added as 'x' liters.
116
+
117
+ 3. The amount of acid in the final mixture (50% solution) should equal the initial acid content plus the acid from the added 70% solution.
118
+ - Total acid in final mixture = 0.50 * (10 + x)
119
+
120
+ 4. The equation representing the total acid content is:
121
+ 3 (from initial solution) + 0.70 * x (from added solution) = 0.50 * (10 + x)
122
+
123
+ 5. Now, we solve for 'x':
124
+ 3 + 0.70x = 5 + 0.50x
125
+ 0.70x - 0.50x = 5 - 3
126
+ 0.20x = 2
127
+ x = 2 / 0.20
128
+ x = 10 liters
129
+
130
+ 6. Therefore, 10 liters of a 70% acid solution must be added to the initial 10 liters of 30% acid solution to achieve a 50% acid mixture.
131
+
132
+ Here is my response:
133
+
134
+ To solve this problem, we need to determine how much of a 70% acid solution must be added to a 10-liter solution that is already 30% acid to create a new mixture that is 50% acid. Here's how to calculate it:
135
+
136
+ 1. **Initial Acid Content**:
137
+ - The initial 10-liter solution contains 3 liters of acid (since 30% of 10 liters).
138
+
139
+ 2. **Desired Final Acid Content**:
140
+ - We want the final mixture to be 50% acid.
141
+
142
+ 3. **Equation Setup**:
143
+ - Let 'x' be the volume (in liters) of the 70% acid solution to be added.
144
+ - The equation representing the total acid content in the final mixture (which is 10 liters from the initial solution plus 'x' liters of the added solution) should equal 50% of the total volume (10 + x).
145
+ - This gives us: 3 (acid from initial solution) + 0.70x (acid from added solution) = 0.50(10 + x)
146
+
147
+ 4. **Solving the Equation**:
148
+ - First, simplify the right side of the equation: 0.50(10 + x) = 5 + 0.50x
149
+ - Now, the equation is: 3 + 0.70x = 5 + 0.50x
150
+ - Subtract 0.50x from both sides: 0.20x = 2
151
+ - Divide both sides by 0.20: x = 2 / 0.20
152
+ - x = 10 liters
153
+
154
+ 5. **Conclusion**:
155
+ - To achieve a 50% acid mixture from the initial 30% solution, you need to add 10 liters of a 70% acid solution.
156
+
157
+ So, the final answer is that 10 liters of a 70% acid solution must be added to the initial 10 liters of 30% acid solution.
158
+
159
+ thinking=False
160
+
161
+ To solve this problem, we'll use the concept of volume and concentration. Let's denote the amount of 70% acid solution we need to add as "x" liters.
162
+
163
+ First, let's find out how much acid is in the initial 10-liter solution:
164
+
165
+ Acid in initial solution = 30% of 10 liters = 0.30 * 10 = 3 liters
166
+
167
+ Now, we want to end up with a 50% acid solution in a total volume of (10 + x) liters. Let's denote the final volume as V.
168
+
169
+ Final acid concentration = 50%
170
+ Final acid amount = 50% of V = 0.50 * V
171
+
172
+ We know the initial acid amount and the final acid amount, so we can set up an equation:
173
+
174
+ Initial acid amount + Acid from added solution = Final acid amount
175
+ 3 liters + (70% of x) = 0.50 * (10 + x)
176
+
177
+ Now, let's solve for x:
178
+
179
+ 0.70x + 3 = 0.50 * 10 + 0.50x
180
+ 0.70x - 0.50x = 0.50 * 10 - 3
181
+ 0.20x = 5 - 3
182
+ 0.20x = 2
183
+ x = 2 / 0.20
184
+ x = 10 liters
185
+
186
+ So, you need to add 10 liters of a 70% acid solution to the initial 10-liter 30% acid solution to achieve a 50% acid mixture.
187
+
188
+ ---
189
  ## Use with llama.cpp
190
  Install llama.cpp through brew (works on Mac and Linux)
191