Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: text-generation
|
6 |
+
inference: false
|
7 |
+
tags:
|
8 |
+
- transformers
|
9 |
+
- gguf
|
10 |
+
- imatrix
|
11 |
+
- granite-3.0-8b-instruct
|
12 |
+
---
|
13 |
+
Quantizations of https://huggingface.co/ibm-granite/granite-3.0-8b-instruct
|
14 |
+
|
15 |
+
|
16 |
+
### Inference Clients/UIs
|
17 |
+
* [llama.cpp](https://github.com/ggerganov/llama.cpp)
|
18 |
+
* [KoboldCPP](https://github.com/LostRuins/koboldcpp)
|
19 |
+
* [ollama](https://github.com/ollama/ollama)
|
20 |
+
* [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
21 |
+
* [GPT4All](https://github.com/nomic-ai/gpt4all)
|
22 |
+
* [jan](https://github.com/janhq/jan)
|
23 |
+
---
|
24 |
+
|
25 |
+
# From original readme
|
26 |
+
|
27 |
+
**Model Summary:**
|
28 |
+
Granite-3.0-8B-Instruct is a 8B parameter model finetuned from *Granite-3.0-8B-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.
|
29 |
+
|
30 |
+
- **Developers:** Granite Team, IBM
|
31 |
+
- **GitHub Repository:** [ibm-granite/granite-3.0-language-models](https://github.com/ibm-granite/granite-3.0-language-models)
|
32 |
+
- **Website**: [Granite Docs](https://www.ibm.com/granite/docs/)
|
33 |
+
- **Paper:** [Granite 3.0 Language Models](https://github.com/ibm-granite/granite-3.0-language-models/blob/main/paper.pdf)
|
34 |
+
- **Release Date**: October 21st, 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.0 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 |
+
|
53 |
+
**Generation:**
|
54 |
+
This is a simple example of how to use Granite-3.0-8B-Instruct model.
|
55 |
+
|
56 |
+
Install the following libraries:
|
57 |
+
|
58 |
+
```shell
|
59 |
+
pip install torch torchvision torchaudio
|
60 |
+
pip install accelerate
|
61 |
+
pip install transformers
|
62 |
+
```
|
63 |
+
Then, copy the snippet from the section that is relevant for your use case.
|
64 |
+
|
65 |
+
```python
|
66 |
+
import torch
|
67 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
68 |
+
|
69 |
+
device = "auto"
|
70 |
+
model_path = "ibm-granite/granite-3.0-8b-instruct"
|
71 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
72 |
+
# drop device_map if running on CPU
|
73 |
+
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
|
74 |
+
model.eval()
|
75 |
+
# change input text as desired
|
76 |
+
chat = [
|
77 |
+
{ "role": "user", "content": "Please list one IBM Research laboratory located in the United States. You should only output its name and location." },
|
78 |
+
]
|
79 |
+
chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
|
80 |
+
# tokenize the text
|
81 |
+
input_tokens = tokenizer(chat, return_tensors="pt").to(device)
|
82 |
+
# generate output tokens
|
83 |
+
output = model.generate(**input_tokens,
|
84 |
+
max_new_tokens=100)
|
85 |
+
# decode output tokens into text
|
86 |
+
output = tokenizer.batch_decode(output)
|
87 |
+
# print output
|
88 |
+
print(output)
|
89 |
+
```
|