masanorihirano
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -2,4 +2,88 @@
|
|
2 |
license: other
|
3 |
license_name: tongyi-qianwen-license
|
4 |
license_link: LICENSE
|
|
|
|
|
|
|
|
|
|
|
5 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: other
|
3 |
license_name: tongyi-qianwen-license
|
4 |
license_link: LICENSE
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
- ja
|
8 |
+
library_name: transformers
|
9 |
+
pipeline_tag: text-generation
|
10 |
---
|
11 |
+
|
12 |
+
# nakomata-14b-pfn-qfin
|
13 |
+
|
14 |
+
## Model Description
|
15 |
+
nekomata-14b-pfn-qfin is an fine-tuned model based on [rinna/nekomata-14b](https://huggingface.co/rinna/nekomata-14b/tree/main).
|
16 |
+
This is the base model, which is good at generating continuous sentences.
|
17 |
+
nekomata-14b-pfn-qfin is fine-tuned on 370M tokens from multiple special datasets generated by Preferred Networks, which is clear to use for commercial usage.
|
18 |
+
The fine-tuned were carried out at a 2048 context length.
|
19 |
+
This model is released under [Tongyi Qianwen LICENSE AGREEMENT](https://github.com/QwenLM/Qwen/blob/e8e15962d897714944773cca57fa2e460a3655e8/Tongyi%20Qianwen%20LICENSE%20AGREEMENT).
|
20 |
+
|
21 |
+
The research article will also be released later.
|
22 |
+
|
23 |
+
# Benchmarking
|
24 |
+
The benchmark score is obtained using [Japanese Language Model Financial Evaluation Harness](https://github.com/pfnet-research/japanese-lm-fin-harness)
|
25 |
+
For the benchmark, 0-shot and default prompts are used.
|
26 |
+
```
|
27 |
+
| Task |Metric| nekomaba-14b | Ours |
|
28 |
+
|----------------|------|------|---|------|------|---|------|
|
29 |
+
|chabsa |f1 |0.7381| | |0.7428| | |
|
30 |
+
|cma_basics |acc |0.4737|± |0.0821|0.5263|± |0.0821|
|
31 |
+
|cpa_audit |acc |0.1608|± |0.0184|0.1633|± |0.0186|
|
32 |
+
|fp2 |acc |0.3389|± |0.0217|0.3642|± |0.0221|
|
33 |
+
|security_sales_1|acc |0.4561|± |0.0666|0.5614|± |0.0663|
|
34 |
+
|----------------|------|------|---|------|------|---|------|
|
35 |
+
|OVER ALL | |0.4335 |0.4716 |
|
36 |
+
```
|
37 |
+
## Usage
|
38 |
+
Install the required libraries as follows:
|
39 |
+
```sh
|
40 |
+
>>> python -m pip install numpy sentencepiece torch transformers accelerate transformers_stream_generator
|
41 |
+
```
|
42 |
+
|
43 |
+
Execute the following python code:
|
44 |
+
```python
|
45 |
+
tokenizer = AutoTokenizer.from_pretrained("pfnet/nakomata-14b-pfn-qfin", trust_remote_code=True)
|
46 |
+
model = AutoModelForCausalLM.from_pretrained("pfnet/nakomata-14b-pfn-qfin", device_map="auto", trust_remote_code=True)
|
47 |
+
text = "日本銀行は"
|
48 |
+
input_ids = tokenizer(text, return_tensors="pt").input_ids
|
49 |
+
with torch.no_grad():
|
50 |
+
generated_tokens = model.generate(
|
51 |
+
inputs=input_ids,
|
52 |
+
max_new_tokens=32,
|
53 |
+
do_sample=True,
|
54 |
+
top_k=50,
|
55 |
+
top_p=0.95,
|
56 |
+
temperature=1.0,
|
57 |
+
)[0]
|
58 |
+
generated_text = tokenizer.decode(generated_tokens)
|
59 |
+
print(generated_text)
|
60 |
+
# 日本銀行は、平成27年10月に、デフレからの脱却をより確実なものとするため、「長短金利操作付き量的・質的金融緩和」を導入しました。...
|
61 |
+
```
|
62 |
+
|
63 |
+
## Model Details
|
64 |
+
- Model size: 14B
|
65 |
+
- Fine-tuned tokens: 370M tokens (Japanese: 300M tokens, English: 13M tokens, Digits: 14M tokens)
|
66 |
+
- Context length: 2048
|
67 |
+
- Developed by: Preferred Networks, Inc
|
68 |
+
- Model type: Causal decoder-only
|
69 |
+
- Language(s): Japanese and English
|
70 |
+
- License: [Tongyi Qianwen LICENSE AGREEMENT](https://github.com/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20LICENSE%20AGREEMENT)
|
71 |
+
|
72 |
+
## Bias, Risks, and Limitations
|
73 |
+
nakomata-14b-pfn-qfin is a new technology that carries risks with use.
|
74 |
+
Testing conducted to date has been in English and Japanese, and has not covered, nor could it cover all scenarios.
|
75 |
+
For these reasons, as with all LLMs, nakomata-14b-pfn-qfin’s potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses to user prompts.
|
76 |
+
This model is not designed for legal, tax, investment, financial, or other advice.
|
77 |
+
Therefore, before deploying any applications of nakomata-14b-pfn-qfin, developers should perform safety testing and tuning tailored to their specific applications of the model.
|
78 |
+
|
79 |
+
## How to cite
|
80 |
+
TBD
|
81 |
+
|
82 |
+
## Authors
|
83 |
+
Preferred Networks, Inc.
|
84 |
+
- Masanori Hirano
|
85 |
+
- Kentaro Imajo
|
86 |
+
|
87 |
+
# License
|
88 |
+
[Tongyi Qianwen LICENSE AGREEMENT](https://github.com/QwenLM/Qwen/blob/e8e15962d897714944773cca57fa2e460a3655e8/Tongyi%20Qianwen%20LICENSE%20AGREEMENT)
|
89 |
+
|