初始化项目,由ModelHub XC社区提供模型
Model: AI4Chem/ChemLLM-20B-Chat-DPO 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
|
||||
161
README.md
Normal file
161
README.md
Normal file
@@ -0,0 +1,161 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
pipeline_tag: text-generation
|
||||
tags:
|
||||
- chemistry
|
||||
language:
|
||||
- en
|
||||
- zh
|
||||
---
|
||||
# ChemLLM-20B-Chat: LLM for Chemistry and Molecule Science
|
||||
|
||||
|
||||
ChemLLM, The First Open-source Large Language Model for Chemistry and Molecule Science, Build based on InternLM-2 with ❤
|
||||
[](https://huggingface.co/papers/2402.06852)
|
||||
|
||||
<center><img src='https://cdn-uploads.huggingface.co/production/uploads/64bce15bafd1e46c5504ad38/wdFV6p3rTBCtskbeuVwNJ.png'></center>
|
||||
|
||||
## News
|
||||
- ChemLLM-1.5 released! Two versions are available [AI4Chem/ChemLLM-7B-Chat-1.5-DPO](https://huggingface.co/AI4Chem/ChemLLM-7B-Chat-1.5-DPO) or [AI4Chem/ChemLLM-7B-Chat-1.5-SFT](https://huggingface.co/AI4Chem/ChemLLM-7B-Chat-1.5-SFT).[2024-4-2]
|
||||
- ChemLLM-1.5 updated! Have a try on [Demo Site](https://chemllm.org/#/chat) or [API Reference](https://api.chemllm.org/docs).[2024-3-23]
|
||||
- ChemLLM has been featured by HuggingFace on [“Daily Papers” page](https://huggingface.co/papers/2402.06852).[2024-2-13]
|
||||
- ChemLLM arXiv preprint released.[ChemLLM: A Chemical Large Language Model](https://arxiv.org/abs/2402.06852)[2024-2-10]
|
||||
- News report from [Shanghai AI Lab](https://mp.weixin.qq.com/s/u-i7lQxJzrytipek4a87fw)[2024-1-26]
|
||||
- ChemLLM-7B-Chat ver 1.0 released. https://chemllm.org/ [2024-1-18]
|
||||
- ChemLLM-7B-Chat ver 1.0 open-sourced.[2024-1-17]
|
||||
- Chepybara ver 0.2 online Demo released. https://chemllm.org/ [2023-12-9]
|
||||
|
||||
## Usage
|
||||
Try [online demo](https://chemllm.org/) instantly, or...
|
||||
|
||||
Install `transformers`,
|
||||
```
|
||||
pip install transformers
|
||||
```
|
||||
Load `ChemLLM-20B-Chat` and run,
|
||||
```
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
|
||||
import torch
|
||||
|
||||
model_name_or_id = "AI4Chem/ChemLLM-20B-Chat-DPO"
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained(model_name_or_id, torch_dtype=torch.float16, device_map="auto",trust_remote_code=True)
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_name_or_id,trust_remote_code=True)
|
||||
|
||||
prompt = "What is Molecule of Ibuprofen?"
|
||||
|
||||
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
||||
|
||||
generation_config = GenerationConfig(
|
||||
do_sample=True,
|
||||
top_k=1,
|
||||
temperature=0.9,
|
||||
max_new_tokens=500,
|
||||
repetition_penalty=1.5,
|
||||
pad_token_id=tokenizer.eos_token_id
|
||||
)
|
||||
|
||||
outputs = model.generate(**inputs, generation_config=generation_config)
|
||||
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
||||
```
|
||||
|
||||
## System Prompt Best Practice
|
||||
You can use the same Dialogue Templates and System Prompt from [Agent Chepybara](https://chemllm.org/) to get a better response in local inference.
|
||||
### Dialogue Templates
|
||||
|
||||
For queries in ShareGPT format like,
|
||||
```
|
||||
{'instruction':"...","prompt":"...","answer":"...","history":[[q1,a1],[q2,a2]]}
|
||||
```
|
||||
You can format it into this InternLM2 Dialogue format like,
|
||||
```
|
||||
def InternLM2_format(instruction,prompt,answer,history):
|
||||
prefix_template=[
|
||||
"<|im_start|>system\n",
|
||||
"{}",
|
||||
"<|im_end|>\n"
|
||||
]
|
||||
prompt_template=[
|
||||
"<|im_start|>user\n",
|
||||
"{}",
|
||||
"<|im_end|>\n"
|
||||
"<|im_start|>assistant\n",
|
||||
"{}",
|
||||
"<|im_end|>\n"
|
||||
]
|
||||
system = f'{prefix_template[0]}{prefix_template[1].format(instruction)}{prefix_template[2]}'
|
||||
history = "".join([f'{prompt_template[0]}{prompt_template[1].format(qa[0])}{prompt_template[2]}{prompt_template[3]}{prompt_template[4].format(qa[1])}{prompt_template[5]}' for qa in history])
|
||||
prompt = f'{prompt_template[0]}{prompt_template[1].format(prompt)}{prompt_template[2]}{prompt_template[3]}'
|
||||
return f"{system}{history}{prompt}"
|
||||
```
|
||||
And there is a good example for system prompt,
|
||||
```
|
||||
- Chepybara is a conversational language model that is developed by Shanghai AI Laboratory (上海人工智能实验室). It is designed to be Professional, Sophisticated, and Chemical-centric.
|
||||
- For uncertain notions and data, Chepybara always assumes it with theoretical prediction and notices users then.
|
||||
- Chepybara can accept SMILES (Simplified Molecular Input Line Entry System) string, and prefer output IUPAC names (International Union of Pure and Applied Chemistry nomenclature of organic chemistry), depict reactions in SMARTS (SMILES arbitrary target specification) string. Self-Referencing Embedded Strings (SELFIES) are also accepted.
|
||||
- Chepybara always solves problems and thinks in step-by-step fashion, Output begin with *Let's think step by step*."
|
||||
```
|
||||
|
||||
## Results
|
||||
### MMLU Highlights
|
||||
|
||||
| dataset | ChatGLM3-6B | Qwen-7B | LLaMA-2-7B | Mistral-7B | InternLM2-7B-Chat | ChemLLM-7B-Chat |
|
||||
| ---------------------- | ----------- | ------- | ---------- | ---------- | ----------------- | ----------------- |
|
||||
| college chemistry | 43.0 | 39.0 | 27.0 | 40.0 | 43.0 | 47.0 |
|
||||
| college mathematics | 28.0 | 33.0 | 33.0 | 30.0 | 36.0 | 41.0 |
|
||||
| college physics | 32.4 | 35.3 | 25.5 | 34.3 | 41.2 | 48.0 |
|
||||
| formal logic | 35.7 | 43.7 | 24.6 | 40.5 | 34.9 | 47.6 |
|
||||
| moral scenarios | 26.4 | 35.0 | 24.1 | 39.9 | 38.6 | 44.3 |
|
||||
| humanities average | 62.7 | 62.5 | 51.7 | 64.5 | 66.5 | 68.6 |
|
||||
| stem average | 46.5 | 45.8 | 39.0 | 47.8 | 52.2 | 52.6 |
|
||||
| social science average | 68.2 | 65.8 | 55.5 | 68.1 | 69.7 | 71.9 |
|
||||
| other average | 60.5 | 60.3 | 51.3 | 62.4 | 63.2 | 65.2 |
|
||||
| mmlu | 58.0 | 57.1 | 48.2 | 59.2 | 61.7 | 63.2 |
|
||||
*(OpenCompass)
|
||||
|
||||

|
||||
|
||||
|
||||
### Chemical Benchmark
|
||||
|
||||

|
||||
*(Score judged by ChatGPT-4-turbo)
|
||||
|
||||
### Professional Translation
|
||||
|
||||

|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
You can try it [online](chemllm.org).
|
||||
|
||||
## Cite this work
|
||||
```
|
||||
@misc{zhang2024chemllm,
|
||||
title={ChemLLM: A Chemical Large Language Model},
|
||||
author={Di Zhang and Wei Liu and Qian Tan and Jingdan Chen and Hang Yan and Yuliang Yan and Jiatong Li and Weiran Huang and Xiangyu Yue and Dongzhan Zhou and Shufei Zhang and Mao Su and Hansen Zhong and Yuqiang Li and Wanli Ouyang},
|
||||
year={2024},
|
||||
eprint={2402.06852},
|
||||
archivePrefix={arXiv},
|
||||
primaryClass={cs.AI}
|
||||
}
|
||||
```
|
||||
|
||||
## Disclaimer
|
||||
|
||||
LLM may generate incorrect answers, Please pay attention to proofreading at your own risk.
|
||||
|
||||
## Open Source License
|
||||
|
||||
The code is licensed under Apache-2.0, while model weights are fully open for academic research and also allow **free** commercial usage. To apply for a commercial license, or other questions and collaborations, please contact <support@chemllm.org>.
|
||||
|
||||
|
||||
## Demo
|
||||
[Agent Chepybara](https://chemllm.org/)
|
||||
|
||||

|
||||
|
||||
## Contact
|
||||
(AI4Physics Sciecne, Shanghai AI Lab)[support@chemllm.org]
|
||||
33
config.json
Normal file
33
config.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"_name_or_path": "/home/bingxing2/ailab/group/ai4phys/EXPORT/20b_FT_4_28_zhangdi",
|
||||
"architectures": [
|
||||
"InternLM2ForCausalLM"
|
||||
],
|
||||
"attn_implementation": "eager",
|
||||
"auto_map": {
|
||||
"AutoConfig": "configuration_internlm2.InternLM2Config",
|
||||
"AutoModel": "modeling_internlm2.InternLM2ForCausalLM",
|
||||
"AutoModelForCausalLM": "modeling_internlm2.InternLM2ForCausalLM"
|
||||
},
|
||||
"bias": false,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": 2,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 6144,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 16384,
|
||||
"max_position_embeddings": 32768,
|
||||
"model_type": "internlm2",
|
||||
"num_attention_heads": 48,
|
||||
"num_hidden_layers": 48,
|
||||
"num_key_value_heads": 8,
|
||||
"pad_token_id": 2,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_scaling": null,
|
||||
"rope_theta": 1000000,
|
||||
"tie_word_embeddings": false,
|
||||
"torch_dtype": "bfloat16",
|
||||
"transformers_version": "4.40.0",
|
||||
"use_cache": true,
|
||||
"vocab_size": 92544
|
||||
}
|
||||
151
configuration_internlm2.py
Normal file
151
configuration_internlm2.py
Normal file
@@ -0,0 +1,151 @@
|
||||
# coding=utf-8
|
||||
# Copyright (c) The InternLM team and The HuggingFace Inc. team. All rights reserved.
|
||||
#
|
||||
# This code is based on transformers/src/transformers/models/llama/configuration_llama.py
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
""" InternLM2 model configuration"""
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
INTERNLM2_PRETRAINED_CONFIG_ARCHIVE_MAP = {}
|
||||
|
||||
|
||||
# Modified from transformers.model.llama.configuration_llama.LlamaConfig
|
||||
class InternLM2Config(PretrainedConfig):
|
||||
r"""
|
||||
This is the configuration class to store the configuration of a [`InternLM2Model`]. It is used to instantiate
|
||||
an InternLM2 model according to the specified arguments, defining the model architecture. Instantiating a
|
||||
configuration with the defaults will yield a similar configuration to that of the InternLM2-7B.
|
||||
|
||||
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
||||
documentation from [`PretrainedConfig`] for more information.
|
||||
|
||||
|
||||
Args:
|
||||
vocab_size (`int`, *optional*, defaults to 32000):
|
||||
Vocabulary size of the InternLM2 model. Defines the number of different tokens that can be represented by the
|
||||
`inputs_ids` passed when calling [`InternLM2Model`]
|
||||
hidden_size (`int`, *optional*, defaults to 4096):
|
||||
Dimension of the hidden representations.
|
||||
intermediate_size (`int`, *optional*, defaults to 11008):
|
||||
Dimension of the MLP representations.
|
||||
num_hidden_layers (`int`, *optional*, defaults to 32):
|
||||
Number of hidden layers in the Transformer encoder.
|
||||
num_attention_heads (`int`, *optional*, defaults to 32):
|
||||
Number of attention heads for each attention layer in the Transformer encoder.
|
||||
num_key_value_heads (`int`, *optional*):
|
||||
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
||||
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
||||
`num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
||||
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
||||
by meanpooling all the original heads within that group. For more details checkout [this
|
||||
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
|
||||
`num_attention_heads`.
|
||||
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
||||
The non-linear activation function (function or string) in the decoder.
|
||||
max_position_embeddings (`int`, *optional*, defaults to 2048):
|
||||
The maximum sequence length that this model might ever be used with. Typically set this to something large
|
||||
just in case (e.g., 512 or 1024 or 2048).
|
||||
initializer_range (`float`, *optional*, defaults to 0.02):
|
||||
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
||||
rms_norm_eps (`float`, *optional*, defaults to 1e-12):
|
||||
The epsilon used by the rms normalization layers.
|
||||
use_cache (`bool`, *optional*, defaults to `True`):
|
||||
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
||||
relevant if `config.is_decoder=True`.
|
||||
tie_word_embeddings(`bool`, *optional*, defaults to `False`):
|
||||
Whether to tie weight embeddings
|
||||
Example:
|
||||
|
||||
"""
|
||||
model_type = "internlm2"
|
||||
_auto_class = "AutoConfig"
|
||||
|
||||
def __init__( # pylint: disable=W0102
|
||||
self,
|
||||
vocab_size=103168,
|
||||
hidden_size=4096,
|
||||
intermediate_size=11008,
|
||||
num_hidden_layers=32,
|
||||
num_attention_heads=32,
|
||||
num_key_value_heads=None,
|
||||
hidden_act="silu",
|
||||
max_position_embeddings=2048,
|
||||
initializer_range=0.02,
|
||||
rms_norm_eps=1e-6,
|
||||
use_cache=True,
|
||||
pad_token_id=0,
|
||||
bos_token_id=1,
|
||||
eos_token_id=2,
|
||||
tie_word_embeddings=False,
|
||||
bias=True,
|
||||
rope_theta=10000,
|
||||
rope_scaling=None,
|
||||
attn_implementation="eager",
|
||||
**kwargs,
|
||||
):
|
||||
self.vocab_size = vocab_size
|
||||
self.max_position_embeddings = max_position_embeddings
|
||||
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.bias = bias
|
||||
|
||||
if num_key_value_heads is None:
|
||||
num_key_value_heads = num_attention_heads
|
||||
self.num_key_value_heads = num_key_value_heads
|
||||
|
||||
self.hidden_act = hidden_act
|
||||
self.initializer_range = initializer_range
|
||||
self.rms_norm_eps = rms_norm_eps
|
||||
self.use_cache = use_cache
|
||||
self.rope_theta = rope_theta
|
||||
self.rope_scaling = rope_scaling
|
||||
self._rope_scaling_validation()
|
||||
|
||||
self.attn_implementation = attn_implementation
|
||||
if self.attn_implementation is None:
|
||||
self.attn_implementation = "eager"
|
||||
super().__init__(
|
||||
pad_token_id=pad_token_id,
|
||||
bos_token_id=bos_token_id,
|
||||
eos_token_id=eos_token_id,
|
||||
tie_word_embeddings=tie_word_embeddings,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
def _rope_scaling_validation(self):
|
||||
"""
|
||||
Validate the `rope_scaling` configuration.
|
||||
"""
|
||||
if self.rope_scaling is None:
|
||||
return
|
||||
|
||||
if not isinstance(self.rope_scaling, dict) or len(self.rope_scaling) != 2:
|
||||
raise ValueError(
|
||||
"`rope_scaling` must be a dictionary with with two fields, `type` and `factor`, "
|
||||
f"got {self.rope_scaling}"
|
||||
)
|
||||
rope_scaling_type = self.rope_scaling.get("type", None)
|
||||
rope_scaling_factor = self.rope_scaling.get("factor", None)
|
||||
if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
|
||||
raise ValueError(
|
||||
f"`rope_scaling`'s type field must be one of ['linear', 'dynamic'], got {rope_scaling_type}"
|
||||
)
|
||||
if rope_scaling_factor is None or not isinstance(rope_scaling_factor, float) or rope_scaling_factor < 1.0:
|
||||
raise ValueError(f"`rope_scaling`'s factor field must be a float >= 1, got {rope_scaling_factor}")
|
||||
7
generation_config.json
Normal file
7
generation_config.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"_from_model_config": true,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": 2,
|
||||
"pad_token_id": 2,
|
||||
"transformers_version": "4.40.0"
|
||||
}
|
||||
3
model-00001-of-00041.safetensors
Normal file
3
model-00001-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b63d5cb61ecbb1c2370166b82d134e281007b84f433557db8eef770cb1f94f6c
|
||||
size 1137180816
|
||||
3
model-00002-of-00041.safetensors
Normal file
3
model-00002-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:101063babff0abd78086dde2d4282d2ff885977a09786028c700223a7fd3b881
|
||||
size 956326928
|
||||
3
model-00003-of-00041.safetensors
Normal file
3
model-00003-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:02b779e7805523b3ff0953549ac001638adcf26095c87be86798e04d9548b319
|
||||
size 981492632
|
||||
3
model-00004-of-00041.safetensors
Normal file
3
model-00004-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4661b29e88c31e9e2919160fd95e85b4d44eb5bfd9f10ae716c70814bd4b9451
|
||||
size 981492632
|
||||
3
model-00005-of-00041.safetensors
Normal file
3
model-00005-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4bf8d0aef61b7c08cd2e5ae770a5e9e4ca85e95bdf1aa956cfae6354810789cd
|
||||
size 981517416
|
||||
3
model-00006-of-00041.safetensors
Normal file
3
model-00006-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2d234d2377cb5071273ca81d160fd09be25e09c63f7e4526e4ec0ba56f456d3e
|
||||
size 956326928
|
||||
3
model-00007-of-00041.safetensors
Normal file
3
model-00007-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0bf797fbe67d3f3df28ac71e744f352607346da6fdd4b79fce545a0aff53d19a
|
||||
size 981492632
|
||||
3
model-00008-of-00041.safetensors
Normal file
3
model-00008-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:aa796d3a8142a78064ea82c6b12d9f61a47c8c5b9821ff023a0cd0137e2ce538
|
||||
size 981492632
|
||||
3
model-00009-of-00041.safetensors
Normal file
3
model-00009-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:57e366623421456501dd72123b010f732370f8537bae93724a2df9fe113f11f4
|
||||
size 981517416
|
||||
3
model-00010-of-00041.safetensors
Normal file
3
model-00010-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:98dd936778d8ac4ff505c6463daf9322c14b02340f730a372984ccc256c28829
|
||||
size 956326936
|
||||
3
model-00011-of-00041.safetensors
Normal file
3
model-00011-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:dc67855c62c906ea8b8d33f15d616cc562a9d5973cac4db4f2f86da6362969b0
|
||||
size 981492640
|
||||
3
model-00012-of-00041.safetensors
Normal file
3
model-00012-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bf4d12ef1df3db0511d6c9700681ea65a361e9d1a5b89378bd45571efbf9919e
|
||||
size 981492640
|
||||
3
model-00013-of-00041.safetensors
Normal file
3
model-00013-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:79153301b14724c60a4b6b6993787881a493a1a34f075240d5d5e853d00d69b3
|
||||
size 981517432
|
||||
3
model-00014-of-00041.safetensors
Normal file
3
model-00014-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:862c589f7e0ccac6cc49c5f1620c738a372db27944be40a2b312629a2165f836
|
||||
size 956326936
|
||||
3
model-00015-of-00041.safetensors
Normal file
3
model-00015-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e6333a1318f1d3a3845df5865ecd125b65bfb66eed046a568ad0ad36ad029f4a
|
||||
size 981492640
|
||||
3
model-00016-of-00041.safetensors
Normal file
3
model-00016-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0270f8dea4a1324e08d006893a481a380b180270d929abc24687482e4de62fb3
|
||||
size 981492640
|
||||
3
model-00017-of-00041.safetensors
Normal file
3
model-00017-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d77a3ac7cdf3bd7b5fc73a4883b230638413557626c59b8a62bad0a9a5c15b21
|
||||
size 981517432
|
||||
3
model-00018-of-00041.safetensors
Normal file
3
model-00018-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:dac06a49630155af3d6524a7b72381fe9a7a2b6d847697c212f0940f30a5361d
|
||||
size 956326936
|
||||
3
model-00019-of-00041.safetensors
Normal file
3
model-00019-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c80f84cf2a7f103da41931c6cd909e17291ec7b21cf3803cfe2abf47f3996903
|
||||
size 981492640
|
||||
3
model-00020-of-00041.safetensors
Normal file
3
model-00020-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a5b9f3ae8d8c374a87b41af4cce672751d548797f3061af3f50a164194702bca
|
||||
size 981492640
|
||||
3
model-00021-of-00041.safetensors
Normal file
3
model-00021-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cd030bd137f309eda1fc539b453f285e570ac4468b7dc7eff6e665fcf0f81557
|
||||
size 981517432
|
||||
3
model-00022-of-00041.safetensors
Normal file
3
model-00022-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c73edc616366b38f1516320b11459a92720c34683f7d334ecbfac6442116a8cc
|
||||
size 956326936
|
||||
3
model-00023-of-00041.safetensors
Normal file
3
model-00023-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:03edb2c81388e8217e05aca393d52f15d84ba3d6ec14efe6bf5d8ac70433ffb0
|
||||
size 981492640
|
||||
3
model-00024-of-00041.safetensors
Normal file
3
model-00024-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ae177d381c4100a84522d6e0eeeca52908e0362d9a75c4ee9e2813bcab83ecf1
|
||||
size 981492640
|
||||
3
model-00025-of-00041.safetensors
Normal file
3
model-00025-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:085cccb8faefdf3ec4bcc268306b2c579663181691bd071ee84a8f65212082d1
|
||||
size 981517432
|
||||
3
model-00026-of-00041.safetensors
Normal file
3
model-00026-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:96a4338a83276b04e464da5ff23fe9a4a1525c5021ec2657d461283b8e94e908
|
||||
size 956326936
|
||||
3
model-00027-of-00041.safetensors
Normal file
3
model-00027-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e3612c1c7e44e90a587ac964ea5baff0a36158d90f23f03565bcd608d3df6b3b
|
||||
size 981492640
|
||||
3
model-00028-of-00041.safetensors
Normal file
3
model-00028-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5af7abe5ff95c9a0f171b6467e8255aedae8eaa7cbabe201e42dc4932a37ab0d
|
||||
size 981492640
|
||||
3
model-00029-of-00041.safetensors
Normal file
3
model-00029-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:25c82ebc98b7b99840177e771cfddfb236138abf471a6c37066dba9ed994fe5d
|
||||
size 981517432
|
||||
3
model-00030-of-00041.safetensors
Normal file
3
model-00030-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:903734dc6c16425d7b2b5823d14f66655fd39f58b5256e39612a1a47fb59a337
|
||||
size 956326936
|
||||
3
model-00031-of-00041.safetensors
Normal file
3
model-00031-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6ba771cb14a52227e8d24cb2bad1bdd542f1263722eec51870a196bcfbba7cbb
|
||||
size 981492640
|
||||
3
model-00032-of-00041.safetensors
Normal file
3
model-00032-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:58e047057ed0b5ba2388867cd072f02ec1512176c17ff780ab3721745cc368a5
|
||||
size 981492640
|
||||
3
model-00033-of-00041.safetensors
Normal file
3
model-00033-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:57b337cc19f8420bf35eb4066c24c5b1ca88f537002f3d3914ad13a954c12483
|
||||
size 981517432
|
||||
3
model-00034-of-00041.safetensors
Normal file
3
model-00034-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:08ad9e4d43ea7a3934e48be9146fa6580b3d763ec52f8409bcd776c80b4c93ba
|
||||
size 956326936
|
||||
3
model-00035-of-00041.safetensors
Normal file
3
model-00035-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:142262db29d95e6d316c03f0f3cf21a9268e94217971450de40373f9077ec0ca
|
||||
size 981492640
|
||||
3
model-00036-of-00041.safetensors
Normal file
3
model-00036-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f84f01799ff591fa11ba46c54e61c26cd8bb79b5811a5c4aca8bde0328b0d55e
|
||||
size 981492640
|
||||
3
model-00037-of-00041.safetensors
Normal file
3
model-00037-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c872e88f97da684b07557ccd554b9c030dfd67a649a1674fabdeb597705cc52a
|
||||
size 981517432
|
||||
3
model-00038-of-00041.safetensors
Normal file
3
model-00038-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:102e5555c832d10a162c5b7f37434d4c12a6b9efdcf3ade1debc7db0df6bded2
|
||||
size 956326936
|
||||
3
model-00039-of-00041.safetensors
Normal file
3
model-00039-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a9d016b593cce97b1b714eaf2de5c5cb13b3219e7683fe7903b2d53804bf2a3a
|
||||
size 981492640
|
||||
3
model-00040-of-00041.safetensors
Normal file
3
model-00040-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c6fdc7d021436b55354c23d391ba7c88d7f76d4ab6d0ffe5f7d70d2f1714d182
|
||||
size 402690608
|
||||
3
model-00041-of-00041.safetensors
Normal file
3
model-00041-of-00041.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8dc8dffc3abaed006d85b1ac1f3d9eb1f5d32c3cfb105525111af0c559dd9e78
|
||||
size 1137180800
|
||||
346
model.safetensors.index.json
Normal file
346
model.safetensors.index.json
Normal file
@@ -0,0 +1,346 @@
|
||||
{
|
||||
"metadata": {
|
||||
"total_size": 39722299392
|
||||
},
|
||||
"weight_map": {
|
||||
"model.layers.0.attention.wo.weight": "model-00002-of-00041.safetensors",
|
||||
"model.layers.0.attention.wqkv.weight": "model-00002-of-00041.safetensors",
|
||||
"model.layers.0.attention_norm.weight": "model-00002-of-00041.safetensors",
|
||||
"model.layers.0.feed_forward.w1.weight": "model-00002-of-00041.safetensors",
|
||||
"model.layers.0.feed_forward.w2.weight": "model-00002-of-00041.safetensors",
|
||||
"model.layers.0.feed_forward.w3.weight": "model-00002-of-00041.safetensors",
|
||||
"model.layers.0.ffn_norm.weight": "model-00002-of-00041.safetensors",
|
||||
"model.layers.1.attention.wo.weight": "model-00002-of-00041.safetensors",
|
||||
"model.layers.1.attention.wqkv.weight": "model-00002-of-00041.safetensors",
|
||||
"model.layers.1.attention_norm.weight": "model-00003-of-00041.safetensors",
|
||||
"model.layers.1.feed_forward.w1.weight": "model-00003-of-00041.safetensors",
|
||||
"model.layers.1.feed_forward.w2.weight": "model-00003-of-00041.safetensors",
|
||||
"model.layers.1.feed_forward.w3.weight": "model-00003-of-00041.safetensors",
|
||||
"model.layers.1.ffn_norm.weight": "model-00003-of-00041.safetensors",
|
||||
"model.layers.10.attention.wo.weight": "model-00010-of-00041.safetensors",
|
||||
"model.layers.10.attention.wqkv.weight": "model-00010-of-00041.safetensors",
|
||||
"model.layers.10.attention_norm.weight": "model-00010-of-00041.safetensors",
|
||||
"model.layers.10.feed_forward.w1.weight": "model-00010-of-00041.safetensors",
|
||||
"model.layers.10.feed_forward.w2.weight": "model-00010-of-00041.safetensors",
|
||||
"model.layers.10.feed_forward.w3.weight": "model-00010-of-00041.safetensors",
|
||||
"model.layers.10.ffn_norm.weight": "model-00010-of-00041.safetensors",
|
||||
"model.layers.11.attention.wo.weight": "model-00010-of-00041.safetensors",
|
||||
"model.layers.11.attention.wqkv.weight": "model-00010-of-00041.safetensors",
|
||||
"model.layers.11.attention_norm.weight": "model-00011-of-00041.safetensors",
|
||||
"model.layers.11.feed_forward.w1.weight": "model-00011-of-00041.safetensors",
|
||||
"model.layers.11.feed_forward.w2.weight": "model-00011-of-00041.safetensors",
|
||||
"model.layers.11.feed_forward.w3.weight": "model-00011-of-00041.safetensors",
|
||||
"model.layers.11.ffn_norm.weight": "model-00011-of-00041.safetensors",
|
||||
"model.layers.12.attention.wo.weight": "model-00011-of-00041.safetensors",
|
||||
"model.layers.12.attention.wqkv.weight": "model-00011-of-00041.safetensors",
|
||||
"model.layers.12.attention_norm.weight": "model-00012-of-00041.safetensors",
|
||||
"model.layers.12.feed_forward.w1.weight": "model-00011-of-00041.safetensors",
|
||||
"model.layers.12.feed_forward.w2.weight": "model-00012-of-00041.safetensors",
|
||||
"model.layers.12.feed_forward.w3.weight": "model-00012-of-00041.safetensors",
|
||||
"model.layers.12.ffn_norm.weight": "model-00012-of-00041.safetensors",
|
||||
"model.layers.13.attention.wo.weight": "model-00012-of-00041.safetensors",
|
||||
"model.layers.13.attention.wqkv.weight": "model-00012-of-00041.safetensors",
|
||||
"model.layers.13.attention_norm.weight": "model-00013-of-00041.safetensors",
|
||||
"model.layers.13.feed_forward.w1.weight": "model-00012-of-00041.safetensors",
|
||||
"model.layers.13.feed_forward.w2.weight": "model-00013-of-00041.safetensors",
|
||||
"model.layers.13.feed_forward.w3.weight": "model-00012-of-00041.safetensors",
|
||||
"model.layers.13.ffn_norm.weight": "model-00013-of-00041.safetensors",
|
||||
"model.layers.14.attention.wo.weight": "model-00013-of-00041.safetensors",
|
||||
"model.layers.14.attention.wqkv.weight": "model-00013-of-00041.safetensors",
|
||||
"model.layers.14.attention_norm.weight": "model-00013-of-00041.safetensors",
|
||||
"model.layers.14.feed_forward.w1.weight": "model-00013-of-00041.safetensors",
|
||||
"model.layers.14.feed_forward.w2.weight": "model-00013-of-00041.safetensors",
|
||||
"model.layers.14.feed_forward.w3.weight": "model-00013-of-00041.safetensors",
|
||||
"model.layers.14.ffn_norm.weight": "model-00013-of-00041.safetensors",
|
||||
"model.layers.15.attention.wo.weight": "model-00014-of-00041.safetensors",
|
||||
"model.layers.15.attention.wqkv.weight": "model-00014-of-00041.safetensors",
|
||||
"model.layers.15.attention_norm.weight": "model-00014-of-00041.safetensors",
|
||||
"model.layers.15.feed_forward.w1.weight": "model-00014-of-00041.safetensors",
|
||||
"model.layers.15.feed_forward.w2.weight": "model-00014-of-00041.safetensors",
|
||||
"model.layers.15.feed_forward.w3.weight": "model-00014-of-00041.safetensors",
|
||||
"model.layers.15.ffn_norm.weight": "model-00014-of-00041.safetensors",
|
||||
"model.layers.16.attention.wo.weight": "model-00014-of-00041.safetensors",
|
||||
"model.layers.16.attention.wqkv.weight": "model-00014-of-00041.safetensors",
|
||||
"model.layers.16.attention_norm.weight": "model-00015-of-00041.safetensors",
|
||||
"model.layers.16.feed_forward.w1.weight": "model-00015-of-00041.safetensors",
|
||||
"model.layers.16.feed_forward.w2.weight": "model-00015-of-00041.safetensors",
|
||||
"model.layers.16.feed_forward.w3.weight": "model-00015-of-00041.safetensors",
|
||||
"model.layers.16.ffn_norm.weight": "model-00015-of-00041.safetensors",
|
||||
"model.layers.17.attention.wo.weight": "model-00015-of-00041.safetensors",
|
||||
"model.layers.17.attention.wqkv.weight": "model-00015-of-00041.safetensors",
|
||||
"model.layers.17.attention_norm.weight": "model-00016-of-00041.safetensors",
|
||||
"model.layers.17.feed_forward.w1.weight": "model-00015-of-00041.safetensors",
|
||||
"model.layers.17.feed_forward.w2.weight": "model-00016-of-00041.safetensors",
|
||||
"model.layers.17.feed_forward.w3.weight": "model-00016-of-00041.safetensors",
|
||||
"model.layers.17.ffn_norm.weight": "model-00016-of-00041.safetensors",
|
||||
"model.layers.18.attention.wo.weight": "model-00016-of-00041.safetensors",
|
||||
"model.layers.18.attention.wqkv.weight": "model-00016-of-00041.safetensors",
|
||||
"model.layers.18.attention_norm.weight": "model-00017-of-00041.safetensors",
|
||||
"model.layers.18.feed_forward.w1.weight": "model-00016-of-00041.safetensors",
|
||||
"model.layers.18.feed_forward.w2.weight": "model-00017-of-00041.safetensors",
|
||||
"model.layers.18.feed_forward.w3.weight": "model-00016-of-00041.safetensors",
|
||||
"model.layers.18.ffn_norm.weight": "model-00017-of-00041.safetensors",
|
||||
"model.layers.19.attention.wo.weight": "model-00017-of-00041.safetensors",
|
||||
"model.layers.19.attention.wqkv.weight": "model-00017-of-00041.safetensors",
|
||||
"model.layers.19.attention_norm.weight": "model-00017-of-00041.safetensors",
|
||||
"model.layers.19.feed_forward.w1.weight": "model-00017-of-00041.safetensors",
|
||||
"model.layers.19.feed_forward.w2.weight": "model-00017-of-00041.safetensors",
|
||||
"model.layers.19.feed_forward.w3.weight": "model-00017-of-00041.safetensors",
|
||||
"model.layers.19.ffn_norm.weight": "model-00017-of-00041.safetensors",
|
||||
"model.layers.2.attention.wo.weight": "model-00003-of-00041.safetensors",
|
||||
"model.layers.2.attention.wqkv.weight": "model-00003-of-00041.safetensors",
|
||||
"model.layers.2.attention_norm.weight": "model-00004-of-00041.safetensors",
|
||||
"model.layers.2.feed_forward.w1.weight": "model-00003-of-00041.safetensors",
|
||||
"model.layers.2.feed_forward.w2.weight": "model-00004-of-00041.safetensors",
|
||||
"model.layers.2.feed_forward.w3.weight": "model-00004-of-00041.safetensors",
|
||||
"model.layers.2.ffn_norm.weight": "model-00004-of-00041.safetensors",
|
||||
"model.layers.20.attention.wo.weight": "model-00018-of-00041.safetensors",
|
||||
"model.layers.20.attention.wqkv.weight": "model-00018-of-00041.safetensors",
|
||||
"model.layers.20.attention_norm.weight": "model-00018-of-00041.safetensors",
|
||||
"model.layers.20.feed_forward.w1.weight": "model-00018-of-00041.safetensors",
|
||||
"model.layers.20.feed_forward.w2.weight": "model-00018-of-00041.safetensors",
|
||||
"model.layers.20.feed_forward.w3.weight": "model-00018-of-00041.safetensors",
|
||||
"model.layers.20.ffn_norm.weight": "model-00018-of-00041.safetensors",
|
||||
"model.layers.21.attention.wo.weight": "model-00018-of-00041.safetensors",
|
||||
"model.layers.21.attention.wqkv.weight": "model-00018-of-00041.safetensors",
|
||||
"model.layers.21.attention_norm.weight": "model-00019-of-00041.safetensors",
|
||||
"model.layers.21.feed_forward.w1.weight": "model-00019-of-00041.safetensors",
|
||||
"model.layers.21.feed_forward.w2.weight": "model-00019-of-00041.safetensors",
|
||||
"model.layers.21.feed_forward.w3.weight": "model-00019-of-00041.safetensors",
|
||||
"model.layers.21.ffn_norm.weight": "model-00019-of-00041.safetensors",
|
||||
"model.layers.22.attention.wo.weight": "model-00019-of-00041.safetensors",
|
||||
"model.layers.22.attention.wqkv.weight": "model-00019-of-00041.safetensors",
|
||||
"model.layers.22.attention_norm.weight": "model-00020-of-00041.safetensors",
|
||||
"model.layers.22.feed_forward.w1.weight": "model-00019-of-00041.safetensors",
|
||||
"model.layers.22.feed_forward.w2.weight": "model-00020-of-00041.safetensors",
|
||||
"model.layers.22.feed_forward.w3.weight": "model-00020-of-00041.safetensors",
|
||||
"model.layers.22.ffn_norm.weight": "model-00020-of-00041.safetensors",
|
||||
"model.layers.23.attention.wo.weight": "model-00020-of-00041.safetensors",
|
||||
"model.layers.23.attention.wqkv.weight": "model-00020-of-00041.safetensors",
|
||||
"model.layers.23.attention_norm.weight": "model-00021-of-00041.safetensors",
|
||||
"model.layers.23.feed_forward.w1.weight": "model-00020-of-00041.safetensors",
|
||||
"model.layers.23.feed_forward.w2.weight": "model-00021-of-00041.safetensors",
|
||||
"model.layers.23.feed_forward.w3.weight": "model-00020-of-00041.safetensors",
|
||||
"model.layers.23.ffn_norm.weight": "model-00021-of-00041.safetensors",
|
||||
"model.layers.24.attention.wo.weight": "model-00021-of-00041.safetensors",
|
||||
"model.layers.24.attention.wqkv.weight": "model-00021-of-00041.safetensors",
|
||||
"model.layers.24.attention_norm.weight": "model-00021-of-00041.safetensors",
|
||||
"model.layers.24.feed_forward.w1.weight": "model-00021-of-00041.safetensors",
|
||||
"model.layers.24.feed_forward.w2.weight": "model-00021-of-00041.safetensors",
|
||||
"model.layers.24.feed_forward.w3.weight": "model-00021-of-00041.safetensors",
|
||||
"model.layers.24.ffn_norm.weight": "model-00021-of-00041.safetensors",
|
||||
"model.layers.25.attention.wo.weight": "model-00022-of-00041.safetensors",
|
||||
"model.layers.25.attention.wqkv.weight": "model-00022-of-00041.safetensors",
|
||||
"model.layers.25.attention_norm.weight": "model-00022-of-00041.safetensors",
|
||||
"model.layers.25.feed_forward.w1.weight": "model-00022-of-00041.safetensors",
|
||||
"model.layers.25.feed_forward.w2.weight": "model-00022-of-00041.safetensors",
|
||||
"model.layers.25.feed_forward.w3.weight": "model-00022-of-00041.safetensors",
|
||||
"model.layers.25.ffn_norm.weight": "model-00022-of-00041.safetensors",
|
||||
"model.layers.26.attention.wo.weight": "model-00022-of-00041.safetensors",
|
||||
"model.layers.26.attention.wqkv.weight": "model-00022-of-00041.safetensors",
|
||||
"model.layers.26.attention_norm.weight": "model-00023-of-00041.safetensors",
|
||||
"model.layers.26.feed_forward.w1.weight": "model-00023-of-00041.safetensors",
|
||||
"model.layers.26.feed_forward.w2.weight": "model-00023-of-00041.safetensors",
|
||||
"model.layers.26.feed_forward.w3.weight": "model-00023-of-00041.safetensors",
|
||||
"model.layers.26.ffn_norm.weight": "model-00023-of-00041.safetensors",
|
||||
"model.layers.27.attention.wo.weight": "model-00023-of-00041.safetensors",
|
||||
"model.layers.27.attention.wqkv.weight": "model-00023-of-00041.safetensors",
|
||||
"model.layers.27.attention_norm.weight": "model-00024-of-00041.safetensors",
|
||||
"model.layers.27.feed_forward.w1.weight": "model-00023-of-00041.safetensors",
|
||||
"model.layers.27.feed_forward.w2.weight": "model-00024-of-00041.safetensors",
|
||||
"model.layers.27.feed_forward.w3.weight": "model-00024-of-00041.safetensors",
|
||||
"model.layers.27.ffn_norm.weight": "model-00024-of-00041.safetensors",
|
||||
"model.layers.28.attention.wo.weight": "model-00024-of-00041.safetensors",
|
||||
"model.layers.28.attention.wqkv.weight": "model-00024-of-00041.safetensors",
|
||||
"model.layers.28.attention_norm.weight": "model-00025-of-00041.safetensors",
|
||||
"model.layers.28.feed_forward.w1.weight": "model-00024-of-00041.safetensors",
|
||||
"model.layers.28.feed_forward.w2.weight": "model-00025-of-00041.safetensors",
|
||||
"model.layers.28.feed_forward.w3.weight": "model-00024-of-00041.safetensors",
|
||||
"model.layers.28.ffn_norm.weight": "model-00025-of-00041.safetensors",
|
||||
"model.layers.29.attention.wo.weight": "model-00025-of-00041.safetensors",
|
||||
"model.layers.29.attention.wqkv.weight": "model-00025-of-00041.safetensors",
|
||||
"model.layers.29.attention_norm.weight": "model-00025-of-00041.safetensors",
|
||||
"model.layers.29.feed_forward.w1.weight": "model-00025-of-00041.safetensors",
|
||||
"model.layers.29.feed_forward.w2.weight": "model-00025-of-00041.safetensors",
|
||||
"model.layers.29.feed_forward.w3.weight": "model-00025-of-00041.safetensors",
|
||||
"model.layers.29.ffn_norm.weight": "model-00025-of-00041.safetensors",
|
||||
"model.layers.3.attention.wo.weight": "model-00004-of-00041.safetensors",
|
||||
"model.layers.3.attention.wqkv.weight": "model-00004-of-00041.safetensors",
|
||||
"model.layers.3.attention_norm.weight": "model-00005-of-00041.safetensors",
|
||||
"model.layers.3.feed_forward.w1.weight": "model-00004-of-00041.safetensors",
|
||||
"model.layers.3.feed_forward.w2.weight": "model-00005-of-00041.safetensors",
|
||||
"model.layers.3.feed_forward.w3.weight": "model-00004-of-00041.safetensors",
|
||||
"model.layers.3.ffn_norm.weight": "model-00005-of-00041.safetensors",
|
||||
"model.layers.30.attention.wo.weight": "model-00026-of-00041.safetensors",
|
||||
"model.layers.30.attention.wqkv.weight": "model-00026-of-00041.safetensors",
|
||||
"model.layers.30.attention_norm.weight": "model-00026-of-00041.safetensors",
|
||||
"model.layers.30.feed_forward.w1.weight": "model-00026-of-00041.safetensors",
|
||||
"model.layers.30.feed_forward.w2.weight": "model-00026-of-00041.safetensors",
|
||||
"model.layers.30.feed_forward.w3.weight": "model-00026-of-00041.safetensors",
|
||||
"model.layers.30.ffn_norm.weight": "model-00026-of-00041.safetensors",
|
||||
"model.layers.31.attention.wo.weight": "model-00026-of-00041.safetensors",
|
||||
"model.layers.31.attention.wqkv.weight": "model-00026-of-00041.safetensors",
|
||||
"model.layers.31.attention_norm.weight": "model-00027-of-00041.safetensors",
|
||||
"model.layers.31.feed_forward.w1.weight": "model-00027-of-00041.safetensors",
|
||||
"model.layers.31.feed_forward.w2.weight": "model-00027-of-00041.safetensors",
|
||||
"model.layers.31.feed_forward.w3.weight": "model-00027-of-00041.safetensors",
|
||||
"model.layers.31.ffn_norm.weight": "model-00027-of-00041.safetensors",
|
||||
"model.layers.32.attention.wo.weight": "model-00027-of-00041.safetensors",
|
||||
"model.layers.32.attention.wqkv.weight": "model-00027-of-00041.safetensors",
|
||||
"model.layers.32.attention_norm.weight": "model-00028-of-00041.safetensors",
|
||||
"model.layers.32.feed_forward.w1.weight": "model-00027-of-00041.safetensors",
|
||||
"model.layers.32.feed_forward.w2.weight": "model-00028-of-00041.safetensors",
|
||||
"model.layers.32.feed_forward.w3.weight": "model-00028-of-00041.safetensors",
|
||||
"model.layers.32.ffn_norm.weight": "model-00028-of-00041.safetensors",
|
||||
"model.layers.33.attention.wo.weight": "model-00028-of-00041.safetensors",
|
||||
"model.layers.33.attention.wqkv.weight": "model-00028-of-00041.safetensors",
|
||||
"model.layers.33.attention_norm.weight": "model-00029-of-00041.safetensors",
|
||||
"model.layers.33.feed_forward.w1.weight": "model-00028-of-00041.safetensors",
|
||||
"model.layers.33.feed_forward.w2.weight": "model-00029-of-00041.safetensors",
|
||||
"model.layers.33.feed_forward.w3.weight": "model-00028-of-00041.safetensors",
|
||||
"model.layers.33.ffn_norm.weight": "model-00029-of-00041.safetensors",
|
||||
"model.layers.34.attention.wo.weight": "model-00029-of-00041.safetensors",
|
||||
"model.layers.34.attention.wqkv.weight": "model-00029-of-00041.safetensors",
|
||||
"model.layers.34.attention_norm.weight": "model-00029-of-00041.safetensors",
|
||||
"model.layers.34.feed_forward.w1.weight": "model-00029-of-00041.safetensors",
|
||||
"model.layers.34.feed_forward.w2.weight": "model-00029-of-00041.safetensors",
|
||||
"model.layers.34.feed_forward.w3.weight": "model-00029-of-00041.safetensors",
|
||||
"model.layers.34.ffn_norm.weight": "model-00029-of-00041.safetensors",
|
||||
"model.layers.35.attention.wo.weight": "model-00030-of-00041.safetensors",
|
||||
"model.layers.35.attention.wqkv.weight": "model-00030-of-00041.safetensors",
|
||||
"model.layers.35.attention_norm.weight": "model-00030-of-00041.safetensors",
|
||||
"model.layers.35.feed_forward.w1.weight": "model-00030-of-00041.safetensors",
|
||||
"model.layers.35.feed_forward.w2.weight": "model-00030-of-00041.safetensors",
|
||||
"model.layers.35.feed_forward.w3.weight": "model-00030-of-00041.safetensors",
|
||||
"model.layers.35.ffn_norm.weight": "model-00030-of-00041.safetensors",
|
||||
"model.layers.36.attention.wo.weight": "model-00030-of-00041.safetensors",
|
||||
"model.layers.36.attention.wqkv.weight": "model-00030-of-00041.safetensors",
|
||||
"model.layers.36.attention_norm.weight": "model-00031-of-00041.safetensors",
|
||||
"model.layers.36.feed_forward.w1.weight": "model-00031-of-00041.safetensors",
|
||||
"model.layers.36.feed_forward.w2.weight": "model-00031-of-00041.safetensors",
|
||||
"model.layers.36.feed_forward.w3.weight": "model-00031-of-00041.safetensors",
|
||||
"model.layers.36.ffn_norm.weight": "model-00031-of-00041.safetensors",
|
||||
"model.layers.37.attention.wo.weight": "model-00031-of-00041.safetensors",
|
||||
"model.layers.37.attention.wqkv.weight": "model-00031-of-00041.safetensors",
|
||||
"model.layers.37.attention_norm.weight": "model-00032-of-00041.safetensors",
|
||||
"model.layers.37.feed_forward.w1.weight": "model-00031-of-00041.safetensors",
|
||||
"model.layers.37.feed_forward.w2.weight": "model-00032-of-00041.safetensors",
|
||||
"model.layers.37.feed_forward.w3.weight": "model-00032-of-00041.safetensors",
|
||||
"model.layers.37.ffn_norm.weight": "model-00032-of-00041.safetensors",
|
||||
"model.layers.38.attention.wo.weight": "model-00032-of-00041.safetensors",
|
||||
"model.layers.38.attention.wqkv.weight": "model-00032-of-00041.safetensors",
|
||||
"model.layers.38.attention_norm.weight": "model-00033-of-00041.safetensors",
|
||||
"model.layers.38.feed_forward.w1.weight": "model-00032-of-00041.safetensors",
|
||||
"model.layers.38.feed_forward.w2.weight": "model-00033-of-00041.safetensors",
|
||||
"model.layers.38.feed_forward.w3.weight": "model-00032-of-00041.safetensors",
|
||||
"model.layers.38.ffn_norm.weight": "model-00033-of-00041.safetensors",
|
||||
"model.layers.39.attention.wo.weight": "model-00033-of-00041.safetensors",
|
||||
"model.layers.39.attention.wqkv.weight": "model-00033-of-00041.safetensors",
|
||||
"model.layers.39.attention_norm.weight": "model-00033-of-00041.safetensors",
|
||||
"model.layers.39.feed_forward.w1.weight": "model-00033-of-00041.safetensors",
|
||||
"model.layers.39.feed_forward.w2.weight": "model-00033-of-00041.safetensors",
|
||||
"model.layers.39.feed_forward.w3.weight": "model-00033-of-00041.safetensors",
|
||||
"model.layers.39.ffn_norm.weight": "model-00033-of-00041.safetensors",
|
||||
"model.layers.4.attention.wo.weight": "model-00005-of-00041.safetensors",
|
||||
"model.layers.4.attention.wqkv.weight": "model-00005-of-00041.safetensors",
|
||||
"model.layers.4.attention_norm.weight": "model-00005-of-00041.safetensors",
|
||||
"model.layers.4.feed_forward.w1.weight": "model-00005-of-00041.safetensors",
|
||||
"model.layers.4.feed_forward.w2.weight": "model-00005-of-00041.safetensors",
|
||||
"model.layers.4.feed_forward.w3.weight": "model-00005-of-00041.safetensors",
|
||||
"model.layers.4.ffn_norm.weight": "model-00005-of-00041.safetensors",
|
||||
"model.layers.40.attention.wo.weight": "model-00034-of-00041.safetensors",
|
||||
"model.layers.40.attention.wqkv.weight": "model-00034-of-00041.safetensors",
|
||||
"model.layers.40.attention_norm.weight": "model-00034-of-00041.safetensors",
|
||||
"model.layers.40.feed_forward.w1.weight": "model-00034-of-00041.safetensors",
|
||||
"model.layers.40.feed_forward.w2.weight": "model-00034-of-00041.safetensors",
|
||||
"model.layers.40.feed_forward.w3.weight": "model-00034-of-00041.safetensors",
|
||||
"model.layers.40.ffn_norm.weight": "model-00034-of-00041.safetensors",
|
||||
"model.layers.41.attention.wo.weight": "model-00034-of-00041.safetensors",
|
||||
"model.layers.41.attention.wqkv.weight": "model-00034-of-00041.safetensors",
|
||||
"model.layers.41.attention_norm.weight": "model-00035-of-00041.safetensors",
|
||||
"model.layers.41.feed_forward.w1.weight": "model-00035-of-00041.safetensors",
|
||||
"model.layers.41.feed_forward.w2.weight": "model-00035-of-00041.safetensors",
|
||||
"model.layers.41.feed_forward.w3.weight": "model-00035-of-00041.safetensors",
|
||||
"model.layers.41.ffn_norm.weight": "model-00035-of-00041.safetensors",
|
||||
"model.layers.42.attention.wo.weight": "model-00035-of-00041.safetensors",
|
||||
"model.layers.42.attention.wqkv.weight": "model-00035-of-00041.safetensors",
|
||||
"model.layers.42.attention_norm.weight": "model-00036-of-00041.safetensors",
|
||||
"model.layers.42.feed_forward.w1.weight": "model-00035-of-00041.safetensors",
|
||||
"model.layers.42.feed_forward.w2.weight": "model-00036-of-00041.safetensors",
|
||||
"model.layers.42.feed_forward.w3.weight": "model-00036-of-00041.safetensors",
|
||||
"model.layers.42.ffn_norm.weight": "model-00036-of-00041.safetensors",
|
||||
"model.layers.43.attention.wo.weight": "model-00036-of-00041.safetensors",
|
||||
"model.layers.43.attention.wqkv.weight": "model-00036-of-00041.safetensors",
|
||||
"model.layers.43.attention_norm.weight": "model-00037-of-00041.safetensors",
|
||||
"model.layers.43.feed_forward.w1.weight": "model-00036-of-00041.safetensors",
|
||||
"model.layers.43.feed_forward.w2.weight": "model-00037-of-00041.safetensors",
|
||||
"model.layers.43.feed_forward.w3.weight": "model-00036-of-00041.safetensors",
|
||||
"model.layers.43.ffn_norm.weight": "model-00037-of-00041.safetensors",
|
||||
"model.layers.44.attention.wo.weight": "model-00037-of-00041.safetensors",
|
||||
"model.layers.44.attention.wqkv.weight": "model-00037-of-00041.safetensors",
|
||||
"model.layers.44.attention_norm.weight": "model-00037-of-00041.safetensors",
|
||||
"model.layers.44.feed_forward.w1.weight": "model-00037-of-00041.safetensors",
|
||||
"model.layers.44.feed_forward.w2.weight": "model-00037-of-00041.safetensors",
|
||||
"model.layers.44.feed_forward.w3.weight": "model-00037-of-00041.safetensors",
|
||||
"model.layers.44.ffn_norm.weight": "model-00037-of-00041.safetensors",
|
||||
"model.layers.45.attention.wo.weight": "model-00038-of-00041.safetensors",
|
||||
"model.layers.45.attention.wqkv.weight": "model-00038-of-00041.safetensors",
|
||||
"model.layers.45.attention_norm.weight": "model-00038-of-00041.safetensors",
|
||||
"model.layers.45.feed_forward.w1.weight": "model-00038-of-00041.safetensors",
|
||||
"model.layers.45.feed_forward.w2.weight": "model-00038-of-00041.safetensors",
|
||||
"model.layers.45.feed_forward.w3.weight": "model-00038-of-00041.safetensors",
|
||||
"model.layers.45.ffn_norm.weight": "model-00038-of-00041.safetensors",
|
||||
"model.layers.46.attention.wo.weight": "model-00038-of-00041.safetensors",
|
||||
"model.layers.46.attention.wqkv.weight": "model-00038-of-00041.safetensors",
|
||||
"model.layers.46.attention_norm.weight": "model-00039-of-00041.safetensors",
|
||||
"model.layers.46.feed_forward.w1.weight": "model-00039-of-00041.safetensors",
|
||||
"model.layers.46.feed_forward.w2.weight": "model-00039-of-00041.safetensors",
|
||||
"model.layers.46.feed_forward.w3.weight": "model-00039-of-00041.safetensors",
|
||||
"model.layers.46.ffn_norm.weight": "model-00039-of-00041.safetensors",
|
||||
"model.layers.47.attention.wo.weight": "model-00039-of-00041.safetensors",
|
||||
"model.layers.47.attention.wqkv.weight": "model-00039-of-00041.safetensors",
|
||||
"model.layers.47.attention_norm.weight": "model-00040-of-00041.safetensors",
|
||||
"model.layers.47.feed_forward.w1.weight": "model-00039-of-00041.safetensors",
|
||||
"model.layers.47.feed_forward.w2.weight": "model-00040-of-00041.safetensors",
|
||||
"model.layers.47.feed_forward.w3.weight": "model-00040-of-00041.safetensors",
|
||||
"model.layers.47.ffn_norm.weight": "model-00040-of-00041.safetensors",
|
||||
"model.layers.5.attention.wo.weight": "model-00006-of-00041.safetensors",
|
||||
"model.layers.5.attention.wqkv.weight": "model-00006-of-00041.safetensors",
|
||||
"model.layers.5.attention_norm.weight": "model-00006-of-00041.safetensors",
|
||||
"model.layers.5.feed_forward.w1.weight": "model-00006-of-00041.safetensors",
|
||||
"model.layers.5.feed_forward.w2.weight": "model-00006-of-00041.safetensors",
|
||||
"model.layers.5.feed_forward.w3.weight": "model-00006-of-00041.safetensors",
|
||||
"model.layers.5.ffn_norm.weight": "model-00006-of-00041.safetensors",
|
||||
"model.layers.6.attention.wo.weight": "model-00006-of-00041.safetensors",
|
||||
"model.layers.6.attention.wqkv.weight": "model-00006-of-00041.safetensors",
|
||||
"model.layers.6.attention_norm.weight": "model-00007-of-00041.safetensors",
|
||||
"model.layers.6.feed_forward.w1.weight": "model-00007-of-00041.safetensors",
|
||||
"model.layers.6.feed_forward.w2.weight": "model-00007-of-00041.safetensors",
|
||||
"model.layers.6.feed_forward.w3.weight": "model-00007-of-00041.safetensors",
|
||||
"model.layers.6.ffn_norm.weight": "model-00007-of-00041.safetensors",
|
||||
"model.layers.7.attention.wo.weight": "model-00007-of-00041.safetensors",
|
||||
"model.layers.7.attention.wqkv.weight": "model-00007-of-00041.safetensors",
|
||||
"model.layers.7.attention_norm.weight": "model-00008-of-00041.safetensors",
|
||||
"model.layers.7.feed_forward.w1.weight": "model-00007-of-00041.safetensors",
|
||||
"model.layers.7.feed_forward.w2.weight": "model-00008-of-00041.safetensors",
|
||||
"model.layers.7.feed_forward.w3.weight": "model-00008-of-00041.safetensors",
|
||||
"model.layers.7.ffn_norm.weight": "model-00008-of-00041.safetensors",
|
||||
"model.layers.8.attention.wo.weight": "model-00008-of-00041.safetensors",
|
||||
"model.layers.8.attention.wqkv.weight": "model-00008-of-00041.safetensors",
|
||||
"model.layers.8.attention_norm.weight": "model-00009-of-00041.safetensors",
|
||||
"model.layers.8.feed_forward.w1.weight": "model-00008-of-00041.safetensors",
|
||||
"model.layers.8.feed_forward.w2.weight": "model-00009-of-00041.safetensors",
|
||||
"model.layers.8.feed_forward.w3.weight": "model-00008-of-00041.safetensors",
|
||||
"model.layers.8.ffn_norm.weight": "model-00009-of-00041.safetensors",
|
||||
"model.layers.9.attention.wo.weight": "model-00009-of-00041.safetensors",
|
||||
"model.layers.9.attention.wqkv.weight": "model-00009-of-00041.safetensors",
|
||||
"model.layers.9.attention_norm.weight": "model-00009-of-00041.safetensors",
|
||||
"model.layers.9.feed_forward.w1.weight": "model-00009-of-00041.safetensors",
|
||||
"model.layers.9.feed_forward.w2.weight": "model-00009-of-00041.safetensors",
|
||||
"model.layers.9.feed_forward.w3.weight": "model-00009-of-00041.safetensors",
|
||||
"model.layers.9.ffn_norm.weight": "model-00009-of-00041.safetensors",
|
||||
"model.norm.weight": "model-00040-of-00041.safetensors",
|
||||
"model.tok_embeddings.weight": "model-00001-of-00041.safetensors",
|
||||
"output.weight": "model-00041-of-00041.safetensors"
|
||||
}
|
||||
}
|
||||
1391
modeling_internlm2.py
Normal file
1391
modeling_internlm2.py
Normal file
File diff suppressed because it is too large
Load Diff
38
special_tokens_map.json
Normal file
38
special_tokens_map.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"additional_special_tokens": [
|
||||
"<|im_start|>",
|
||||
"<|im_end|>",
|
||||
"<|action_start|>",
|
||||
"<|action_end|>",
|
||||
"<|interpreter|>",
|
||||
"<|plugin|>"
|
||||
],
|
||||
"bos_token": {
|
||||
"content": "<s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"eos_token": {
|
||||
"content": "</s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"pad_token": {
|
||||
"content": "</s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"unk_token": {
|
||||
"content": "<unk>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
}
|
||||
}
|
||||
236
tokenization_internlm2.py
Normal file
236
tokenization_internlm2.py
Normal file
@@ -0,0 +1,236 @@
|
||||
# coding=utf-8
|
||||
# Copyright (c) The InternLM team and The HuggingFace Inc. team. All rights reserved.
|
||||
#
|
||||
# This code is based on transformers/src/transformers/models/llama/tokenization_llama.py
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Tokenization classes for InternLM."""
|
||||
import os
|
||||
from shutil import copyfile
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
import sentencepiece as spm
|
||||
from transformers.tokenization_utils import PreTrainedTokenizer
|
||||
from transformers.utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "./tokenizer.model"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {}
|
||||
|
||||
|
||||
# Modified from transformers.model.llama.tokenization_llama.LlamaTokenizer
|
||||
class InternLM2Tokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
Construct a InternLM2 tokenizer. Based on byte-level Byte-Pair-Encoding.
|
||||
|
||||
Args:
|
||||
vocab_file (`str`):
|
||||
Path to the vocabulary file.
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
_auto_class = "AutoTokenizer"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
vocab_file,
|
||||
unk_token="<unk>",
|
||||
bos_token="<s>",
|
||||
eos_token="</s>",
|
||||
pad_token="</s>",
|
||||
sp_model_kwargs: Optional[Dict[str, Any]] = None,
|
||||
add_bos_token=True,
|
||||
add_eos_token=False,
|
||||
decode_with_prefix_space=False,
|
||||
clean_up_tokenization_spaces=False,
|
||||
**kwargs,
|
||||
):
|
||||
self.sp_model_kwargs = {} if sp_model_kwargs is None else sp_model_kwargs
|
||||
self.vocab_file = vocab_file
|
||||
self.add_bos_token = add_bos_token
|
||||
self.add_eos_token = add_eos_token
|
||||
self.decode_with_prefix_space = decode_with_prefix_space
|
||||
self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
|
||||
self.sp_model.Load(vocab_file)
|
||||
self._no_prefix_space_tokens = None
|
||||
super().__init__(
|
||||
bos_token=bos_token,
|
||||
eos_token=eos_token,
|
||||
unk_token=unk_token,
|
||||
pad_token=pad_token,
|
||||
clean_up_tokenization_spaces=clean_up_tokenization_spaces,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@property
|
||||
def no_prefix_space_tokens(self):
|
||||
if self._no_prefix_space_tokens is None:
|
||||
vocab = self.convert_ids_to_tokens(list(range(self.vocab_size)))
|
||||
self._no_prefix_space_tokens = {i for i, tok in enumerate(vocab) if not tok.startswith("▁")}
|
||||
return self._no_prefix_space_tokens
|
||||
|
||||
@property
|
||||
def vocab_size(self):
|
||||
"""Returns vocab size"""
|
||||
return self.sp_model.get_piece_size()
|
||||
|
||||
@property
|
||||
def bos_token_id(self) -> Optional[int]:
|
||||
return self.sp_model.bos_id()
|
||||
|
||||
@property
|
||||
def eos_token_id(self) -> Optional[int]:
|
||||
return self.sp_model.eos_id()
|
||||
|
||||
def get_vocab(self):
|
||||
"""Returns vocab as a dict"""
|
||||
vocab = {self.convert_ids_to_tokens(i): i for i in range(self.vocab_size)}
|
||||
vocab.update(self.added_tokens_encoder)
|
||||
return vocab
|
||||
|
||||
def _tokenize(self, text):
|
||||
"""Returns a tokenized string."""
|
||||
return self.sp_model.encode(text, out_type=str)
|
||||
|
||||
def _convert_token_to_id(self, token):
|
||||
"""Converts a token (str) in an id using the vocab."""
|
||||
return self.sp_model.piece_to_id(token)
|
||||
|
||||
def _convert_id_to_token(self, index):
|
||||
"""Converts an index (integer) in a token (str) using the vocab."""
|
||||
token = self.sp_model.IdToPiece(index)
|
||||
return token
|
||||
|
||||
def _maybe_add_prefix_space(self, tokens, decoded):
|
||||
if tokens and tokens[0] not in self.no_prefix_space_tokens:
|
||||
return " " + decoded
|
||||
else:
|
||||
return decoded
|
||||
|
||||
def convert_tokens_to_string(self, tokens):
|
||||
"""Converts a sequence of tokens (string) in a single string."""
|
||||
current_sub_tokens = []
|
||||
out_string = ""
|
||||
prev_is_special = False
|
||||
for token in tokens:
|
||||
# make sure that special tokens are not decoded using sentencepiece model
|
||||
if token in self.all_special_tokens:
|
||||
if not prev_is_special:
|
||||
out_string += " "
|
||||
out_string += self.sp_model.decode(current_sub_tokens) + token
|
||||
prev_is_special = True
|
||||
current_sub_tokens = []
|
||||
else:
|
||||
current_sub_tokens.append(token)
|
||||
prev_is_special = False
|
||||
out_string += self.sp_model.decode(current_sub_tokens)
|
||||
out_string = self.clean_up_tokenization(out_string)
|
||||
out_string = self._maybe_add_prefix_space(tokens=tokens, decoded=out_string)
|
||||
return out_string[1:]
|
||||
|
||||
def save_vocabulary(self, save_directory, filename_prefix: Optional[str] = None) -> Tuple[str]:
|
||||
"""
|
||||
Save the vocabulary and special tokens file to a directory.
|
||||
|
||||
Args:
|
||||
save_directory (`str`):
|
||||
The directory in which to save the vocabulary.
|
||||
|
||||
Returns:
|
||||
`Tuple(str)`: Paths to the files saved.
|
||||
"""
|
||||
if not os.path.isdir(save_directory):
|
||||
logger.error(f"Vocabulary path ({save_directory}) should be a directory")
|
||||
return
|
||||
out_vocab_file = os.path.join(
|
||||
save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]
|
||||
)
|
||||
|
||||
if os.path.abspath(self.vocab_file) != os.path.abspath(out_vocab_file) and os.path.isfile(self.vocab_file):
|
||||
copyfile(self.vocab_file, out_vocab_file)
|
||||
elif not os.path.isfile(self.vocab_file):
|
||||
with open(out_vocab_file, "wb") as fi:
|
||||
content_spiece_model = self.sp_model.serialized_model_proto()
|
||||
fi.write(content_spiece_model)
|
||||
|
||||
return (out_vocab_file,)
|
||||
|
||||
def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
|
||||
if self.add_bos_token:
|
||||
bos_token_ids = [self.bos_token_id]
|
||||
else:
|
||||
bos_token_ids = []
|
||||
|
||||
output = bos_token_ids + token_ids_0
|
||||
|
||||
if token_ids_1 is not None:
|
||||
output = output + token_ids_1
|
||||
|
||||
if self.add_eos_token:
|
||||
output = output + [self.eos_token_id]
|
||||
|
||||
return output
|
||||
|
||||
def get_special_tokens_mask(
|
||||
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False
|
||||
) -> List[int]:
|
||||
"""
|
||||
Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
|
||||
special tokens using the tokenizer `prepare_for_model` method.
|
||||
|
||||
Args:
|
||||
token_ids_0 (`List[int]`):
|
||||
List of IDs.
|
||||
token_ids_1 (`List[int]`, *optional*):
|
||||
Optional second list of IDs for sequence pairs.
|
||||
already_has_special_tokens (`bool`, *optional*, defaults to `False`):
|
||||
Whether or not the token list is already formatted with special tokens for the model.
|
||||
|
||||
Returns:
|
||||
`List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
|
||||
"""
|
||||
if already_has_special_tokens:
|
||||
return super().get_special_tokens_mask(
|
||||
token_ids_0=token_ids_0, token_ids_1=token_ids_1, already_has_special_tokens=True
|
||||
)
|
||||
|
||||
if token_ids_1 is None:
|
||||
return [1] + ([0] * len(token_ids_0)) + [1]
|
||||
return [1] + ([0] * len(token_ids_0)) + [1, 1] + ([0] * len(token_ids_1)) + [1]
|
||||
|
||||
def create_token_type_ids_from_sequences(
|
||||
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
|
||||
) -> List[int]:
|
||||
"""
|
||||
Create a mask from the two sequences passed to be used in a sequence-pair classification task. T5 does not make
|
||||
use of token type ids, therefore a list of zeros is returned.
|
||||
|
||||
Args:
|
||||
token_ids_0 (`List[int]`):
|
||||
List of IDs.
|
||||
token_ids_1 (`List[int]`, *optional*):
|
||||
Optional second list of IDs for sequence pairs.
|
||||
|
||||
Returns:
|
||||
`List[int]`: List of zeros.
|
||||
"""
|
||||
eos = [self.eos_token_id]
|
||||
|
||||
if token_ids_1 is None:
|
||||
return len(token_ids_0 + eos) * [0]
|
||||
return len(token_ids_0 + eos + token_ids_1 + eos) * [0]
|
||||
3
tokenizer.model
Normal file
3
tokenizer.model
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f868398fc4e05ee1e8aeba95ddf18ddcc45b8bce55d5093bead5bbf80429b48b
|
||||
size 1477754
|
||||
100
tokenizer_config.json
Normal file
100
tokenizer_config.json
Normal file
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"added_tokens_decoder": {
|
||||
"0": {
|
||||
"content": "<unk>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"1": {
|
||||
"content": "<s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"2": {
|
||||
"content": "</s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"92538": {
|
||||
"content": "<|plugin|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"92539": {
|
||||
"content": "<|interpreter|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"92540": {
|
||||
"content": "<|action_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"92541": {
|
||||
"content": "<|action_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"92542": {
|
||||
"content": "<|im_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"92543": {
|
||||
"content": "<|im_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
}
|
||||
},
|
||||
"additional_special_tokens": [
|
||||
"<|im_start|>",
|
||||
"<|im_end|>",
|
||||
"<|action_start|>",
|
||||
"<|action_end|>",
|
||||
"<|interpreter|>",
|
||||
"<|plugin|>"
|
||||
],
|
||||
"auto_map": {
|
||||
"AutoTokenizer": [
|
||||
"tokenization_internlm2.InternLM2Tokenizer",
|
||||
null
|
||||
]
|
||||
},
|
||||
"bos_token": "<s>",
|
||||
"chat_template": "{% set system_message = 'You are a helpful, honest, and harmless AI assistant.\\n当开启工具以及代码时,根据需求选择合适的工具进行调用' %}{% if messages[0]['role'] == 'system' %}{% set system_message = messages[0]['content'] %}{% endif %}{% if system_message is defined %}{{ '<s>' + '<|im_start|>system\\n' + system_message + '<|im_end|>\\n' }}{% endif %}{% for message in messages %}{% set content = message['content'] %}{% if message['role'] == 'user' %}{{ '<|im_start|>user\\n' + content + '<|im_end|>\\n<|im_start|>assistant\\n' }}{% elif message['role'] == 'assistant' %}{{ content + '\\n' }}{% endif %}{% endfor %}",
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "</s>",
|
||||
"model_max_length": 1000000000000000019884624838656,
|
||||
"pad_token": "</s>",
|
||||
"padding_side": "left",
|
||||
"split_special_tokens": false,
|
||||
"tokenizer_class": "InternLM2Tokenizer",
|
||||
"unk_token": "<unk>"
|
||||
}
|
||||
Reference in New Issue
Block a user