TheBloke commited on
Commit
978bcd2
1 Parent(s): 47e68b6

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +430 -0
README.md ADDED
@@ -0,0 +1,430 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: stockmark/stockmark-13b
3
+ inference: false
4
+ language:
5
+ - ja
6
+ library_name: transformers
7
+ license: other
8
+ model_creator: Stockmark Inc.
9
+ model_name: Stockmark 13B
10
+ model_type: llama
11
+ pipeline_tag: text-generation
12
+ prompt_template: '{prompt}
13
+
14
+ '
15
+ quantized_by: TheBloke
16
+ tags:
17
+ - japanese
18
+ - llama-2
19
+ ---
20
+ <!-- markdownlint-disable MD041 -->
21
+
22
+ <!-- header start -->
23
+ <!-- 200823 -->
24
+ <div style="width: auto; margin-left: auto; margin-right: auto">
25
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
26
+ </div>
27
+ <div style="display: flex; justify-content: space-between; width: 100%;">
28
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
29
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
30
+ </div>
31
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
32
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
33
+ </div>
34
+ </div>
35
+ <div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
36
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
37
+ <!-- header end -->
38
+
39
+ # Stockmark 13B - GPTQ
40
+ - Model creator: [Stockmark Inc.](https://huggingface.co/stockmark)
41
+ - Original model: [Stockmark 13B](https://huggingface.co/stockmark/stockmark-13b)
42
+
43
+ <!-- description start -->
44
+ ## Description
45
+
46
+ This repo contains GPTQ model files for [Stockmark Inc.'s Stockmark 13B](https://huggingface.co/stockmark/stockmark-13b).
47
+
48
+ Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
49
+
50
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
51
+
52
+ <!-- description end -->
53
+ <!-- repositories-available start -->
54
+ ## Repositories available
55
+
56
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/stockmark-13B-AWQ)
57
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/stockmark-13B-GPTQ)
58
+ * [Stockmark Inc.'s original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/stockmark/stockmark-13b)
59
+ <!-- repositories-available end -->
60
+
61
+ <!-- prompt-template start -->
62
+ ## Prompt template: None
63
+
64
+ ```
65
+ {prompt}
66
+
67
+ ```
68
+
69
+ <!-- prompt-template end -->
70
+
71
+
72
+
73
+ <!-- README_GPTQ.md-compatible clients start -->
74
+ ## Known compatible clients / servers
75
+
76
+ These GPTQ models are known to work in the following inference servers/webuis.
77
+
78
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
79
+ - [KobaldAI United](https://github.com/henk717/koboldai)
80
+ - [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui)
81
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
82
+
83
+ This may not be a complete list; if you know of others, please let me know!
84
+ <!-- README_GPTQ.md-compatible clients end -->
85
+
86
+ <!-- README_GPTQ.md-provided-files start -->
87
+ ## Provided files, and GPTQ parameters
88
+
89
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
90
+
91
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
92
+
93
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
94
+
95
+ <details>
96
+ <summary>Explanation of GPTQ parameters</summary>
97
+
98
+ - Bits: The bit size of the quantised model.
99
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
100
+ - Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
101
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
102
+ - GPTQ dataset: The calibration dataset used during quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ calibration dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
103
+ - Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
104
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
105
+
106
+ </details>
107
+
108
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
109
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
110
+ | [main](https://huggingface.co/TheBloke/stockmark-13B-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [Alpaca Japanese](https://huggingface.co/datasets/fujiki/japanese_alpaca_data) | 2048 | 7.63 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
111
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/stockmark-13B-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [Alpaca Japanese](https://huggingface.co/datasets/fujiki/japanese_alpaca_data) | 2048 | 8.37 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
112
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/stockmark-13B-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [Alpaca Japanese](https://huggingface.co/datasets/fujiki/japanese_alpaca_data) | 2048 | 13.73 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
113
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/stockmark-13B-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [Alpaca Japanese](https://huggingface.co/datasets/fujiki/japanese_alpaca_data) | 2048 | 14.02 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
114
+ | [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/stockmark-13B-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [Alpaca Japanese](https://huggingface.co/datasets/fujiki/japanese_alpaca_data) | 2048 | 14.91 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
115
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/stockmark-13B-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [Alpaca Japanese](https://huggingface.co/datasets/fujiki/japanese_alpaca_data) | 2048 | 7.88 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
116
+
117
+ <!-- README_GPTQ.md-provided-files end -->
118
+
119
+ <!-- README_GPTQ.md-download-from-branches start -->
120
+ ## How to download, including from branches
121
+
122
+ ### In text-generation-webui
123
+
124
+ To download from the `main` branch, enter `TheBloke/stockmark-13B-GPTQ` in the "Download model" box.
125
+
126
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/stockmark-13B-GPTQ:gptq-4bit-32g-actorder_True`
127
+
128
+ ### From the command line
129
+
130
+ I recommend using the `huggingface-hub` Python library:
131
+
132
+ ```shell
133
+ pip3 install huggingface-hub
134
+ ```
135
+
136
+ To download the `main` branch to a folder called `stockmark-13B-GPTQ`:
137
+
138
+ ```shell
139
+ mkdir stockmark-13B-GPTQ
140
+ huggingface-cli download TheBloke/stockmark-13B-GPTQ --local-dir stockmark-13B-GPTQ --local-dir-use-symlinks False
141
+ ```
142
+
143
+ To download from a different branch, add the `--revision` parameter:
144
+
145
+ ```shell
146
+ mkdir stockmark-13B-GPTQ
147
+ huggingface-cli download TheBloke/stockmark-13B-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir stockmark-13B-GPTQ --local-dir-use-symlinks False
148
+ ```
149
+
150
+ <details>
151
+ <summary>More advanced huggingface-cli download usage</summary>
152
+
153
+ If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Hugging Face cache directory (default location on Linux is: `~/.cache/huggingface`), and symlinks will be added to the specified `--local-dir`, pointing to their real location in the cache. This allows for interrupted downloads to be resumed, and allows you to quickly clone the repo to multiple places on disk without triggering a download again. The downside, and the reason why I don't list that as the default option, is that the files are then hidden away in a cache folder and it's harder to know where your disk space is being used, and to clear it up if/when you want to remove a download model.
154
+
155
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
156
+
157
+ For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
158
+
159
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
160
+
161
+ ```shell
162
+ pip3 install hf_transfer
163
+ ```
164
+
165
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
166
+
167
+ ```shell
168
+ mkdir stockmark-13B-GPTQ
169
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/stockmark-13B-GPTQ --local-dir stockmark-13B-GPTQ --local-dir-use-symlinks False
170
+ ```
171
+
172
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
173
+ </details>
174
+
175
+ ### With `git` (**not** recommended)
176
+
177
+ To clone a specific branch with `git`, use a command like this:
178
+
179
+ ```shell
180
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/stockmark-13B-GPTQ
181
+ ```
182
+
183
+ Note that using Git with HF repos is strongly discouraged. It will be much slower than using `huggingface-hub`, and will use twice as much disk space as it has to store the model files twice (it stores every byte both in the intended target folder, and again in the `.git` folder as a blob.)
184
+
185
+ <!-- README_GPTQ.md-download-from-branches end -->
186
+ <!-- README_GPTQ.md-text-generation-webui start -->
187
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
188
+
189
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
190
+
191
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
192
+
193
+ 1. Click the **Model tab**.
194
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/stockmark-13B-GPTQ`.
195
+
196
+ - To download from a specific branch, enter for example `TheBloke/stockmark-13B-GPTQ:gptq-4bit-32g-actorder_True`
197
+ - see Provided Files above for the list of branches for each option.
198
+
199
+ 3. Click **Download**.
200
+ 4. The model will start downloading. Once it's finished it will say "Done".
201
+ 5. In the top left, click the refresh icon next to **Model**.
202
+ 6. In the **Model** dropdown, choose the model you just downloaded: `stockmark-13B-GPTQ`
203
+ 7. The model will automatically load, and is now ready for use!
204
+ 8. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
205
+
206
+ - Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
207
+
208
+ 9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
209
+
210
+ <!-- README_GPTQ.md-text-generation-webui end -->
211
+
212
+ <!-- README_GPTQ.md-use-from-tgi start -->
213
+ ## Serving this model from Text Generation Inference (TGI)
214
+
215
+ It's recommended to use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
216
+
217
+ Example Docker parameters:
218
+
219
+ ```shell
220
+ --model-id TheBloke/stockmark-13B-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
221
+ ```
222
+
223
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
224
+
225
+ ```shell
226
+ pip3 install huggingface-hub
227
+ ```
228
+
229
+ ```python
230
+ from huggingface_hub import InferenceClient
231
+
232
+ endpoint_url = "https://your-endpoint-url-here"
233
+
234
+ prompt = "Tell me about AI"
235
+ prompt_template=f'''{prompt}
236
+ '''
237
+
238
+ client = InferenceClient(endpoint_url)
239
+ response = client.text_generation(prompt,
240
+ max_new_tokens=128,
241
+ do_sample=True,
242
+ temperature=0.7,
243
+ top_p=0.95,
244
+ top_k=40,
245
+ repetition_penalty=1.1)
246
+
247
+ print(f"Model output: {response}")
248
+ ```
249
+ <!-- README_GPTQ.md-use-from-tgi end -->
250
+ <!-- README_GPTQ.md-use-from-python start -->
251
+ ## How to use this GPTQ model from Python code
252
+
253
+ ### Install the necessary packages
254
+
255
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
256
+
257
+ ```shell
258
+ pip3 install transformers optimum
259
+ pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
260
+ ```
261
+
262
+ If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
263
+
264
+ ```shell
265
+ pip3 uninstall -y auto-gptq
266
+ git clone https://github.com/PanQiWei/AutoGPTQ
267
+ cd AutoGPTQ
268
+ git checkout v0.4.2
269
+ pip3 install .
270
+ ```
271
+
272
+ ### You can then use the following code
273
+
274
+ ```python
275
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
276
+
277
+ model_name_or_path = "TheBloke/stockmark-13B-GPTQ"
278
+ # To use a different branch, change revision
279
+ # For example: revision="gptq-4bit-32g-actorder_True"
280
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
281
+ device_map="auto",
282
+ trust_remote_code=False,
283
+ revision="main")
284
+
285
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
286
+
287
+ prompt = "Tell me about AI"
288
+ prompt_template=f'''{prompt}
289
+ '''
290
+
291
+ print("\n\n*** Generate:")
292
+
293
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
294
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
295
+ print(tokenizer.decode(output[0]))
296
+
297
+ # Inference can also be done using transformers' pipeline
298
+
299
+ print("*** Pipeline:")
300
+ pipe = pipeline(
301
+ "text-generation",
302
+ model=model,
303
+ tokenizer=tokenizer,
304
+ max_new_tokens=512,
305
+ do_sample=True,
306
+ temperature=0.7,
307
+ top_p=0.95,
308
+ top_k=40,
309
+ repetition_penalty=1.1
310
+ )
311
+
312
+ print(pipe(prompt_template)[0]['generated_text'])
313
+ ```
314
+ <!-- README_GPTQ.md-use-from-python end -->
315
+
316
+ <!-- README_GPTQ.md-compatibility start -->
317
+ ## Compatibility
318
+
319
+ The files provided are tested to work with Transformers. For non-Mistral models, AutoGPTQ can also be used directly.
320
+
321
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama and Mistral models in 4-bit. Please see the Provided Files table above for per-file compatibility.
322
+
323
+ For a list of clients/servers, please see "Known compatible clients / servers", above.
324
+ <!-- README_GPTQ.md-compatibility end -->
325
+
326
+ <!-- footer start -->
327
+ <!-- 200823 -->
328
+ ## Discord
329
+
330
+ For further support, and discussions on these models and AI in general, join us at:
331
+
332
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
333
+
334
+ ## Thanks, and how to contribute
335
+
336
+ Thanks to the [chirper.ai](https://chirper.ai) team!
337
+
338
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
339
+
340
+ I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
341
+
342
+ If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
343
+
344
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
345
+
346
+ * Patreon: https://patreon.com/TheBlokeAI
347
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
348
+
349
+ **Special thanks to**: Aemon Algiz.
350
+
351
+ **Patreon special mentions**: Brandon Frisco, LangChain4j, Spiking Neurons AB, transmissions 11, Joseph William Delisle, Nitin Borwankar, Willem Michiel, Michael Dempsey, vamX, Jeffrey Morgan, zynix, jjj, Omer Bin Jawed, Sean Connelly, jinyuan sun, Jeromy Smith, Shadi, Pawan Osman, Chadd, Elijah Stavena, Illia Dulskyi, Sebastain Graf, Stephen Murray, terasurfer, Edmond Seymore, Celu Ramasamy, Mandus, Alex, biorpg, Ajan Kanaga, Clay Pascal, Raven Klaugh, 阿明, K, ya boyyy, usrbinkat, Alicia Loh, John Villwock, ReadyPlayerEmma, Chris Smitley, Cap'n Zoog, fincy, GodLy, S_X, sidney chen, Cory Kujawski, OG, Mano Prime, AzureBlack, Pieter, Kalila, Spencer Kim, Tom X Nguyen, Stanislav Ovsiannikov, Michael Levine, Andrey, Trailburnt, Vadim, Enrico Ros, Talal Aujan, Brandon Phillips, Jack West, Eugene Pentland, Michael Davis, Will Dee, webtim, Jonathan Leane, Alps Aficionado, Rooh Singh, Tiffany J. Kim, theTransient, Luke @flexchar, Elle, Caitlyn Gatomon, Ari Malik, subjectnull, Johann-Peter Hartmann, Trenton Dambrowitz, Imad Khwaja, Asp the Wyvern, Emad Mostaque, Rainer Wilmers, Alexandros Triantafyllidis, Nicholas, Pedro Madruga, SuperWojo, Harry Royden McLaughlin, James Bentley, Olakabola, David Ziegler, Ai Maven, Jeff Scroggin, Nikolai Manek, Deo Leter, Matthew Berman, Fen Risland, Ken Nordquist, Manuel Alberto Morcote, Luke Pendergrass, TL, Fred von Graf, Randy H, Dan Guido, NimbleBox.ai, Vitor Caleffi, Gabriel Tamborski, knownsqashed, Lone Striker, Erik Bjäreholt, John Detwiler, Leonard Tan, Iucharbius
352
+
353
+
354
+ Thank you to all my generous patrons and donaters!
355
+
356
+ And thank you again to a16z for their generous grant.
357
+
358
+ <!-- footer end -->
359
+
360
+ # Original model card: Stockmark Inc.'s Stockmark 13B
361
+
362
+
363
+ # stockmark/stockmark-13b
364
+
365
+ Stockmark-13b is a 13 billion parameter LLM pretrained from scratch based on Japanese corpus of about 220B tokens. This model is developed by [Stockmark Inc.](https://stockmark.co.jp/)
366
+
367
+ Please see our [blog](https://tech.stockmark.co.jp/blog/202310_stockmark_13b/) for more details.
368
+
369
+ This project is supported by [AWS LLM development support program](https://aws.amazon.com/jp/local/llm-development-support-program/).
370
+
371
+ ## How to use
372
+
373
+ ```python
374
+ import torch
375
+ from transformers import AutoModelForCausalLM, AutoTokenizer
376
+
377
+ # For A100 or H100 GPU
378
+ model = AutoModelForCausalLM.from_pretrained("stockmark/stockmark-13b", device_map="auto", torch_dtype=torch.bfloat16)
379
+
380
+ # If you use a T4 or V100 GPU, please load a model in 8 bit with the below code.
381
+ # To do so, you need to install `bitsandbytes` via `pip install bitsandbytes`.
382
+ # model = AutoModelForCausalLM.from_pretrained("stockmark/stockmark-13b", device_map={"": 0}, load_in_8bit=True)
383
+
384
+ tokenizer = AutoTokenizer.from_pretrained("stockmark/stockmark-13b")
385
+
386
+ inputs = tokenizer("自然言語処理とは", return_tensors="pt").to(model.device)
387
+ with torch.no_grad():
388
+ tokens = model.generate(
389
+ **inputs,
390
+ max_new_tokens=128,
391
+ do_sample=True,
392
+ temperature=0.7
393
+ )
394
+
395
+ output = tokenizer.decode(tokens[0], skip_special_tokens=True)
396
+ print(output)
397
+ ```
398
+
399
+ ## Examples:
400
+
401
+ - LoRA tuning: https://huggingface.co/stockmark/stockmark-13b/blob/main/notebooks/LoRA.ipynb
402
+
403
+ ## Training dataset
404
+
405
+ We have used Japanese corpus of total of about 220 billion tokens.
406
+
407
+ |corpus|tokens after preprocessing|
408
+ |:---:|:---:|
409
+ |Stockmark Web Corpus (This dataset will not be released)|9.1 billion|
410
+ |Patent|34.8 billion|
411
+ |Wikipedia|1.0 billion|
412
+ |CC100|10.9 billion|
413
+ |mC4|53.2 billion|
414
+ |CommonCrawl (snapshot: 2023-23, 2022-49, 2022-21, 2021-21)|112.9 billion|
415
+
416
+
417
+ ## Accelerator and Library
418
+ - Accelerator: AWS Trainium
419
+ - https://aws.amazon.com/machine-learning/trainium/
420
+ - Library for distributed training: neuronx-nemo-megatron
421
+ - https://github.com/aws-neuron/neuronx-nemo-megatron
422
+
423
+ ## License
424
+ [MIT](https://opensource.org/licenses/MIT)
425
+
426
+ ## Developed by
427
+ [Stockmark Inc.](https://stockmark.co.jp/)
428
+
429
+ ## Author
430
+ [Takahiro Omi](https://huggingface.co/omitakahiro)