初始化项目,由ModelHub XC社区提供模型
Model: DUTIR-BioNLP/Taiyi-LLM Source: Original Platform
This commit is contained in:
35
.gitattributes
vendored
Normal file
35
.gitattributes
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
108
README.md
Normal file
108
README.md
Normal file
@@ -0,0 +1,108 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
---
|
||||
|
||||
# Taiyi (太一): A Bilingual (Chinese and English) Fine-Tuned Large Language Model for Diverse Biomedical Tasks
|
||||
|
||||
[Demo](https://modelscope.cn/models/DUTIRbionlp/Taiyi2-chat) | [Github](https://github.com/DUTIR-BioNLP/Taiyi-LLM) | [Paper](https://academic.oup.com/jamia/article/31/9/1865/7616487?utm_source=authortollfreelink&utm_campaign=jamia&utm_medium=email&guestAccessKey=4c56c223-a555-4949-bef7-16e77f8baa10) | [Data](https://huggingface.co/datasets/DUTIR-BioNLP/Taiyi_Instruction_Data_001)
|
||||
|
||||
This is the model of Taiyi using Qwen-7b-base as the base model, developed by [DUTIR](http://ir.dlut.edu.cn/) lab.
|
||||
|
||||
> **🚨 IMPORTANT UPDATE:** We are excited to announce the release of **Taiyi 2**. We highly recommend users transition to the new version for enhanced performance and capabilities.
|
||||
>
|
||||
> 👉 **[Click here to access Taiyi 2 (DUTIR-BioNLP/Taiyi2-chat)](https://huggingface.co/DUTIR-BioNLP/Taiyi2-chat)**
|
||||
|
||||
|
||||
## Project Background
|
||||
|
||||
|
||||
With the rapid development of deep learning technology, large language models like ChatGPT have made significant progress in the field of natural language processing. In the context of biomedical applications, large language models facilitate communication between healthcare professionals and patients, provide valuable medical information, and have enormous potential in assisting diagnosis, biomedical knowledge discovery, drug development, and personalized healthcare solutions, among others. However, in the AI community, there is a relative scarcity of existing open-source biomedical large models, with most of them primarily focused on monolingual medical question-answering dialogues in either Chinese or English. Therefore, this project embarks on research dedicated to large models for the biomedical domain and introduces the initial version of a bilingual Chinese-English biomedical large model named 'Taiyi', iming to explore the capabilities of large models in handling a variety of Chinese-English natural language processing tasks in the biomedical field.
|
||||
|
||||
**Project Highlights**
|
||||
|
||||
- **Abundant Biomedical Training Resources**:For the biomedical domain, this project has collected and organized a diverse set of Chinese-English biomedical Natural Language Processing (BioNLP) training datasets. This collection includes a total of 38 Chinese datasets covering 10 BioNLP tasks and 131 English datasets covering 12 BioNLP tasks. To facilitate task-specific requirements, standardized data formats have been designed and applied for consistent formatting across all datasets.
|
||||
- **Exceptional Bilingual BioNLP Multi-Task Capability in Chinese and English**:Designing and constructing a bilingual Chinese-English instruction dataset (comprising over 1 million samples) for large model fine-tuning, enabling the model to excel in various BioNLP tasks including intelligent biomedical question-answering, doctor-patient dialogues, report generation, information extraction, machine translation, headline generation, text classification, and more.
|
||||
- **Open Source Information**:Open-source Chinese-English BioNLP dataset curation details, Taiyi large model weights, and model inference deployment scripts.
|
||||
|
||||
|
||||
## Model Inference
|
||||
|
||||
We concatenate multi-turn dialogues into the following format, and then tokenize them. Where eod is the special character <|endoftext|> in the qwen tokenizer.
|
||||
|
||||
```
|
||||
<eod>input1<eod>answer1<eod>input2<eod>answer2<eod>.....
|
||||
```
|
||||
The following code can be used to perform inference using our model:
|
||||
```python
|
||||
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
import torch
|
||||
|
||||
model_name = "DUTIR-BioNLP/Taiyi-LLM"
|
||||
|
||||
device = 'cuda:0'
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
model_name,
|
||||
low_cpu_mem_usage=True,
|
||||
torch_dtype=torch.float16,
|
||||
trust_remote_code=True,
|
||||
device_map = device
|
||||
)
|
||||
|
||||
|
||||
model.eval()
|
||||
tokenizer = AutoTokenizer.from_pretrained(
|
||||
model_name,
|
||||
trust_remote_code=True
|
||||
)
|
||||
|
||||
import logging
|
||||
logging.disable(logging.WARNING)
|
||||
tokenizer.pad_token_id = tokenizer.eod_id
|
||||
tokenizer.bos_token_id = tokenizer.eod_id
|
||||
tokenizer.eos_token_id = tokenizer.eod_id
|
||||
history_token_ids = torch.tensor([[]], dtype=torch.long)
|
||||
max_new_tokens = 500
|
||||
top_p = 0.9
|
||||
temperature = 0.3
|
||||
repetition_penalty = 1.0
|
||||
|
||||
# begin chat
|
||||
history_max_len = 1000
|
||||
utterance_id = 0
|
||||
history_token_ids = None
|
||||
|
||||
user_input = "Hi, could you please introduce yourself?"
|
||||
|
||||
input_ids = tokenizer(user_input, return_tensors="pt", add_special_tokens=False).input_ids
|
||||
bos_token_id = torch.tensor([[tokenizer.bos_token_id]], dtype=torch.long)
|
||||
eos_token_id = torch.tensor([[tokenizer.eos_token_id]], dtype=torch.long)
|
||||
user_input_ids = torch.concat([bos_token_id,input_ids, eos_token_id], dim=1)
|
||||
|
||||
|
||||
model_input_ids = user_input_ids.to(device)
|
||||
with torch.no_grad():
|
||||
outputs = model.generate(
|
||||
input_ids=model_input_ids, max_new_tokens=max_new_tokens, do_sample=True, top_p=top_p,
|
||||
temperature=temperature, repetition_penalty=repetition_penalty, eos_token_id=tokenizer.eos_token_id
|
||||
)
|
||||
|
||||
response = tokenizer.batch_decode(outputs)
|
||||
print(response[0])
|
||||
#<|endoftext|>Hi, could you please introduce yourself?<|endoftext|>Hello! My name is Taiyi,.....<|endoftext|>
|
||||
```
|
||||
We provide two test codes for dialogue. You can use the code in [dialogue_one_trun.py](https://github.com/DUTIR-BioNLP/Taiyi-LLM/blob/main/dialogue_one_trun.py) to test single-turn QA dialogue, or use the sample code in [dialogue_multi_trun.py](https://github.com/DUTIR-BioNLP/Taiyi-LLM/blob/main/dialogue_one_trun.py) to test multi-turn conversational QA.
|
||||
|
||||
## Citation
|
||||
If you use the repository of this project, please cite it.
|
||||
```
|
||||
@article{Taiyi,
|
||||
title="{Taiyi: A Bilingual Fine-Tuned Large Language Model for Diverse Biomedical Tasks}",
|
||||
author={Ling Luo, Jinzhong Ning, Yingwen Zhao, Zhijun Wang, Zeyuan Ding, Peng Chen, Weiru Fu, Qinyu Han, Guangtao Xu, Yunzhi Qiu, Dinghao Pan, Jiru Li, Hao Li, Wenduo Feng, Senbo Tu, Yuqi Liu, Zhihao Yang, Jian Wang, Yuanyuan Sun, Hongfei Lin},
|
||||
journal={Journal of the American Medical Informatics Association},
|
||||
year={2024},
|
||||
doi = {10.1093/jamia/ocae037},
|
||||
url = {https://doi.org/10.1093/jamia/ocae037},
|
||||
}
|
||||
```
|
||||
39
config.json
Normal file
39
config.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"_name_or_path": "/home/Users/guoj/BIO_LLM/New_qwen/Qwen/Qwen-7B",
|
||||
"architectures": [
|
||||
"QWenLMHeadModel"
|
||||
],
|
||||
"attn_dropout_prob": 0.0,
|
||||
"auto_map": {
|
||||
"AutoConfig": "configuration_qwen.QWenConfig",
|
||||
"AutoModelForCausalLM": "modeling_qwen.QWenLMHeadModel"
|
||||
},
|
||||
"bf16": true,
|
||||
"emb_dropout_prob": 0.0,
|
||||
"fp16": false,
|
||||
"fp32": false,
|
||||
"hidden_size": 4096,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 22016,
|
||||
"kv_channels": 128,
|
||||
"layer_norm_epsilon": 1e-06,
|
||||
"max_position_embeddings": 8192,
|
||||
"model_type": "qwen",
|
||||
"no_bias": true,
|
||||
"num_attention_heads": 32,
|
||||
"num_hidden_layers": 32,
|
||||
"onnx_safe": null,
|
||||
"rotary_emb_base": 10000,
|
||||
"rotary_pct": 1.0,
|
||||
"scale_attn_weights": true,
|
||||
"seq_length": 2048,
|
||||
"tie_word_embeddings": false,
|
||||
"tokenizer_type": "QWenTokenizer",
|
||||
"torch_dtype": "bfloat16",
|
||||
"transformers_version": "4.31.0",
|
||||
"use_cache": true,
|
||||
"use_dynamic_ntk": true,
|
||||
"use_flash_attn": true,
|
||||
"use_logn_attn": true,
|
||||
"vocab_size": 151936
|
||||
}
|
||||
65
configuration_qwen.py
Normal file
65
configuration_qwen.py
Normal file
@@ -0,0 +1,65 @@
|
||||
# Copyright (c) Alibaba Cloud.
|
||||
#
|
||||
# This source code is licensed under the license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
|
||||
|
||||
class QWenConfig(PretrainedConfig):
|
||||
model_type = "qwen"
|
||||
keys_to_ignore_at_inference = ["past_key_values"]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
vocab_size=151936,
|
||||
hidden_size=4096,
|
||||
num_hidden_layers=32,
|
||||
num_attention_heads=32,
|
||||
emb_dropout_prob=0.0,
|
||||
attn_dropout_prob=0.0,
|
||||
layer_norm_epsilon=1e-6,
|
||||
initializer_range=0.02,
|
||||
max_position_embeddings=8192,
|
||||
scale_attn_weights=True,
|
||||
use_cache=True,
|
||||
bf16=False,
|
||||
fp16=False,
|
||||
fp32=False,
|
||||
kv_channels=128,
|
||||
rotary_pct=1.0,
|
||||
rotary_emb_base=10000,
|
||||
use_dynamic_ntk=True,
|
||||
use_logn_attn=True,
|
||||
use_flash_attn="auto",
|
||||
intermediate_size=22016,
|
||||
no_bias=True,
|
||||
tie_word_embeddings=False,
|
||||
**kwargs,
|
||||
):
|
||||
self.vocab_size = vocab_size
|
||||
self.hidden_size = hidden_size
|
||||
self.intermediate_size = intermediate_size
|
||||
self.num_hidden_layers = num_hidden_layers
|
||||
self.num_attention_heads = num_attention_heads
|
||||
self.emb_dropout_prob = emb_dropout_prob
|
||||
self.attn_dropout_prob = attn_dropout_prob
|
||||
self.layer_norm_epsilon = layer_norm_epsilon
|
||||
self.initializer_range = initializer_range
|
||||
self.scale_attn_weights = scale_attn_weights
|
||||
self.use_cache = use_cache
|
||||
self.max_position_embeddings = max_position_embeddings
|
||||
self.bf16 = bf16
|
||||
self.fp16 = fp16
|
||||
self.fp32 = fp32
|
||||
self.kv_channels = kv_channels
|
||||
self.rotary_pct = rotary_pct
|
||||
self.rotary_emb_base = rotary_emb_base
|
||||
self.use_dynamic_ntk = use_dynamic_ntk
|
||||
self.use_logn_attn = use_logn_attn
|
||||
self.use_flash_attn = use_flash_attn
|
||||
self.no_bias = no_bias
|
||||
super().__init__(
|
||||
tie_word_embeddings=tie_word_embeddings,
|
||||
**kwargs
|
||||
)
|
||||
4
generation_config.json
Normal file
4
generation_config.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"_from_model_config": true,
|
||||
"transformers_version": "4.31.0"
|
||||
}
|
||||
3
model-00001-of-00008.safetensors
Normal file
3
model-00001-of-00008.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d7446b0507d2c34052b6d078ac84dac04d958e2fd1a9e5279e7d2c4dbe59a99f
|
||||
size 1964066488
|
||||
3
model-00002-of-00008.safetensors
Normal file
3
model-00002-of-00008.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6028a482b1352cb0bf081959cf8bdcd35a24ea2b4d2215ba2806588d90323568
|
||||
size 1933783168
|
||||
3
model-00003-of-00008.safetensors
Normal file
3
model-00003-of-00008.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e3c24d2b61a2bc8b3db942c7bd8df979543f555e84055379def33dd6d5b5082b
|
||||
size 1933783168
|
||||
3
model-00004-of-00008.safetensors
Normal file
3
model-00004-of-00008.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:60683591f346e95891c7398cfbf202b1ad0768528a964378090309013245638a
|
||||
size 1990398008
|
||||
3
model-00005-of-00008.safetensors
Normal file
3
model-00005-of-00008.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a82a0a394ba4d08a4f0e261af0600eaa1c56e3bdb47ed4933a4a81db0f212a48
|
||||
size 1923272752
|
||||
3
model-00006-of-00008.safetensors
Normal file
3
model-00006-of-00008.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:411e7a67ee6e2a8d4f5ad94adeaae8e90e55b0285ddc395ce3c0eeabe6881ce5
|
||||
size 1933774896
|
||||
3
model-00007-of-00008.safetensors
Normal file
3
model-00007-of-00008.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:85135927313a452646f880fdd457a6c6bfe75824193417ed2e980168f7f9be42
|
||||
size 1933783200
|
||||
3
model-00008-of-00008.safetensors
Normal file
3
model-00008-of-00008.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f2f10aea762b7afd9292fd36b81d91f878ea31fcb5bf6438f115c4182bccad5c
|
||||
size 1829815600
|
||||
266
model.safetensors.index.json
Normal file
266
model.safetensors.index.json
Normal file
@@ -0,0 +1,266 @@
|
||||
{
|
||||
"metadata": {
|
||||
"total_size": 15442649088
|
||||
},
|
||||
"weight_map": {
|
||||
"lm_head.weight": "model-00008-of-00008.safetensors",
|
||||
"transformer.h.0.attn.c_attn.bias": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.0.attn.c_attn.weight": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.0.attn.c_proj.weight": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.0.ln_1.weight": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.0.ln_2.weight": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.0.mlp.c_proj.weight": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.0.mlp.w1.weight": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.0.mlp.w2.weight": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.1.attn.c_attn.bias": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.1.attn.c_attn.weight": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.1.attn.c_proj.weight": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.1.ln_1.weight": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.1.ln_2.weight": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.1.mlp.c_proj.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.1.mlp.w1.weight": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.1.mlp.w2.weight": "model-00001-of-00008.safetensors",
|
||||
"transformer.h.10.attn.c_attn.bias": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.10.attn.c_attn.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.10.attn.c_proj.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.10.ln_1.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.10.ln_2.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.10.mlp.c_proj.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.10.mlp.w1.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.10.mlp.w2.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.11.attn.c_attn.bias": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.11.attn.c_attn.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.11.attn.c_proj.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.11.ln_1.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.11.ln_2.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.11.mlp.c_proj.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.11.mlp.w1.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.11.mlp.w2.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.12.attn.c_attn.bias": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.12.attn.c_attn.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.12.attn.c_proj.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.12.ln_1.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.12.ln_2.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.12.mlp.c_proj.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.12.mlp.w1.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.12.mlp.w2.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.13.attn.c_attn.bias": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.13.attn.c_attn.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.13.attn.c_proj.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.13.ln_1.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.13.ln_2.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.13.mlp.c_proj.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.13.mlp.w1.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.13.mlp.w2.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.14.attn.c_attn.bias": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.14.attn.c_attn.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.14.attn.c_proj.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.14.ln_1.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.14.ln_2.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.14.mlp.c_proj.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.14.mlp.w1.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.14.mlp.w2.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.15.attn.c_attn.bias": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.15.attn.c_attn.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.15.attn.c_proj.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.15.ln_1.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.15.ln_2.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.15.mlp.c_proj.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.15.mlp.w1.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.15.mlp.w2.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.16.attn.c_attn.bias": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.16.attn.c_attn.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.16.attn.c_proj.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.16.ln_1.weight": "model-00004-of-00008.safetensors",
|
||||
"transformer.h.16.ln_2.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.16.mlp.c_proj.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.16.mlp.w1.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.16.mlp.w2.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.17.attn.c_attn.bias": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.17.attn.c_attn.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.17.attn.c_proj.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.17.ln_1.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.17.ln_2.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.17.mlp.c_proj.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.17.mlp.w1.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.17.mlp.w2.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.18.attn.c_attn.bias": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.18.attn.c_attn.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.18.attn.c_proj.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.18.ln_1.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.18.ln_2.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.18.mlp.c_proj.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.18.mlp.w1.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.18.mlp.w2.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.19.attn.c_attn.bias": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.19.attn.c_attn.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.19.attn.c_proj.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.19.ln_1.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.19.ln_2.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.19.mlp.c_proj.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.19.mlp.w1.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.19.mlp.w2.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.2.attn.c_attn.bias": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.2.attn.c_attn.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.2.attn.c_proj.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.2.ln_1.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.2.ln_2.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.2.mlp.c_proj.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.2.mlp.w1.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.2.mlp.w2.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.20.attn.c_attn.bias": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.20.attn.c_attn.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.20.attn.c_proj.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.20.ln_1.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.20.ln_2.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.20.mlp.c_proj.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.20.mlp.w1.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.20.mlp.w2.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.21.attn.c_attn.bias": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.21.attn.c_attn.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.21.attn.c_proj.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.21.ln_1.weight": "model-00005-of-00008.safetensors",
|
||||
"transformer.h.21.ln_2.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.21.mlp.c_proj.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.21.mlp.w1.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.21.mlp.w2.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.22.attn.c_attn.bias": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.22.attn.c_attn.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.22.attn.c_proj.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.22.ln_1.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.22.ln_2.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.22.mlp.c_proj.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.22.mlp.w1.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.22.mlp.w2.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.23.attn.c_attn.bias": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.23.attn.c_attn.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.23.attn.c_proj.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.23.ln_1.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.23.ln_2.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.23.mlp.c_proj.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.23.mlp.w1.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.23.mlp.w2.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.24.attn.c_attn.bias": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.24.attn.c_attn.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.24.attn.c_proj.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.24.ln_1.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.24.ln_2.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.24.mlp.c_proj.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.24.mlp.w1.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.24.mlp.w2.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.25.attn.c_attn.bias": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.25.attn.c_attn.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.25.attn.c_proj.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.25.ln_1.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.25.ln_2.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.25.mlp.c_proj.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.25.mlp.w1.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.25.mlp.w2.weight": "model-00006-of-00008.safetensors",
|
||||
"transformer.h.26.attn.c_attn.bias": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.26.attn.c_attn.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.26.attn.c_proj.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.26.ln_1.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.26.ln_2.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.26.mlp.c_proj.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.26.mlp.w1.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.26.mlp.w2.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.27.attn.c_attn.bias": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.27.attn.c_attn.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.27.attn.c_proj.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.27.ln_1.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.27.ln_2.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.27.mlp.c_proj.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.27.mlp.w1.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.27.mlp.w2.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.28.attn.c_attn.bias": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.28.attn.c_attn.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.28.attn.c_proj.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.28.ln_1.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.28.ln_2.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.28.mlp.c_proj.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.28.mlp.w1.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.28.mlp.w2.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.29.attn.c_attn.bias": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.29.attn.c_attn.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.29.attn.c_proj.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.29.ln_1.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.29.ln_2.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.29.mlp.c_proj.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.29.mlp.w1.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.29.mlp.w2.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.3.attn.c_attn.bias": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.3.attn.c_attn.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.3.attn.c_proj.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.3.ln_1.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.3.ln_2.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.3.mlp.c_proj.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.3.mlp.w1.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.3.mlp.w2.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.30.attn.c_attn.bias": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.30.attn.c_attn.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.30.attn.c_proj.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.30.ln_1.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.30.ln_2.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.30.mlp.c_proj.weight": "model-00008-of-00008.safetensors",
|
||||
"transformer.h.30.mlp.w1.weight": "model-00007-of-00008.safetensors",
|
||||
"transformer.h.30.mlp.w2.weight": "model-00008-of-00008.safetensors",
|
||||
"transformer.h.31.attn.c_attn.bias": "model-00008-of-00008.safetensors",
|
||||
"transformer.h.31.attn.c_attn.weight": "model-00008-of-00008.safetensors",
|
||||
"transformer.h.31.attn.c_proj.weight": "model-00008-of-00008.safetensors",
|
||||
"transformer.h.31.ln_1.weight": "model-00008-of-00008.safetensors",
|
||||
"transformer.h.31.ln_2.weight": "model-00008-of-00008.safetensors",
|
||||
"transformer.h.31.mlp.c_proj.weight": "model-00008-of-00008.safetensors",
|
||||
"transformer.h.31.mlp.w1.weight": "model-00008-of-00008.safetensors",
|
||||
"transformer.h.31.mlp.w2.weight": "model-00008-of-00008.safetensors",
|
||||
"transformer.h.4.attn.c_attn.bias": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.4.attn.c_attn.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.4.attn.c_proj.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.4.ln_1.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.4.ln_2.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.4.mlp.c_proj.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.4.mlp.w1.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.4.mlp.w2.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.5.attn.c_attn.bias": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.5.attn.c_attn.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.5.attn.c_proj.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.5.ln_1.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.5.ln_2.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.5.mlp.c_proj.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.5.mlp.w1.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.5.mlp.w2.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.6.attn.c_attn.bias": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.6.attn.c_attn.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.6.attn.c_proj.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.6.ln_1.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.6.ln_2.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.6.mlp.c_proj.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.6.mlp.w1.weight": "model-00002-of-00008.safetensors",
|
||||
"transformer.h.6.mlp.w2.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.7.attn.c_attn.bias": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.7.attn.c_attn.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.7.attn.c_proj.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.7.ln_1.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.7.ln_2.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.7.mlp.c_proj.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.7.mlp.w1.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.7.mlp.w2.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.8.attn.c_attn.bias": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.8.attn.c_attn.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.8.attn.c_proj.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.8.ln_1.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.8.ln_2.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.8.mlp.c_proj.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.8.mlp.w1.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.8.mlp.w2.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.9.attn.c_attn.bias": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.9.attn.c_attn.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.9.attn.c_proj.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.9.ln_1.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.9.ln_2.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.9.mlp.c_proj.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.9.mlp.w1.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.h.9.mlp.w2.weight": "model-00003-of-00008.safetensors",
|
||||
"transformer.ln_f.weight": "model-00008-of-00008.safetensors",
|
||||
"transformer.wte.weight": "model-00001-of-00008.safetensors"
|
||||
}
|
||||
}
|
||||
1207
modeling_qwen.py
Normal file
1207
modeling_qwen.py
Normal file
File diff suppressed because it is too large
Load Diff
3
pytorch_model-00001-of-00008.bin
Normal file
3
pytorch_model-00001-of-00008.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:57411e19ac6d2a4fdf5bdf8805c15d7311421355837d05e8c2f6808e1236c3ee
|
||||
size 1964070447
|
||||
3
pytorch_model-00002-of-00008.bin
Normal file
3
pytorch_model-00002-of-00008.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:92611b6f9a700768e734d2bbdbdb08eb137487ff617e2145e735b11c4ada81bb
|
||||
size 1933792141
|
||||
3
pytorch_model-00003-of-00008.bin
Normal file
3
pytorch_model-00003-of-00008.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:38cf4190866001b9b7d3d7ffdd2ca9217c2dbf11500e877c54b2bb52f4ad7e3e
|
||||
size 1933792141
|
||||
3
pytorch_model-00004-of-00008.bin
Normal file
3
pytorch_model-00004-of-00008.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f2aa44133346afaa9dbba1f63b7d7b7e13ae9a7eaea32cec42f73ece5b9bc42b
|
||||
size 1990406779
|
||||
3
pytorch_model-00005-of-00008.bin
Normal file
3
pytorch_model-00005-of-00008.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e328c5a773e05aef42609974d100dd5ac4b486eeb87158caecee53bfc48d8d40
|
||||
size 1923281531
|
||||
3
pytorch_model-00006-of-00008.bin
Normal file
3
pytorch_model-00006-of-00008.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f416635dba93201d4b3bfe2d2b5265947c4ebcbbf655bb952b223a1065795001
|
||||
size 1933783675
|
||||
3
pytorch_model-00007-of-00008.bin
Normal file
3
pytorch_model-00007-of-00008.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0aea713f9d724d1e9e2550db02480210029b17edf684c2fdd7cb3ed1d709075c
|
||||
size 1933792205
|
||||
3
pytorch_model-00008-of-00008.bin
Normal file
3
pytorch_model-00008-of-00008.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:71ac983c45804a5f820b8143042f1b3b9158ef2ba29971608eb6119c5a1c187c
|
||||
size 1829818663
|
||||
266
pytorch_model.bin.index.json
Normal file
266
pytorch_model.bin.index.json
Normal file
@@ -0,0 +1,266 @@
|
||||
{
|
||||
"metadata": {
|
||||
"total_size": 15442649088
|
||||
},
|
||||
"weight_map": {
|
||||
"lm_head.weight": "pytorch_model-00008-of-00008.bin",
|
||||
"transformer.h.0.attn.c_attn.bias": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.0.attn.c_attn.weight": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.0.attn.c_proj.weight": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.0.ln_1.weight": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.0.ln_2.weight": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.0.mlp.c_proj.weight": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.0.mlp.w1.weight": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.0.mlp.w2.weight": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.1.attn.c_attn.bias": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.1.attn.c_attn.weight": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.1.attn.c_proj.weight": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.1.ln_1.weight": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.1.ln_2.weight": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.1.mlp.c_proj.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.1.mlp.w1.weight": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.1.mlp.w2.weight": "pytorch_model-00001-of-00008.bin",
|
||||
"transformer.h.10.attn.c_attn.bias": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.10.attn.c_attn.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.10.attn.c_proj.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.10.ln_1.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.10.ln_2.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.10.mlp.c_proj.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.10.mlp.w1.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.10.mlp.w2.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.11.attn.c_attn.bias": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.11.attn.c_attn.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.11.attn.c_proj.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.11.ln_1.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.11.ln_2.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.11.mlp.c_proj.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.11.mlp.w1.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.11.mlp.w2.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.12.attn.c_attn.bias": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.12.attn.c_attn.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.12.attn.c_proj.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.12.ln_1.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.12.ln_2.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.12.mlp.c_proj.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.12.mlp.w1.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.12.mlp.w2.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.13.attn.c_attn.bias": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.13.attn.c_attn.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.13.attn.c_proj.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.13.ln_1.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.13.ln_2.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.13.mlp.c_proj.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.13.mlp.w1.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.13.mlp.w2.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.14.attn.c_attn.bias": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.14.attn.c_attn.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.14.attn.c_proj.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.14.ln_1.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.14.ln_2.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.14.mlp.c_proj.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.14.mlp.w1.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.14.mlp.w2.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.15.attn.c_attn.bias": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.15.attn.c_attn.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.15.attn.c_proj.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.15.ln_1.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.15.ln_2.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.15.mlp.c_proj.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.15.mlp.w1.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.15.mlp.w2.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.16.attn.c_attn.bias": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.16.attn.c_attn.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.16.attn.c_proj.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.16.ln_1.weight": "pytorch_model-00004-of-00008.bin",
|
||||
"transformer.h.16.ln_2.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.16.mlp.c_proj.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.16.mlp.w1.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.16.mlp.w2.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.17.attn.c_attn.bias": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.17.attn.c_attn.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.17.attn.c_proj.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.17.ln_1.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.17.ln_2.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.17.mlp.c_proj.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.17.mlp.w1.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.17.mlp.w2.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.18.attn.c_attn.bias": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.18.attn.c_attn.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.18.attn.c_proj.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.18.ln_1.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.18.ln_2.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.18.mlp.c_proj.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.18.mlp.w1.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.18.mlp.w2.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.19.attn.c_attn.bias": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.19.attn.c_attn.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.19.attn.c_proj.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.19.ln_1.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.19.ln_2.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.19.mlp.c_proj.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.19.mlp.w1.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.19.mlp.w2.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.2.attn.c_attn.bias": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.2.attn.c_attn.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.2.attn.c_proj.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.2.ln_1.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.2.ln_2.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.2.mlp.c_proj.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.2.mlp.w1.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.2.mlp.w2.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.20.attn.c_attn.bias": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.20.attn.c_attn.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.20.attn.c_proj.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.20.ln_1.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.20.ln_2.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.20.mlp.c_proj.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.20.mlp.w1.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.20.mlp.w2.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.21.attn.c_attn.bias": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.21.attn.c_attn.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.21.attn.c_proj.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.21.ln_1.weight": "pytorch_model-00005-of-00008.bin",
|
||||
"transformer.h.21.ln_2.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.21.mlp.c_proj.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.21.mlp.w1.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.21.mlp.w2.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.22.attn.c_attn.bias": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.22.attn.c_attn.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.22.attn.c_proj.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.22.ln_1.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.22.ln_2.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.22.mlp.c_proj.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.22.mlp.w1.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.22.mlp.w2.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.23.attn.c_attn.bias": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.23.attn.c_attn.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.23.attn.c_proj.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.23.ln_1.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.23.ln_2.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.23.mlp.c_proj.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.23.mlp.w1.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.23.mlp.w2.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.24.attn.c_attn.bias": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.24.attn.c_attn.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.24.attn.c_proj.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.24.ln_1.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.24.ln_2.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.24.mlp.c_proj.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.24.mlp.w1.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.24.mlp.w2.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.25.attn.c_attn.bias": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.25.attn.c_attn.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.25.attn.c_proj.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.25.ln_1.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.25.ln_2.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.25.mlp.c_proj.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.25.mlp.w1.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.25.mlp.w2.weight": "pytorch_model-00006-of-00008.bin",
|
||||
"transformer.h.26.attn.c_attn.bias": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.26.attn.c_attn.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.26.attn.c_proj.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.26.ln_1.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.26.ln_2.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.26.mlp.c_proj.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.26.mlp.w1.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.26.mlp.w2.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.27.attn.c_attn.bias": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.27.attn.c_attn.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.27.attn.c_proj.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.27.ln_1.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.27.ln_2.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.27.mlp.c_proj.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.27.mlp.w1.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.27.mlp.w2.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.28.attn.c_attn.bias": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.28.attn.c_attn.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.28.attn.c_proj.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.28.ln_1.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.28.ln_2.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.28.mlp.c_proj.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.28.mlp.w1.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.28.mlp.w2.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.29.attn.c_attn.bias": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.29.attn.c_attn.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.29.attn.c_proj.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.29.ln_1.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.29.ln_2.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.29.mlp.c_proj.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.29.mlp.w1.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.29.mlp.w2.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.3.attn.c_attn.bias": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.3.attn.c_attn.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.3.attn.c_proj.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.3.ln_1.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.3.ln_2.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.3.mlp.c_proj.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.3.mlp.w1.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.3.mlp.w2.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.30.attn.c_attn.bias": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.30.attn.c_attn.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.30.attn.c_proj.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.30.ln_1.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.30.ln_2.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.30.mlp.c_proj.weight": "pytorch_model-00008-of-00008.bin",
|
||||
"transformer.h.30.mlp.w1.weight": "pytorch_model-00007-of-00008.bin",
|
||||
"transformer.h.30.mlp.w2.weight": "pytorch_model-00008-of-00008.bin",
|
||||
"transformer.h.31.attn.c_attn.bias": "pytorch_model-00008-of-00008.bin",
|
||||
"transformer.h.31.attn.c_attn.weight": "pytorch_model-00008-of-00008.bin",
|
||||
"transformer.h.31.attn.c_proj.weight": "pytorch_model-00008-of-00008.bin",
|
||||
"transformer.h.31.ln_1.weight": "pytorch_model-00008-of-00008.bin",
|
||||
"transformer.h.31.ln_2.weight": "pytorch_model-00008-of-00008.bin",
|
||||
"transformer.h.31.mlp.c_proj.weight": "pytorch_model-00008-of-00008.bin",
|
||||
"transformer.h.31.mlp.w1.weight": "pytorch_model-00008-of-00008.bin",
|
||||
"transformer.h.31.mlp.w2.weight": "pytorch_model-00008-of-00008.bin",
|
||||
"transformer.h.4.attn.c_attn.bias": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.4.attn.c_attn.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.4.attn.c_proj.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.4.ln_1.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.4.ln_2.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.4.mlp.c_proj.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.4.mlp.w1.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.4.mlp.w2.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.5.attn.c_attn.bias": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.5.attn.c_attn.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.5.attn.c_proj.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.5.ln_1.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.5.ln_2.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.5.mlp.c_proj.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.5.mlp.w1.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.5.mlp.w2.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.6.attn.c_attn.bias": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.6.attn.c_attn.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.6.attn.c_proj.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.6.ln_1.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.6.ln_2.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.6.mlp.c_proj.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.6.mlp.w1.weight": "pytorch_model-00002-of-00008.bin",
|
||||
"transformer.h.6.mlp.w2.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.7.attn.c_attn.bias": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.7.attn.c_attn.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.7.attn.c_proj.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.7.ln_1.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.7.ln_2.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.7.mlp.c_proj.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.7.mlp.w1.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.7.mlp.w2.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.8.attn.c_attn.bias": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.8.attn.c_attn.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.8.attn.c_proj.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.8.ln_1.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.8.ln_2.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.8.mlp.c_proj.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.8.mlp.w1.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.8.mlp.w2.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.9.attn.c_attn.bias": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.9.attn.c_attn.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.9.attn.c_proj.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.9.ln_1.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.9.ln_2.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.9.mlp.c_proj.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.9.mlp.w1.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.h.9.mlp.w2.weight": "pytorch_model-00003-of-00008.bin",
|
||||
"transformer.ln_f.weight": "pytorch_model-00008-of-00008.bin",
|
||||
"transformer.wte.weight": "pytorch_model-00001-of-00008.bin"
|
||||
}
|
||||
}
|
||||
151643
qwen.tiktoken
Normal file
151643
qwen.tiktoken
Normal file
File diff suppressed because it is too large
Load Diff
416
qwen_generation_utils.py
Normal file
416
qwen_generation_utils.py
Normal file
@@ -0,0 +1,416 @@
|
||||
# Copyright (c) Alibaba Cloud.
|
||||
#
|
||||
# This source code is licensed under the license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
"""Generation support."""
|
||||
|
||||
from typing import Tuple, List, Union, Iterable
|
||||
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from transformers import PreTrainedTokenizer
|
||||
from transformers import logging
|
||||
from transformers.generation import LogitsProcessor
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
# Types.
|
||||
HistoryType = List[Tuple[str, str]]
|
||||
TokensType = List[int]
|
||||
BatchTokensType = List[List[int]]
|
||||
|
||||
|
||||
def pad_batch(batch: BatchTokensType, pad_id: int, seq_length: int) -> BatchTokensType:
|
||||
for tokens in batch:
|
||||
context_length = len(tokens)
|
||||
if context_length < seq_length:
|
||||
tokens.extend([pad_id] * (seq_length - context_length))
|
||||
return batch
|
||||
|
||||
|
||||
def get_ltor_masks_and_position_ids(
|
||||
data,
|
||||
eod_token,
|
||||
reset_position_ids,
|
||||
reset_attention_mask,
|
||||
eod_mask_loss,
|
||||
):
|
||||
"""Build masks and position id for left to right model."""
|
||||
|
||||
# Extract batch size and sequence length.
|
||||
micro_batch_size, seq_length = data.size()
|
||||
|
||||
# Attention mask (lower triangular).
|
||||
if reset_attention_mask:
|
||||
att_mask_batch = micro_batch_size
|
||||
else:
|
||||
att_mask_batch = 1
|
||||
attention_mask = torch.tril(
|
||||
torch.ones((att_mask_batch, seq_length, seq_length), device=data.device)
|
||||
).view(att_mask_batch, 1, seq_length, seq_length)
|
||||
|
||||
# Loss mask.
|
||||
loss_mask = torch.ones(data.size(), dtype=torch.float, device=data.device)
|
||||
if eod_mask_loss:
|
||||
loss_mask[data == eod_token] = 0.0
|
||||
|
||||
# Position ids.
|
||||
position_ids = torch.arange(seq_length, dtype=torch.long, device=data.device)
|
||||
position_ids = position_ids.unsqueeze(0).expand_as(data)
|
||||
# We need to clone as the ids will be modifed based on batch index.
|
||||
if reset_position_ids:
|
||||
position_ids = position_ids.clone()
|
||||
|
||||
if reset_position_ids or reset_attention_mask:
|
||||
# Loop through the batches:
|
||||
for b in range(micro_batch_size):
|
||||
|
||||
# Find indecies where EOD token is.
|
||||
eod_index = position_ids[b, data[b] == eod_token]
|
||||
# Detach indecies from positions if going to modify positions.
|
||||
if reset_position_ids:
|
||||
eod_index = eod_index.clone()
|
||||
|
||||
# Loop through EOD indecies:
|
||||
prev_index = 0
|
||||
for j in range(eod_index.size()[0]):
|
||||
i = eod_index[j]
|
||||
# Mask attention loss.
|
||||
if reset_attention_mask:
|
||||
attention_mask[b, 0, (i + 1) :, : (i + 1)] = 0
|
||||
# Reset positions.
|
||||
if reset_position_ids:
|
||||
position_ids[b, (i + 1) :] -= i + 1 - prev_index
|
||||
prev_index = i + 1
|
||||
|
||||
# Convert attention mask to binary:
|
||||
attention_mask = attention_mask < 0.5
|
||||
|
||||
return attention_mask, loss_mask, position_ids
|
||||
|
||||
|
||||
def get_batch(context_tokens: torch.LongTensor, eod_id: int):
|
||||
"""Generate batch from context tokens."""
|
||||
# Move to GPU.
|
||||
tokens = context_tokens.contiguous().to(context_tokens.device)
|
||||
# Get the attention mask and postition ids.
|
||||
attention_mask, _, position_ids = get_ltor_masks_and_position_ids(
|
||||
tokens,
|
||||
eod_id,
|
||||
reset_position_ids=False,
|
||||
reset_attention_mask=False,
|
||||
eod_mask_loss=False,
|
||||
)
|
||||
return tokens, attention_mask, position_ids
|
||||
|
||||
|
||||
def get_stop_words_ids(chat_format, tokenizer):
|
||||
if chat_format == "raw":
|
||||
stop_words_ids = [tokenizer.encode("Human:"), [tokenizer.eod_id]]
|
||||
elif chat_format == "chatml":
|
||||
stop_words_ids = [[tokenizer.im_end_id], [tokenizer.im_start_id]]
|
||||
else:
|
||||
raise NotImplementedError(f"Unknown chat format {chat_format!r}")
|
||||
return stop_words_ids
|
||||
|
||||
|
||||
def make_context(
|
||||
tokenizer: PreTrainedTokenizer,
|
||||
query: str,
|
||||
history: List[Tuple[str, str]] = None,
|
||||
system: str = "",
|
||||
max_window_size: int = 6144,
|
||||
chat_format: str = "chatml",
|
||||
):
|
||||
if history is None:
|
||||
history = []
|
||||
|
||||
if chat_format == "chatml":
|
||||
im_start, im_end = "<|im_start|>", "<|im_end|>"
|
||||
im_start_tokens = [tokenizer.im_start_id]
|
||||
im_end_tokens = [tokenizer.im_end_id]
|
||||
nl_tokens = tokenizer.encode("\n")
|
||||
|
||||
def _tokenize_str(role, content):
|
||||
return f"{role}\n{content}", tokenizer.encode(
|
||||
role, allowed_special=set()
|
||||
) + nl_tokens + tokenizer.encode(content, allowed_special=set())
|
||||
|
||||
system_text, system_tokens_part = _tokenize_str("system", system)
|
||||
system_tokens = im_start_tokens + system_tokens_part + im_end_tokens
|
||||
|
||||
raw_text = ""
|
||||
context_tokens = []
|
||||
|
||||
for turn_query, turn_response in reversed(history):
|
||||
query_text, query_tokens_part = _tokenize_str("user", turn_query)
|
||||
query_tokens = im_start_tokens + query_tokens_part + im_end_tokens
|
||||
response_text, response_tokens_part = _tokenize_str(
|
||||
"assistant", turn_response
|
||||
)
|
||||
response_tokens = im_start_tokens + response_tokens_part + im_end_tokens
|
||||
|
||||
next_context_tokens = nl_tokens + query_tokens + nl_tokens + response_tokens
|
||||
prev_chat = (
|
||||
f"\n{im_start}{query_text}{im_end}\n{im_start}{response_text}{im_end}"
|
||||
)
|
||||
|
||||
current_context_size = (
|
||||
len(system_tokens) + len(next_context_tokens) + len(context_tokens)
|
||||
)
|
||||
if current_context_size < max_window_size:
|
||||
context_tokens = next_context_tokens + context_tokens
|
||||
raw_text = prev_chat + raw_text
|
||||
else:
|
||||
break
|
||||
|
||||
context_tokens = system_tokens + context_tokens
|
||||
raw_text = f"{im_start}{system_text}{im_end}" + raw_text
|
||||
context_tokens += (
|
||||
nl_tokens
|
||||
+ im_start_tokens
|
||||
+ _tokenize_str("user", query)[1]
|
||||
+ im_end_tokens
|
||||
+ nl_tokens
|
||||
+ im_start_tokens
|
||||
+ tokenizer.encode("assistant")
|
||||
+ nl_tokens
|
||||
)
|
||||
raw_text += f"\n{im_start}user\n{query}{im_end}\n{im_start}assistant\n"
|
||||
|
||||
elif chat_format == "raw":
|
||||
raw_text = query
|
||||
context_tokens = tokenizer.encode(raw_text)
|
||||
else:
|
||||
raise NotImplementedError(f"Unknown chat format {chat_format!r}")
|
||||
|
||||
return raw_text, context_tokens
|
||||
|
||||
|
||||
def _decode_default(
|
||||
tokens: List[int],
|
||||
*,
|
||||
stop_words: List[str],
|
||||
eod_words: List[str],
|
||||
tokenizer: PreTrainedTokenizer,
|
||||
raw_text_len: int,
|
||||
verbose: bool = False,
|
||||
return_end_reason: bool = False,
|
||||
errors: str='replace',
|
||||
):
|
||||
trim_decode_tokens = tokenizer.decode(tokens, errors=errors)[raw_text_len:]
|
||||
if verbose:
|
||||
print("\nRaw Generate: ", trim_decode_tokens)
|
||||
|
||||
end_reason = f"Gen length {len(tokens)}"
|
||||
for stop_word in stop_words:
|
||||
trim_decode_tokens = trim_decode_tokens.replace(stop_word, "").strip()
|
||||
for eod_word in eod_words:
|
||||
if eod_word in trim_decode_tokens:
|
||||
end_reason = f"Gen {eod_word!r}"
|
||||
trim_decode_tokens = trim_decode_tokens.split(eod_word)[0]
|
||||
trim_decode_tokens = trim_decode_tokens.strip()
|
||||
if verbose:
|
||||
print("\nEnd Reason:", end_reason)
|
||||
print("\nGenerate: ", trim_decode_tokens)
|
||||
|
||||
if return_end_reason:
|
||||
return trim_decode_tokens, end_reason
|
||||
else:
|
||||
return trim_decode_tokens
|
||||
|
||||
|
||||
def _decode_chatml(
|
||||
tokens: List[int],
|
||||
*,
|
||||
stop_words: List[str],
|
||||
eod_token_ids: List[int],
|
||||
tokenizer: PreTrainedTokenizer,
|
||||
raw_text_len: int,
|
||||
context_length: int,
|
||||
verbose: bool = False,
|
||||
return_end_reason: bool = False,
|
||||
errors: str='replace'
|
||||
):
|
||||
end_reason = f"Gen length {len(tokens)}"
|
||||
eod_token_idx = context_length
|
||||
for eod_token_idx in range(context_length, len(tokens)):
|
||||
if tokens[eod_token_idx] in eod_token_ids:
|
||||
end_reason = f"Gen {tokenizer.decode([tokens[eod_token_idx]])!r}"
|
||||
break
|
||||
|
||||
trim_decode_tokens = tokenizer.decode(tokens[:eod_token_idx], errors=errors)[raw_text_len:]
|
||||
if verbose:
|
||||
print("\nRaw Generate w/o EOD:", tokenizer.decode(tokens, errors=errors)[raw_text_len:])
|
||||
print("\nRaw Generate:", trim_decode_tokens)
|
||||
print("\nEnd Reason:", end_reason)
|
||||
for stop_word in stop_words:
|
||||
trim_decode_tokens = trim_decode_tokens.replace(stop_word, "").strip()
|
||||
trim_decode_tokens = trim_decode_tokens.strip()
|
||||
if verbose:
|
||||
print("\nGenerate:", trim_decode_tokens)
|
||||
|
||||
if return_end_reason:
|
||||
return trim_decode_tokens, end_reason
|
||||
else:
|
||||
return trim_decode_tokens
|
||||
|
||||
|
||||
def decode_tokens(
|
||||
tokens: Union[torch.LongTensor, TokensType],
|
||||
tokenizer: PreTrainedTokenizer,
|
||||
raw_text_len: int,
|
||||
context_length: int,
|
||||
chat_format: str,
|
||||
verbose: bool = False,
|
||||
return_end_reason: bool = False,
|
||||
errors: str="replace",
|
||||
) -> str:
|
||||
if torch.is_tensor(tokens):
|
||||
tokens = tokens.cpu().numpy().tolist()
|
||||
|
||||
if chat_format == "chatml":
|
||||
return _decode_chatml(
|
||||
tokens,
|
||||
stop_words=[],
|
||||
eod_token_ids=[tokenizer.im_start_id, tokenizer.im_end_id],
|
||||
tokenizer=tokenizer,
|
||||
raw_text_len=raw_text_len,
|
||||
context_length=context_length,
|
||||
verbose=verbose,
|
||||
return_end_reason=return_end_reason,
|
||||
errors=errors,
|
||||
)
|
||||
elif chat_format == "raw":
|
||||
return _decode_default(
|
||||
tokens,
|
||||
stop_words=["<|endoftext|>"],
|
||||
eod_words=["<|endoftext|>"],
|
||||
tokenizer=tokenizer,
|
||||
raw_text_len=raw_text_len,
|
||||
verbose=verbose,
|
||||
return_end_reason=return_end_reason,
|
||||
errors=errors,
|
||||
)
|
||||
else:
|
||||
raise NotImplementedError(f"Unknown chat format {chat_format!r}")
|
||||
|
||||
|
||||
class StopWordsLogitsProcessor(LogitsProcessor):
|
||||
"""
|
||||
:class:`transformers.LogitsProcessor` that enforces that when specified sequences appear, stop geration.
|
||||
|
||||
Args:
|
||||
stop_words_ids (:obj:`List[List[int]]`):
|
||||
List of list of token ids of stop ids. In order to get the tokens of the words
|
||||
that should not appear in the generated text, use :obj:`tokenizer(bad_word,
|
||||
add_prefix_space=True).input_ids`.
|
||||
eos_token_id (:obj:`int`):
|
||||
The id of the `end-of-sequence` token.
|
||||
"""
|
||||
|
||||
def __init__(self, stop_words_ids: Iterable[Iterable[int]], eos_token_id: int):
|
||||
|
||||
if not isinstance(stop_words_ids, List) or len(stop_words_ids) == 0:
|
||||
raise ValueError(
|
||||
f"`stop_words_ids` has to be a non-emtpy list, but is {stop_words_ids}."
|
||||
)
|
||||
if any(not isinstance(bad_word_ids, list) for bad_word_ids in stop_words_ids):
|
||||
raise ValueError(
|
||||
f"`stop_words_ids` has to be a list of lists, but is {stop_words_ids}."
|
||||
)
|
||||
if any(
|
||||
any(
|
||||
(not isinstance(token_id, (int, np.integer)) or token_id < 0)
|
||||
for token_id in stop_word_ids
|
||||
)
|
||||
for stop_word_ids in stop_words_ids
|
||||
):
|
||||
raise ValueError(
|
||||
f"Each list in `stop_words_ids` has to be a list of positive integers, but is {stop_words_ids}."
|
||||
)
|
||||
|
||||
self.stop_words_ids = list(
|
||||
filter(
|
||||
lambda bad_token_seq: bad_token_seq != [eos_token_id], stop_words_ids
|
||||
)
|
||||
)
|
||||
self.eos_token_id = eos_token_id
|
||||
for stop_token_seq in self.stop_words_ids:
|
||||
assert (
|
||||
len(stop_token_seq) > 0
|
||||
), "Stop words token sequences {} cannot have an empty list".format(
|
||||
stop_words_ids
|
||||
)
|
||||
|
||||
def __call__(
|
||||
self, input_ids: torch.LongTensor, scores: torch.FloatTensor
|
||||
) -> torch.FloatTensor:
|
||||
stopped_samples = self._calc_stopped_samples(input_ids)
|
||||
for i, should_stop in enumerate(stopped_samples):
|
||||
if should_stop:
|
||||
scores[i, self.eos_token_id] = float(2**15)
|
||||
return scores
|
||||
|
||||
def _tokens_match(self, prev_tokens: torch.LongTensor, tokens: List[int]) -> bool:
|
||||
if len(tokens) == 0:
|
||||
# if bad word tokens is just one token always ban it
|
||||
return True
|
||||
elif len(tokens) > len(prev_tokens):
|
||||
# if bad word tokens are longer then prev input_ids they can't be equal
|
||||
return False
|
||||
elif prev_tokens[-len(tokens) :].tolist() == tokens:
|
||||
# if tokens match
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def _calc_stopped_samples(self, prev_input_ids: Iterable[int]) -> Iterable[int]:
|
||||
stopped_samples = []
|
||||
for prev_input_ids_slice in prev_input_ids:
|
||||
match = False
|
||||
for stop_token_seq in self.stop_words_ids:
|
||||
if self._tokens_match(prev_input_ids_slice, stop_token_seq):
|
||||
# if tokens do not match continue
|
||||
match = True
|
||||
break
|
||||
stopped_samples.append(match)
|
||||
|
||||
return stopped_samples
|
||||
|
||||
|
||||
def top_k_logits(logits, top_k=0, top_p=0.0, filter_value=-float("Inf")):
|
||||
"""This function has been mostly taken from huggingface conversational
|
||||
ai code at
|
||||
https://medium.com/huggingface/how-to-build-a-state-of-the-art-
|
||||
conversational-ai-with-transfer-learning-2d818ac26313"""
|
||||
|
||||
if top_k > 0:
|
||||
# Remove all tokens with a probability less than the
|
||||
# last token of the top-k
|
||||
indices_to_remove = logits < torch.topk(logits, top_k)[0][..., -1, None]
|
||||
logits[indices_to_remove] = filter_value
|
||||
|
||||
if top_p > 0.0:
|
||||
# Cconvert to 1D
|
||||
sorted_logits, sorted_indices = torch.sort(logits, descending=True, dim=-1)
|
||||
cumulative_probs = torch.cumsum(F.softmax(sorted_logits, dim=-1), dim=-1)
|
||||
|
||||
# Remove tokens with cumulative probability above the threshold
|
||||
sorted_indices_to_remove = cumulative_probs > top_p
|
||||
# Shift the indices to the right to keep also the first token
|
||||
# above the threshold
|
||||
sorted_indices_to_remove[..., 1:] = sorted_indices_to_remove[..., :-1].clone()
|
||||
sorted_indices_to_remove[..., 0] = 0
|
||||
for i in range(sorted_indices.size(0)):
|
||||
indices_to_remove = sorted_indices[i][sorted_indices_to_remove[i]]
|
||||
logits[i][indices_to_remove] = filter_value
|
||||
|
||||
return logits
|
||||
|
||||
|
||||
def switch(val1, val2, boolean):
|
||||
boolean = boolean.type_as(val1)
|
||||
return (1 - boolean) * val1 + boolean * val2
|
||||
1
special_tokens_map.json
Normal file
1
special_tokens_map.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
228
tokenization_qwen.py
Normal file
228
tokenization_qwen.py
Normal file
@@ -0,0 +1,228 @@
|
||||
# Copyright (c) Alibaba Cloud.
|
||||
#
|
||||
# This source code is licensed under the license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
"""Tokenization classes for QWen."""
|
||||
|
||||
import base64
|
||||
import logging
|
||||
import os
|
||||
import unicodedata
|
||||
from typing import Collection, Dict, List, Set, Tuple, Union
|
||||
|
||||
import tiktoken
|
||||
from transformers import PreTrainedTokenizer, AddedToken
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "qwen.tiktoken"}
|
||||
|
||||
PAT_STR = r"""(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+"""
|
||||
ENDOFTEXT = "<|endoftext|>"
|
||||
IMSTART = "<|im_start|>"
|
||||
IMEND = "<|im_end|>"
|
||||
# as the default behavior is changed to allow special tokens in
|
||||
# regular texts, the surface forms of special tokens need to be
|
||||
# as different as possible to minimize the impact
|
||||
EXTRAS = tuple((f"<|extra_{i}|>" for i in range(205)))
|
||||
SPECIAL_TOKENS = (
|
||||
ENDOFTEXT,
|
||||
IMSTART,
|
||||
IMEND,
|
||||
) + EXTRAS
|
||||
|
||||
|
||||
def _load_tiktoken_bpe(tiktoken_bpe_file: str) -> Dict[bytes, int]:
|
||||
with open(tiktoken_bpe_file, "rb") as f:
|
||||
contents = f.read()
|
||||
return {
|
||||
base64.b64decode(token): int(rank)
|
||||
for token, rank in (line.split() for line in contents.splitlines() if line)
|
||||
}
|
||||
|
||||
class QWenTokenizer(PreTrainedTokenizer):
|
||||
"""QWen tokenizer."""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
vocab_file,
|
||||
errors="replace",
|
||||
**kwargs,
|
||||
):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
self.errors = errors # how to handle errors in decoding
|
||||
|
||||
self.mergeable_ranks = _load_tiktoken_bpe(vocab_file) # type: dict[bytes, int]
|
||||
self.special_tokens = {
|
||||
token: index
|
||||
for index, token in enumerate(
|
||||
SPECIAL_TOKENS, start=len(self.mergeable_ranks)
|
||||
)
|
||||
}
|
||||
|
||||
enc = tiktoken.Encoding(
|
||||
"Qwen",
|
||||
pat_str=PAT_STR,
|
||||
mergeable_ranks=self.mergeable_ranks,
|
||||
special_tokens=self.special_tokens,
|
||||
)
|
||||
assert (
|
||||
len(self.mergeable_ranks) + len(self.special_tokens) == enc.n_vocab
|
||||
), f"{len(self.mergeable_ranks) + len(self.special_tokens)} != {enc.n_vocab} in encoding"
|
||||
|
||||
self.decoder = {
|
||||
v: k for k, v in self.mergeable_ranks.items()
|
||||
} # type: dict[int, bytes|str]
|
||||
self.decoder.update({v: k for k, v in self.special_tokens.items()})
|
||||
|
||||
self.tokenizer = enc # type: tiktoken.Encoding
|
||||
|
||||
self.eod_id = self.tokenizer.eot_token
|
||||
self.im_start_id = self.special_tokens[IMSTART]
|
||||
self.im_end_id = self.special_tokens[IMEND]
|
||||
|
||||
def __len__(self) -> int:
|
||||
return self.tokenizer.n_vocab
|
||||
|
||||
def get_vocab(self) -> Dict[bytes, int]:
|
||||
return self.mergeable_ranks
|
||||
|
||||
def convert_tokens_to_ids(
|
||||
self, tokens: Union[bytes, str, List[Union[bytes, str]]]
|
||||
) -> List[int]:
|
||||
ids = []
|
||||
if isinstance(tokens, (str, bytes)):
|
||||
if tokens in self.special_tokens:
|
||||
return self.special_tokens[tokens]
|
||||
else:
|
||||
return self.mergeable_ranks.get(tokens)
|
||||
for token in tokens:
|
||||
if token in self.special_tokens:
|
||||
ids.append(self.special_tokens[token])
|
||||
else:
|
||||
ids.append(self.mergeable_ranks.get(token))
|
||||
return ids
|
||||
|
||||
def _add_tokens(self, new_tokens: Union[List[str], List[AddedToken]], special_tokens: bool = False) -> int:
|
||||
if not special_tokens and new_tokens:
|
||||
raise ValueError('Adding regular tokens is not supported')
|
||||
for token in new_tokens:
|
||||
surface_form = token.content if isinstance(token, AddedToken) else token
|
||||
if surface_form not in SPECIAL_TOKENS:
|
||||
raise ValueError('Adding unknown special tokens is not supported')
|
||||
return 0
|
||||
|
||||
def save_vocabulary(self, save_directory: str, **kwargs) -> Tuple[str]:
|
||||
"""
|
||||
Save only the vocabulary of the tokenizer (vocabulary).
|
||||
|
||||
Returns:
|
||||
`Tuple(str)`: Paths to the files saved.
|
||||
"""
|
||||
file_path = os.path.join(save_directory, "qwen.tiktoken")
|
||||
with open(file_path, "w", encoding="utf8") as w:
|
||||
for k, v in self.mergeable_ranks.items():
|
||||
line = base64.b64encode(k).decode("utf8") + " " + str(v) + "\n"
|
||||
w.write(line)
|
||||
return (file_path,)
|
||||
|
||||
def tokenize(
|
||||
self,
|
||||
text: str,
|
||||
allowed_special: Union[Set, str] = "all",
|
||||
disallowed_special: Union[Collection, str] = (),
|
||||
**kwargs,
|
||||
) -> List[Union[bytes, str]]:
|
||||
"""
|
||||
Converts a string in a sequence of tokens.
|
||||
|
||||
Args:
|
||||
text (`str`):
|
||||
The sequence to be encoded.
|
||||
allowed_special (`Literal["all"]` or `set`):
|
||||
The surface forms of the tokens to be encoded as special tokens in regular texts.
|
||||
Default to "all".
|
||||
disallowed_special (`Literal["all"]` or `Collection`):
|
||||
The surface forms of the tokens that should not be in regular texts and trigger errors.
|
||||
Default to an empty tuple.
|
||||
|
||||
kwargs (additional keyword arguments, *optional*):
|
||||
Will be passed to the underlying model specific encode method.
|
||||
|
||||
Returns:
|
||||
`List[bytes|str]`: The list of tokens.
|
||||
"""
|
||||
tokens = []
|
||||
text = unicodedata.normalize("NFC", text)
|
||||
|
||||
# this implementation takes a detour: text -> token id -> token surface forms
|
||||
for t in self.tokenizer.encode(
|
||||
text, allowed_special=allowed_special, disallowed_special=disallowed_special
|
||||
):
|
||||
tokens.append(self.decoder[t])
|
||||
return tokens
|
||||
|
||||
def convert_tokens_to_string(self, tokens: List[Union[bytes, str]]) -> str:
|
||||
"""
|
||||
Converts a sequence of tokens in a single string.
|
||||
"""
|
||||
text = ""
|
||||
temp = b""
|
||||
for t in tokens:
|
||||
if isinstance(t, str):
|
||||
if temp:
|
||||
text += temp.decode("utf-8", errors=self.errors)
|
||||
temp = b""
|
||||
text += t
|
||||
elif isinstance(t, bytes):
|
||||
temp += t
|
||||
else:
|
||||
raise TypeError("token should only be of type types or str")
|
||||
if temp:
|
||||
text += temp.decode("utf-8", errors=self.errors)
|
||||
return text
|
||||
|
||||
@property
|
||||
def vocab_size(self):
|
||||
return self.tokenizer.n_vocab
|
||||
|
||||
def _convert_id_to_token(self, index: int) -> Union[bytes, str]:
|
||||
"""Converts an id to a token, special tokens included"""
|
||||
if index in self.decoder:
|
||||
return self.decoder[index]
|
||||
raise ValueError("unknown ids")
|
||||
|
||||
def _convert_token_to_id(self, token: Union[bytes, str]) -> int:
|
||||
"""Converts a token to an id using the vocab, special tokens included"""
|
||||
if token in self.special_tokens:
|
||||
return self.special_tokens[token]
|
||||
if token in self.mergeable_ranks:
|
||||
return self.mergeable_ranks[token]
|
||||
raise ValueError("unknown token")
|
||||
|
||||
def _tokenize(self, text: str, **kwargs):
|
||||
"""
|
||||
Converts a string in a sequence of tokens (string), using the tokenizer. Split in words for word-based
|
||||
vocabulary or sub-words for sub-word-based vocabularies (BPE/SentencePieces/WordPieces).
|
||||
|
||||
Do NOT take care of added tokens.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def _decode(
|
||||
self,
|
||||
token_ids: Union[int, List[int]],
|
||||
skip_special_tokens: bool = False,
|
||||
errors: str = None,
|
||||
**kwargs,
|
||||
) -> str:
|
||||
if isinstance(token_ids, int):
|
||||
token_ids = [token_ids]
|
||||
if skip_special_tokens:
|
||||
token_ids = [i for i in token_ids if i < self.eod_id]
|
||||
return self.tokenizer.decode(token_ids, errors=errors or self.errors)
|
||||
11
tokenizer_config.json
Normal file
11
tokenizer_config.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"auto_map": {
|
||||
"AutoTokenizer": [
|
||||
"tokenization_qwen.QWenTokenizer",
|
||||
null
|
||||
]
|
||||
},
|
||||
"clean_up_tokenization_spaces": true,
|
||||
"model_max_length": 8192,
|
||||
"tokenizer_class": "QWenTokenizer"
|
||||
}
|
||||
Reference in New Issue
Block a user