RichardErkhov commited on
Commit
8a23929
โ€ข
1 Parent(s): a18e9b2

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +143 -0
README.md ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ japanese-stablelm-instruct-gamma-7b - bnb 8bits
11
+ - Model creator: https://huggingface.co/stabilityai/
12
+ - Original model: https://huggingface.co/stabilityai/japanese-stablelm-instruct-gamma-7b/
13
+
14
+
15
+
16
+
17
+ Original model description:
18
+ ---
19
+ language:
20
+ - ja
21
+ tags:
22
+ - japanese-stablelm
23
+ - causal-lm
24
+ pipeline_tag: text-generation
25
+ license: apache-2.0
26
+ extra_gated_fields:
27
+ Name: text
28
+ Email: text
29
+ Country: text
30
+ Organization or Affiliation: text
31
+ I allow Stability AI to contact me about information related to its models and research: checkbox
32
+ ---
33
+
34
+ # Japanese Stable LM Instruct Gamma 7B
35
+
36
+ ## Model Description
37
+
38
+ This is a 7B-parameter decoder-only Japanese language model fine-tuned on instruction-following datasets, built on top of the base model [Japanese Stable LM Base Gamma 7B](https://huggingface.co/stabilityai/japanese-stablelm-base-gamma-7b).
39
+
40
+ *If you are in search of a smaller model, please check [Japanese StableLM-3B-4E1T Instruct](https://huggingface.co/stabilityai/japanese-stablelm-3b-4e1t-base/blob/main/README.md).*
41
+
42
+ ## Usage
43
+
44
+ Ensure you are using Transformers 4.34.0 or newer.
45
+
46
+ ```python
47
+ import torch
48
+ from transformers import AutoTokenizer, AutoModelForCausalLM
49
+
50
+ tokenizer = AutoTokenizer.from_pretrained("stabilityai/japanese-stablelm-instruct-gamma-7b")
51
+ model = AutoModelForCausalLM.from_pretrained(
52
+ "stabilityai/japanese-stablelm-instruct-gamma-7b",
53
+ torch_dtype="auto",
54
+ )
55
+ model.eval()
56
+
57
+ if torch.cuda.is_available():
58
+ model = model.to("cuda")
59
+
60
+ def build_prompt(user_query, inputs="", sep="\n\n### "):
61
+ sys_msg = "ไปฅไธ‹ใฏใ€ใ‚ฟใ‚นใ‚ฏใ‚’่ชฌๆ˜Žใ™ใ‚‹ๆŒ‡็คบใจใ€ๆ–‡่„ˆใฎใ‚ใ‚‹ๅ…ฅๅŠ›ใฎ็ต„ใฟๅˆใ‚ใ›ใงใ™ใ€‚่ฆๆฑ‚ใ‚’้ฉๅˆ‡ใซๆบ€ใŸใ™ๅฟœ็ญ”ใ‚’ๆ›ธใใชใ•ใ„ใ€‚"
62
+ p = sys_msg
63
+ roles = ["ๆŒ‡็คบ", "ๅฟœ็ญ”"]
64
+ msgs = [": \n" + user_query, ": \n"]
65
+ if inputs:
66
+ roles.insert(1, "ๅ…ฅๅŠ›")
67
+ msgs.insert(1, ": \n" + inputs)
68
+ for role, msg in zip(roles, msgs):
69
+ p += sep + role + msg
70
+ return p
71
+
72
+ # Infer with prompt without any additional input
73
+ user_inputs = {
74
+ "user_query": "ไธŽใˆใ‚‰ใ‚ŒใŸใ“ใจใ‚ใ–ใฎๆ„ๅ‘ณใ‚’ๅฐๅญฆ็”Ÿใงใ‚‚ๅˆ†ใ‹ใ‚‹ใ‚ˆใ†ใซๆ•™ใˆใฆใใ ใ•ใ„ใ€‚",
75
+ "inputs": "ๆƒ…ใ‘ใฏไบบใฎใŸใ‚ใชใ‚‰ใš"
76
+ }
77
+ prompt = build_prompt(**user_inputs)
78
+
79
+ input_ids = tokenizer.encode(
80
+ prompt,
81
+ add_special_tokens=True,
82
+ return_tensors="pt"
83
+ )
84
+
85
+ tokens = model.generate(
86
+ input_ids.to(device=model.device),
87
+ max_new_tokens=256,
88
+ temperature=1,
89
+ top_p=0.95,
90
+ do_sample=True,
91
+ )
92
+
93
+ out = tokenizer.decode(tokens[0][input_ids.shape[1]:], skip_special_tokens=True).strip()
94
+ print(out)
95
+ ```
96
+
97
+ ## Model Details
98
+
99
+ * **Developed by**: [Stability AI](https://stability.ai/)
100
+ * **Model type**: `Japanese Stable LM Instruct Gamma 7B` model is an auto-regressive language model based on the transformer decoder architecture.
101
+ * **Language(s)**: Japanese
102
+ * **License**: This model is licensed under [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
103
+ * **Contact**: For questions and comments about the model, please join [Stable Community Japan](https://discord.gg/StableJP). For future announcements / information about Stability AI models, research, and events, please follow https://twitter.com/StabilityAI_JP.
104
+
105
+ ### Model Architecture
106
+
107
+ For details, please see Mistral AI's [paper](https://arxiv.org/abs/2310.06825) and [release blog post](https://mistral.ai/news/announcing-mistral-7b/).
108
+
109
+
110
+ ### Training Datasets
111
+
112
+ - [Japanese translation of the Databricks Dolly-15k dataset](https://huggingface.co/datasets/kunishou/databricks-dolly-15k-ja)
113
+ - [Japanese translation of the subset of the Anthropic HH dataset](https://huggingface.co/datasets/fujiki/japanese_hh-rlhf-49k)
114
+ - [Wikinews](https://ja.wikinews.org/wi) [subset](https://huggingface.co/datasets/fujiki/llm-japanese-dataset_wikinews) of the [izumi-lab/llm-japanese-dataset](https://huggingface.co/datasets/izumi-lab/llm-japanese-dataset)
115
+
116
+
117
+
118
+ ## Use and Limitations
119
+
120
+ ### Intended Use
121
+
122
+ The model is intended to be used by all individuals as a foundational model for application-specific fine-tuning without strict limitations on commercial use.
123
+
124
+ ### Limitations and bias
125
+
126
+ The pre-training dataset may have contained offensive or inappropriate content even after applying data cleansing filters which can be reflected in the model-generated text. We recommend users exercise reasonable caution when using these models in production systems. Do not use the model for any applications that may cause harm or distress to individuals or groups.
127
+
128
+ ## Credits
129
+
130
+ The fine-tuning was carried out by [Fujiki Nakamura](https://huggingface.co/fujiki).
131
+ Other aspects, including data preparation and evaluation, were handled by the Language Team of Stability AI Japan, notably [Meng Lee](https://huggingface.co/leemeng), [Makoto Shing](https://huggingface.co/mkshing), [Paul McCann](https://huggingface.co/polm-stability), [Naoki Orii](https://huggingface.co/mrorii), and [Takuya Akiba](https://huggingface.co/iwiwi).
132
+
133
+
134
+ ## Acknowledgements
135
+
136
+ This model is based on Mistral-7B-v0.1 released by the Mistral AI team. We are grateful to the Mistral AI team for providing such an excellent base model.
137
+
138
+ We are grateful for the contributions of the EleutherAI Polyglot-JA team in helping us to collect a large amount of pre-training data in Japanese. Polyglot-JA members includes Hyunwoong Ko (Project Lead), Fujiki Nakamura (originally started this project when he commited to the Polyglot team), Yunho Mo, Minji Jung, KeunSeok Im, and Su-Kyeong Jang.
139
+
140
+ We are also appreciative of [AI Novelist/Sta (Bit192, Inc.)](https://ai-novel.com/index.php) and the numerous contributors from [Stable Community Japan](https://discord.gg/VPrcE475HB) for assisting us in gathering a large amount of high-quality Japanese textual data for model training.
141
+
142
+
143
+