AkimfromParis
commited on
Commit
•
6f22c3e
1
Parent(s):
81a593c
Usage for HuggingFace
Browse files
README.md
CHANGED
@@ -12,13 +12,13 @@ base_model:
|
|
12 |
- stabilityai/japanese-stablelm-base-gamma-7b
|
13 |
---
|
14 |
|
15 |
-
# Hinoki-Sak-Sta-slerp-7B
|
16 |
|
17 |
Hinoki-Sak-Sta-slerp-7B is a merge of the following models using the [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing) of [Maxime Labonne](https://huggingface.co/mlabonne) powered by [MergeKit](https://github.com/arcee-ai/mergekit) of [Arcee AI](https://www.arcee.ai):
|
18 |
* [SakanaAI/EvoLLM-JP-A-v1-7B](https://huggingface.co/SakanaAI/EvoLLM-JP-A-v1-7B) (Base model)
|
19 |
* [stabilityai/japanese-stablelm-base-gamma-7b](https://huggingface.co/stabilityai/japanese-stablelm-base-gamma-7b)
|
20 |
|
21 |
-
##
|
22 |
|
23 |
```yaml
|
24 |
slices:
|
@@ -39,40 +39,30 @@ parameters:
|
|
39 |
dtype: bfloat16
|
40 |
```
|
41 |
|
42 |
-
##
|
43 |
|
44 |
```python
|
45 |
-
from transformers import
|
|
|
|
|
46 |
|
47 |
-
|
48 |
-
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
49 |
-
model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype="auto", device_map="auto")
|
50 |
-
model.eval()
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
]
|
55 |
|
56 |
-
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
max_new_tokens=1024,
|
64 |
-
do_sample=True,
|
65 |
-
pad_token_id=tokenizer.eos_token_id,
|
66 |
-
)
|
67 |
-
out = tokenizer.decode(tokens[0][len(input_ids[0]):], skip_special_tokens=True)
|
68 |
-
print("USER:\n" + req)
|
69 |
-
print("ASSISTANT:\n" + out)
|
70 |
-
print()
|
71 |
```
|
72 |
|
73 |
-
# Citation
|
74 |
```
|
75 |
-
@
|
76 |
title={Arcee's MergeKit: A Toolkit for Merging Large Language Models},
|
77 |
author={Goddard, Charles and Siriwardhana, Shamane and Ehghaghi, Malikeh and Meyers, Luke and Karpukhin, Vlad and Benedict, Brian and McQuade, Mark and Solawetz, Jacob},
|
78 |
journal={arXiv preprint arXiv:2403.13257},
|
|
|
12 |
- stabilityai/japanese-stablelm-base-gamma-7b
|
13 |
---
|
14 |
|
15 |
+
# 🌲 Hinoki-Sak-Sta-slerp-7B
|
16 |
|
17 |
Hinoki-Sak-Sta-slerp-7B is a merge of the following models using the [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing) of [Maxime Labonne](https://huggingface.co/mlabonne) powered by [MergeKit](https://github.com/arcee-ai/mergekit) of [Arcee AI](https://www.arcee.ai):
|
18 |
* [SakanaAI/EvoLLM-JP-A-v1-7B](https://huggingface.co/SakanaAI/EvoLLM-JP-A-v1-7B) (Base model)
|
19 |
* [stabilityai/japanese-stablelm-base-gamma-7b](https://huggingface.co/stabilityai/japanese-stablelm-base-gamma-7b)
|
20 |
|
21 |
+
## 💻 Configuration
|
22 |
|
23 |
```yaml
|
24 |
slices:
|
|
|
39 |
dtype: bfloat16
|
40 |
```
|
41 |
|
42 |
+
## 🤗 Usage for HuggingFace
|
43 |
|
44 |
```python
|
45 |
+
from transformers import LlamaTokenizerFast, AutoModelForCausalLM
|
46 |
+
from transformers import pipeline
|
47 |
+
import torch
|
48 |
|
49 |
+
model_name = "AkimfromParis/Hinoki-Sak-Sta-slerp-7B"
|
|
|
|
|
|
|
50 |
|
51 |
+
tokenizer = LlamaTokenizerFast.from_pretrained(model_name)
|
52 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16)
|
|
|
53 |
|
54 |
+
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, pad_token_id=tokenizer.eos_token_id)
|
55 |
|
56 |
+
messages = [
|
57 |
+
{"role": "system", "content": "あなたは誠実で優秀な日本人のアシスタントです。以下のトピックに関する詳細な情報を提供してください。"},
|
58 |
+
{"role": "user", "content": "大谷翔平選手は誰ですか?"},
|
59 |
+
]
|
60 |
+
print(pipe(messages, max_new_tokens=512)[0]['generated_text'][-1])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
```
|
62 |
|
63 |
+
# 🔖 Citation
|
64 |
```
|
65 |
+
@misc{goddard2024arcee,
|
66 |
title={Arcee's MergeKit: A Toolkit for Merging Large Language Models},
|
67 |
author={Goddard, Charles and Siriwardhana, Shamane and Ehghaghi, Malikeh and Meyers, Luke and Karpukhin, Vlad and Benedict, Brian and McQuade, Mark and Solawetz, Jacob},
|
68 |
journal={arXiv preprint arXiv:2403.13257},
|