Adding model card
Browse files
README.md
CHANGED
@@ -1,3 +1,197 @@
|
|
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.2
|
9 |
+
base_model:
|
10 |
+
- ibm-granite/granite-3.1-8b-instruct
|
11 |
+
---
|
12 |
+
|
13 |
+
# Granite-3.2-8B-Instruct-Preview
|
14 |
+
|
15 |
+
**Model Summary:**
|
16 |
+
Granite-3.2-8B-Instruct-Preview is an early release of an 8B long-context model fine-tuned for enhanced reasoning (thinking) capabilities. Built on top of [Granite-3.1-8B-Instruct](https://huggingface.co/ibm-granite/granite-3.1-8b-instruct), it has been trained using a mix of permissively licensed open-source datasets and internally generated synthetic data designed for reasoning tasks. The model allows controllability of its thinking capability, ensuring it is applied only when required.
|
17 |
+
|
18 |
+
<!-- is preview release of a finetuned mdpeis a 8B parameter long-context instruct model finetuned from Granite-3.1-8B-Instruct 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 finetuned to reason
|
19 |
+
|
20 |
+
developed using a diverse set of techniques with a structured chat format, including supervised finetuning, model alignment using reinforcement learning, and model merging. -->
|
21 |
+
|
22 |
+
- **Developers:** Granite Team, IBM
|
23 |
+
- **Website**: [Granite Docs](https://www.ibm.com/granite/docs/)
|
24 |
+
- **Release Date**: February 7th, 2025
|
25 |
+
- **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
26 |
+
|
27 |
+
**Supported Languages:**
|
28 |
+
English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, and Chinese. However, users may finetune this Granite model for languages beyond these 12 languages.
|
29 |
+
|
30 |
+
**Intended Use:**
|
31 |
+
The model is designed to respond to general instructions and can be used to build AI assistants for multiple domains, including business applications.
|
32 |
+
|
33 |
+
*Capabilities*
|
34 |
+
* **Thinking**
|
35 |
+
* Summarization
|
36 |
+
* Text classification
|
37 |
+
* Text extraction
|
38 |
+
* Question-answering
|
39 |
+
* Retrieval Augmented Generation (RAG)
|
40 |
+
* Code related tasks
|
41 |
+
* Function-calling tasks
|
42 |
+
* Multilingual dialog use cases
|
43 |
+
* Long-context tasks including long document/meeting summarization, long document QA, etc.
|
44 |
+
|
45 |
+
**Generation:**
|
46 |
+
This is a simple example of how to use Granite-3.2-8B-Instruct-Preview model.
|
47 |
+
|
48 |
+
Install the following libraries:
|
49 |
+
|
50 |
+
```shell
|
51 |
+
pip install torch torchvision torchaudio
|
52 |
+
pip install accelerate
|
53 |
+
pip install transformers
|
54 |
+
```
|
55 |
+
Then, copy the snippet from the section that is relevant for your use case.
|
56 |
+
|
57 |
+
```python
|
58 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, set_seed
|
59 |
+
import torch
|
60 |
+
|
61 |
+
model_path="ibm-granite/granite-3.2-8b-instruct-preview"
|
62 |
+
device="cuda"
|
63 |
+
model = AutoModelForCausalLM.from_pretrained(
|
64 |
+
model_path,
|
65 |
+
device_map=device,
|
66 |
+
torch_dtype=torch.bfloat16,
|
67 |
+
)
|
68 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
69 |
+
model_path
|
70 |
+
)
|
71 |
+
|
72 |
+
conv = [{"role": "user", "content":"How do I develop a skill?"}]
|
73 |
+
|
74 |
+
input_ids = tokenizer.apply_chat_template(conv, return_tensors="pt", thinking=True, return_dict=True, add_generation_prompt=True).to(device)
|
75 |
+
|
76 |
+
set_seed(42)
|
77 |
+
output = model.generate(
|
78 |
+
**input_ids,
|
79 |
+
max_new_tokens=8192,
|
80 |
+
)
|
81 |
+
|
82 |
+
prediction = tokenizer.decode(output[0, input_ids["input_ids"].shape[1]:], skip_special_tokens=True)
|
83 |
+
print(prediction)
|
84 |
+
```
|
85 |
+
|
86 |
+
**Example Outputs**
|
87 |
+
- thinking=True
|
88 |
+
```bash
|
89 |
+
Here is my thought process:
|
90 |
+
|
91 |
+
1. Understand the user's intent: The user is seeking guidance on how to develop a new skill.
|
92 |
+
2. Break down the process: Skills development involves several stages - identification, planning, practice, feedback, and refinement.
|
93 |
+
3. Consider different aspects: Discuss various methods, mindset, and resources needed for effective skill acquisition.
|
94 |
+
4. Provide actionable steps: Offer a structured approach that the user can follow.
|
95 |
+
|
96 |
+
Here is my response:
|
97 |
+
|
98 |
+
Developing a new skill is a systematic process that involves several key steps and a dedicated mindset. Here's a comprehensive guide to help you effectively cultivate a new skill:
|
99 |
+
|
100 |
+
### 1. **Identify the Skill**
|
101 |
+
- **Clarity of Purpose**: Clearly define what skill you want to acquire. Be specific about why you want this skill and how it aligns with your goals or interests.
|
102 |
+
- **Research**: Understand the basics of the skill. Read about it, watch tutorials, or talk to people who are already proficient. This initial research will give you a realistic understanding of what the skill entails.
|
103 |
+
|
104 |
+
### 2. **Set Clear Goals**
|
105 |
+
- **SMART Goals**: Make sure your goals are Specific, Measurable, Achievable, Relevant, and Time-bound. For example, instead of saying "I want to learn programming," set a goal like "I will complete a beginner's Python course within three months."
|
106 |
+
- **Break Down**: If the skill is complex, break it down into smaller, manageable milestones.
|
107 |
+
|
108 |
+
### 3. **Create a Learning Plan**
|
109 |
+
- **Resources**: Identify the best resources for learning. These could be online courses, books, mentors, workshops, or practical projects.
|
110 |
+
- **Schedule**: Dedicate time in your routine for skill practice. Consistency is crucial in skill development. Treat your learning time as non-negotiable.
|
111 |
+
|
112 |
+
### 4. **Start with the Basics**
|
113 |
+
- **Foundational Knowledge**: Begin by grasping the fundamentals. Understanding the basics thoroughly sets a strong foundation for more advanced learning.
|
114 |
+
- **Practice Regularly**: Regular, focused practice is essential. Even 15-30 minutes a day can yield significant results over time.
|
115 |
+
|
116 |
+
### 5. **Seek Feedback and Guidance**
|
117 |
+
- **Mentorship**: If possible, find a mentor or join a community of learners. Feedback from experienced individuals can accelerate your learning curve.
|
118 |
+
- **Peer Learning**: Engage with others learning the same skill. Peer groups provide support, motivation, and different perspectives.
|
119 |
+
|
120 |
+
### 6. **Apply the Skill in Real-World Scenarios**
|
121 |
+
- **Practical Application**: Look for opportunities to apply what you've learned. This could be through projects, internships, or volunteering. Practical application solidifies your understanding and builds confidence.
|
122 |
+
- **Iterate Based on Feedback**: After applying your skill, seek and incorporate feedback to refine and improve.
|
123 |
+
|
124 |
+
### 7. **Maintain a Growth Mindset**
|
125 |
+
- **Embrace Challenges**: Understand that setbacks and failures are part of the learning process. Maintain a positive attitude and view them as opportunities to learn.
|
126 |
+
- **Patience and Persistence**: Skill development takes time. Stay patient and persistent, even when progress seems slow.
|
127 |
+
|
128 |
+
### 8. **Track and Reflect**
|
129 |
+
- **Progress Tracking**: Regularly review your progress. This could be through keeping a learning journal or using apps designed for skill tracking.
|
130 |
+
- **Reflect and Adjust**: Periodically reflect on your learning process. What's working? What's not? Adjust your plan accordingly.
|
131 |
+
|
132 |
+
### 9. **Stay Motivated**
|
133 |
+
- **Reward System**: Set small rewards for achieving milestones to keep yourself motivated.
|
134 |
+
- **Stay Curious**: Keep your interest piqued by exploring related topics or advanced aspects of the skill.
|
135 |
+
|
136 |
+
By following these steps and maintaining a disciplined, growth-oriented approach, you can effectively develop any new skill. Remember, the key is consistent effort and a willingness to learn from both successes and failures.
|
137 |
+
|
138 |
+
Building skills is an ongoing journey, not a destination.
|
139 |
+
```
|
140 |
+
- thinking=False
|
141 |
+
```bash
|
142 |
+
Developing a skill involves a combination of learning, practice, and often, feedback. Here's a step-by-step guide to help you develop a new skill:
|
143 |
+
|
144 |
+
1. **Identify the Skill**: Start by clearly defining what skill you want to develop. Be specific. Instead of saying "I want to learn to code," specify a programming language like Python or JavaScript.
|
145 |
+
|
146 |
+
2. **Research**: Learn about the basics of the skill. Read books, articles, watch tutorials, or take online courses. Websites like Coursera, Udemy, Khan Academy, and YouTube can be great resources.
|
147 |
+
|
148 |
+
3. **Set Clear Goals**: Break down your skill into smaller, manageable goals. For example, if you're learning a new language, your goals might be to learn basic grammar, build a simple sentence, have a basic conversation, etc.
|
149 |
+
|
150 |
+
4. **Create a Study Plan**: Allocate specific time each day or week for learning and practicing. Consistency is key in skill development.
|
151 |
+
|
152 |
+
5. **Practice**: Apply what you've learned. Practice makes permanent. If you're learning to code, write small programs. If it's a musical instrument, play regularly.
|
153 |
+
|
154 |
+
6. **Get Feedback**: Seek feedback from others who are more experienced. This could be a mentor, a tutor, or even online communities. Constructive criticism can help you identify areas for improvement.
|
155 |
+
|
156 |
+
7. **Review and Refine**: Regularly review what you've learned. Refine your skills based on feedback and your own observations.
|
157 |
+
|
158 |
+
8. **Apply in Real Life**: Try to use your new skill in real-life situations. This could be a project at work, a personal hobby, or volunteering.
|
159 |
+
|
160 |
+
9. **Be Patient and Persistent**: Skill development takes time. Don't get discouraged by slow progress or setbacks. Keep practicing and learning.
|
161 |
+
|
162 |
+
10. **Stay Motivated**: Keep your end goal in mind and celebrate small victories along the way to stay motivated.
|
163 |
+
|
164 |
+
Remember, everyone learns at their own pace, so don't compare your progress with others. The most important thing is that you're consistently moving forward.
|
165 |
+
```
|
166 |
+
<!-- **Evaluation Results:**
|
167 |
+
<TODO>
|
168 |
+
Add the figures.
|
169 |
+
</TODO> -->
|
170 |
+
|
171 |
+
**Training Data:**
|
172 |
+
Overall, our training data is largely comprised of two key sources: (1) publicly available datasets with permissive license, (2) internal synthetically generated data targeted to enhance reasoning capabilites.
|
173 |
+
<!-- A detailed attribution of datasets can be found in [Granite 3.2 Technical Report (coming soon)](#), and [Accompanying Author List](https://github.com/ibm-granite/granite-3.0-language-models/blob/main/author-ack.pdf). -->
|
174 |
+
|
175 |
+
**Infrastructure:**
|
176 |
+
We train Granite-3.2-8B-Instruct-Preview 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.
|
177 |
+
|
178 |
+
**Ethical Considerations and Limitations:**
|
179 |
+
Granite-3.2-8B-Instruct-Preview builds upon Granite-3.1-8B-Instruct, leveraging both permissively licensed open-source and select proprietary data for enhanced performance. Since it inherits its foundation from the previous model, all ethical considerations and limitations applicable to [Granite-3.1-8B-Instruct](https://huggingface.co/ibm-granite/granite-3.1-8b-instruct) remain relevant.
|
180 |
+
|
181 |
+
|
182 |
+
**Resources**
|
183 |
+
- ⭐️ Learn about the latest updates with Granite: https://www.ibm.com/granite
|
184 |
+
- 📄 Get started with tutorials, best practices, and prompt engineering advice: https://www.ibm.com/granite/docs/
|
185 |
+
- 💡 Learn about the latest Granite learning resources: https://ibm.biz/granite-learning-resources
|
186 |
+
|
187 |
+
<!-- ## Citation
|
188 |
+
```
|
189 |
+
@misc{granite-models,
|
190 |
+
author = {author 1, author2, ...},
|
191 |
+
title = {},
|
192 |
+
journal = {},
|
193 |
+
volume = {},
|
194 |
+
year = {2024},
|
195 |
+
url = {https://arxiv.org/abs/0000.00000},
|
196 |
+
}
|
197 |
+
``` -->
|