Commit
·
05c9a45
1
Parent(s):
0e40477
README.md
CHANGED
@@ -1,3 +1,52 @@
|
|
1 |
---
|
2 |
license: cc-by-sa-4.0
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: cc-by-sa-4.0
|
3 |
+
language:
|
4 |
+
- ja
|
5 |
---
|
6 |
+
|
7 |
+
# OpenCALM-7B - 8bit
|
8 |
+
|
9 |
+
8-bit quantized version of [OpenCALM-7B by CyberAgent](https://huggingface.co/cyberagent/open-calm-7b)
|
10 |
+
|
11 |
+
## Setup
|
12 |
+
|
13 |
+
```sh
|
14 |
+
pip install -q -U bitsandbytes
|
15 |
+
pip install -q -U git+https://github.com/huggingface/transformers.git
|
16 |
+
pip install -q -U git+https://github.com/huggingface/accelerate.git
|
17 |
+
```
|
18 |
+
|
19 |
+
## Usage
|
20 |
+
|
21 |
+
```python
|
22 |
+
import torch
|
23 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
24 |
+
|
25 |
+
MODEL_ID = "kyo-takano/open-calm-7b-8bit"
|
26 |
+
model = AutoModelForCausalLM.from_pretrained(MODEL_ID)
|
27 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
28 |
+
|
29 |
+
inputs = tokenizer("AIによって私達の暮らしは、", return_tensors="pt").to(model.device)
|
30 |
+
with torch.no_grad():
|
31 |
+
tokens = model.generate(
|
32 |
+
**inputs,
|
33 |
+
max_new_tokens=64,
|
34 |
+
do_sample=True,
|
35 |
+
temperature=0.7,
|
36 |
+
top_p=0.9,
|
37 |
+
repetition_penalty=1.05,
|
38 |
+
pad_token_id=tokenizer.pad_token_id,
|
39 |
+
)
|
40 |
+
|
41 |
+
output = tokenizer.decode(tokens[0], skip_special_tokens=True)
|
42 |
+
print(output)
|
43 |
+
```
|
44 |
+
|
45 |
+
## Model Details
|
46 |
+
|
47 |
+
Developed by: CyberAgent, Inc.
|
48 |
+
Quantized by: Kyo Takano
|
49 |
+
Model type: Transformer-based Language Model
|
50 |
+
Language: Japanese
|
51 |
+
Library: GPT-NeoX
|
52 |
+
License: OpenCALM is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA 4.0). When using this model, please provide appropriate credit to **CyberAgent, Inc.**
|