初始化项目,由ModelHub XC社区提供模型

Model: internlm/internlm-chat-7b
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-06-10 21:56:22 +08:00
commit 0c697347cd
19 changed files with 2413 additions and 0 deletions

43
.gitattributes vendored Normal file
View File

@@ -0,0 +1,43 @@
*.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
pytorch_model-00007-of-00008.bin filter=lfs diff=lfs merge=lfs -text
pytorch_model-00008-of-00008.bin filter=lfs diff=lfs merge=lfs -text
pytorch_model-00001-of-00008.bin filter=lfs diff=lfs merge=lfs -text
pytorch_model-00002-of-00008.bin filter=lfs diff=lfs merge=lfs -text
pytorch_model-00003-of-00008.bin filter=lfs diff=lfs merge=lfs -text
pytorch_model-00004-of-00008.bin filter=lfs diff=lfs merge=lfs -text
pytorch_model-00005-of-00008.bin filter=lfs diff=lfs merge=lfs -text
pytorch_model-00006-of-00008.bin filter=lfs diff=lfs merge=lfs -text

172
README.md Normal file
View File

@@ -0,0 +1,172 @@
---
pipeline_tag: text-generation
---
# InternLM
<div align="center">
<img src="https://github.com/InternLM/InternLM/assets/22529082/b9788105-8892-4398-8b47-b513a292378e" width="200"/>
<div>&nbsp;</div>
<div align="center">
<b><font size="5">InternLM</font></b>
<sup>
<a href="https://internlm.intern-ai.org.cn/">
<i><font size="4">HOT</font></i>
</a>
</sup>
<div>&nbsp;</div>
</div>
[![evaluation](https://github.com/InternLM/InternLM/assets/22529082/f80a2a58-5ddf-471a-8da4-32ab65c8fd3b)](https://github.com/internLM/OpenCompass/)
[💻Github Repo](https://github.com/InternLM/InternLM) • [🤔Reporting Issues](https://github.com/InternLM/InternLM/issues/new)
</div>
## Introduction
InternLM has open-sourced a 7 billion parameter base model and a chat model tailored for practical scenarios. The model has the following characteristics:
- It leverages trillions of high-quality tokens for training to establish a powerful knowledge base.
- It supports an 8k context window length, enabling longer input sequences and stronger reasoning capabilities.
- It provides a versatile toolset for users to flexibly build their own workflows.
## InternLM-7B
### Performance Evaluation
We conducted a comprehensive evaluation of InternLM using the open-source evaluation tool [OpenCompass](https://github.com/internLM/OpenCompass/). The evaluation covered five dimensions of capabilities: disciplinary competence, language competence, knowledge competence, inference competence, and comprehension competence. Here are some of the evaluation results, and you can visit the [OpenCompass leaderboard](https://rank.opencompass.org.cn) for more evaluation results.
| Datasets\Models | **InternLM-Chat-7B** | **InternLM-7B** | LLaMA-7B | Baichuan-7B | ChatGLM2-6B | Alpaca-7B | Vicuna-7B |
| -------------------- | --------------------- | ---------------- | --------- | --------- | ------------ | --------- | ---------- |
| C-Eval(Val) | 53.2 | 53.4 | 24.2 | 42.7 | 50.9 | 28.9 | 31.2 |
| MMLU | 50.8 | 51.0 | 35.2* | 41.5 | 46.0 | 39.7 | 47.3 |
| AGIEval | 42.5 | 37.6 | 20.8 | 24.6 | 39.0 | 24.1 | 26.4 |
| CommonSenseQA | 75.2 | 59.5 | 65.0 | 58.8 | 60.0 | 68.7 | 66.7 |
| BUSTM | 74.3 | 50.6 | 48.5 | 51.3 | 55.0 | 48.8 | 62.5 |
| CLUEWSC | 78.6 | 59.1 | 50.3 | 52.8 | 59.8 | 50.3 | 52.2 |
| MATH | 6.4 | 7.1 | 2.8 | 3.0 | 6.6 | 2.2 | 2.8 |
| GSM8K | 34.5 | 31.2 | 10.1 | 9.7 | 29.2 | 6.0 | 15.3 |
| HumanEval | 14.0 | 10.4 | 14.0 | 9.2 | 9.2 | 9.2 | 11.0 |
| RACE(High) | 76.3 | 57.4 | 46.9* | 28.1 | 66.3 | 40.7 | 54.0 |
- The evaluation results were obtained from [OpenCompass 20230706](https://github.com/internLM/OpenCompass/) (some data marked with *, which means come from the original papers), and evaluation configuration can be found in the configuration files provided by [OpenCompass](https://github.com/internLM/OpenCompass/).
- The evaluation data may have numerical differences due to the version iteration of [OpenCompass](https://github.com/internLM/OpenCompass/), so please refer to the latest evaluation results of [OpenCompass](https://github.com/internLM/OpenCompass/).
**Limitations:** Although we have made efforts to ensure the safety of the model during the training process and to encourage the model to generate text that complies with ethical and legal requirements, the model may still produce unexpected outputs due to its size and probabilistic generation paradigm. For example, the generated responses may contain biases, discrimination, or other harmful content. Please do not propagate such content. We are not responsible for any consequences resulting from the dissemination of harmful information.
### Import from Transformers
To load the InternLM 7B Chat model using Transformers, use the following code:
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("internlm/internlm-chat-7b", trust_remote_code=True)
# Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and cause OOM Error.
model = AutoModelForCausalLM.from_pretrained("internlm/internlm-chat-7b", torch_dtype=torch.float16, trust_remote_code=True).cuda()
model = model.eval()
response, history = model.chat(tokenizer, "hello", history=[])
print(response)
# Hello! How can I help you today?
response, history = model.chat(tokenizer, "please provide three suggestions about time management", history=history)
print(response)
# Sure, here are three tips for effective time management:
#
# 1. Prioritize tasks based on importance and urgency: Make a list of all your tasks and categorize them into "important and urgent," "important but not urgent," and "not important but urgent." Focus on completing the tasks in the first category before moving on to the others.
# 2. Use a calendar or planner: Write down deadlines and appointments in a calendar or planner so you don't forget them. This will also help you schedule your time more effectively and avoid overbooking yourself.
# 3. Minimize distractions: Try to eliminate any potential distractions when working on important tasks. Turn off notifications on your phone, close unnecessary tabs on your computer, and find a quiet place to work if possible.
#
# Remember, good time management skills take practice and patience. Start with small steps and gradually incorporate these habits into your daily routine.
```
The responses can be streamed using `stream_chat`:
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = "internlm/internlm-chat-7b"
model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.float16, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = model.eval()
length = 0
for response, history in model.stream_chat(tokenizer, "Hello", history=[]):
print(response[length:], flush=True, end="")
length = len(response)
```
## 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, please fill in the [application form (English)](https://wj.qq.com/s2/12727483/5dba/)/[申请表(中文)](https://wj.qq.com/s2/12725412/f7c1/). For other questions or collaborations, please contact <internlm@pjlab.org.cn>.
## 简介
InternLM 即书生·浦语大模型包含面向实用场景的70亿参数基础模型与对话模型 InternLM-7B。模型具有以下特点
- 使用上万亿高质量预料,建立模型超强知识体系;
- 支持8k语境窗口长度实现更长输入与更强推理体验
- 通用工具调用能力,支持用户灵活自助搭建流程;
## InternLM-7B
### 性能评测
我们使用开源评测工具 [OpenCompass](https://github.com/internLM/OpenCompass/) 从学科综合能力、语言能力、知识能力、推理能力、理解能力五大能力维度对InternLM开展全面评测部分评测结果如下表所示欢迎访问[ OpenCompass 榜单 ](https://rank.opencompass.org.cn)获取更多的评测结果。
| 数据集\模型 | **InternLM-Chat-7B** | **InternLM-7B** | LLaMA-7B | Baichuan-7B | ChatGLM2-6B | Alpaca-7B | Vicuna-7B |
| -------------------- | --------------------- | ---------------- | --------- | --------- | ------------ | --------- | ---------- |
| C-Eval(Val) | 53.2 | 53.4 | 24.2 | 42.7 | 50.9 | 28.9 | 31.2 |
| MMLU | 50.8 | 51.0 | 35.2* | 41.5 | 46.0 | 39.7 | 47.3 |
| AGIEval | 42.5 | 37.6 | 20.8 | 24.6 | 39.0 | 24.1 | 26.4 |
| CommonSenseQA | 75.2 | 59.5 | 65.0 | 58.8 | 60.0 | 68.7 | 66.7 |
| BUSTM | 74.3 | 50.6 | 48.5 | 51.3 | 55.0 | 48.8 | 62.5 |
| CLUEWSC | 78.6 | 59.1 | 50.3 | 52.8 | 59.8 | 50.3 | 52.2 |
| MATH | 6.4 | 7.1 | 2.8 | 3.0 | 6.6 | 2.2 | 2.8 |
| GSM8K | 34.5 | 31.2 | 10.1 | 9.7 | 29.2 | 6.0 | 15.3 |
| HumanEval | 14.0 | 10.4 | 14.0 | 9.2 | 9.2 | 9.2 | 11.0 |
| RACE(High) | 76.3 | 57.4 | 46.9* | 28.1 | 66.3 | 40.7 | 54.0 |
- 以上评测结果基于 [OpenCompass 20230706](https://github.com/internLM/OpenCompass/) 获得(部分数据标注`*`代表数据来自原始论文),具体测试细节可参见 [OpenCompass](https://github.com/internLM/OpenCompass/) 中提供的配置文件。
- 评测数据会因 [OpenCompass](https://github.com/internLM/OpenCompass/) 的版本迭代而存在数值差异,请以 [OpenCompass](https://github.com/internLM/OpenCompass/) 最新版的评测结果为主。
**局限性:** 尽管在训练过程中我们非常注重模型的安全性,尽力促使模型输出符合伦理和法律要求的文本,但受限于模型大小以及概率生成范式,模型可能会产生各种不符合预期的输出,例如回复内容包含偏见、歧视等有害内容,请勿传播这些内容。由于传播不良信息导致的任何后果,本项目不承担责任。
### 通过 Transformers 加载
通过以下的代码加载 InternLM 7B Chat 模型
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("internlm/internlm-chat-7b", trust_remote_code=True)
# `torch_dtype=torch.float16` 可以令模型以 float16 精度加载,否则 transformers 会将模型加载为 float32导致显存不足
model = AutoModelForCausalLM.from_pretrained("internlm/internlm-chat-7b", torch_dtype=torch.float16, trust_remote_code=True).cuda()
model = model.eval()
response, history = model.chat(tokenizer, "你好", history=[])
print(response)
# 你好!有什么我可以帮助你的吗?
response, history = model.chat(tokenizer, "请提供三个管理时间的建议。", history=history)
print(response)
# 当然可以!以下是三个管理时间的建议:
# 1. 制定计划:制定一个详细的计划,包括每天要完成的任务和活动。这将有助于您更好地组织时间,并确保您能够按时完成任务。
# 2. 优先级:将任务按照优先级排序,先完成最重要的任务。这将确保您能够在最短的时间内完成最重要的任务,从而节省时间。
# 3. 集中注意力:避免分心,集中注意力完成任务。关闭社交媒体和电子邮件通知,专注于任务,这将帮助您更快地完成任务,并减少错误的可能性。
```
如果想进行流式生成,则可以使用 `stream_chat` 接口:
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = "internlm/internlm-chat-7b"
model = AutoModelForCausalLM.from_pretrained(model_path, torch_dype=torch.float16, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = model.eval()
length = 0
for response, history in model.stream_chat(tokenizer, "你好", history=[]):
print(response[length:], flush=True, end="")
length = len(response)
```
## 开源许可证
本仓库的代码依照 Apache-2.0 协议开源。模型权重对学术研究完全开放,也可申请免费的商业使用授权([申请表](https://wj.qq.com/s2/12725412/f7c1/))。其他问题与合作请联系 <internlm@pjlab.org.cn>

28
config.json Normal file
View File

@@ -0,0 +1,28 @@
{
"architectures": [
"InternLMForCausalLM"
],
"auto_map": {
"AutoConfig": "configuration_internlm.InternLMConfig",
"AutoModel": "modeling_internlm.InternLMForCausalLM",
"AutoModelForCausalLM": "modeling_internlm.InternLMForCausalLM"
},
"bias": true,
"bos_token_id": 1,
"eos_token_id": 2,
"hidden_act": "silu",
"hidden_size": 4096,
"initializer_range": 0.02,
"intermediate_size": 11008,
"max_position_embeddings": 2048,
"model_type": "internlm",
"num_attention_heads": 32,
"num_hidden_layers": 32,
"pad_token_id": 2,
"rms_norm_eps": 1e-06,
"tie_word_embeddings": false,
"torch_dtype": "float16",
"transformers_version": "4.33.2",
"use_cache": true,
"vocab_size": 103168
}

116
configuration_internlm.py Normal file
View File

@@ -0,0 +1,116 @@
# 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.
""" InternLM model configuration"""
from transformers.configuration_utils import PretrainedConfig
from transformers.utils import logging
logger = logging.get_logger(__name__)
INTERNLM_PRETRAINED_CONFIG_ARCHIVE_MAP = {}
# Modified from transformers.model.llama.configuration_llama.LlamaConfig
class InternLMConfig(PretrainedConfig):
r"""
This is the configuration class to store the configuration of a [`InternLMModel`]. It is used to instantiate
an InternLM 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 InternLM-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 InternLM model. Defines the number of different tokens that can be represented by the
`inputs_ids` passed when calling [`InternLMModel`]
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.
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:
```python
>>> from transformers import InternLMModel, InternLMConfig
>>> # Initializing a InternLM internlm-7b style configuration
>>> configuration = InternLMConfig()
>>> # Initializing a model from the internlm-7b style configuration
>>> model = InternLMModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```"""
model_type = "internlm"
_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,
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,
rotary={"base": 10000, "type": "dynamic"}, # pylint: disable=W0102
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.hidden_act = hidden_act
self.initializer_range = initializer_range
self.rms_norm_eps = rms_norm_eps
self.use_cache = use_cache
self.bias = bias
self.rotary = rotary
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,
)

7
generation_config.json Normal file
View File

@@ -0,0 +1,7 @@
{
"_from_model_config": true,
"bos_token_id": 1,
"eos_token_id": 2,
"pad_token_id": 2,
"transformers_version": "4.33.2"
}

1304
modeling_internlm.py Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:913fb6d43f9a12afcbfa7f61c2ff448d0a8271c3b82c7a295619a74bd10eb3dd
size 1969371359

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b505624ced70c57b0aa685a44f0edf0a0267310b8ac5b9aef18df30901ca4873
size 1933845097

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:29c11def7e5ad757434c89ca07500ac99231683cdbd489f051be0b0fc8877fd2
size 1933845161

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:09c8ad0ec21cf97b308b2e53deaa92c27bd687b2e9027474a9e680dd9fb676ea
size 1990459141

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3ec9dc8e8c583587c1d965d7848f191fd6d1cab8fae866c3f1e7f4227ee13107
size 1990459735

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e5eeaab4bcc0146a6bca61fc2cb1c6215de3934995d5c9a17bd05453f7b9f65c
size 1990459735

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5f2eca07263e93cb2b0f6c63e77a6d99d564b66ccc2d82f0aadbc953b3870ff5
size 1990468265

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d8553c3ce27e157933280b9f39e90d5d51be98d95f2d0c7f6999e4312a41325e
size 845153194

View File

@@ -0,0 +1,458 @@
{
"metadata": {
"total_size": 14643904512
},
"weight_map": {
"lm_head.weight": "pytorch_model-00008-of-00008.bin",
"model.embed_tokens.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.0.input_layernorm.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.0.mlp.down_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.0.mlp.gate_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.0.mlp.up_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.0.post_attention_layernorm.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.0.self_attn.k_proj.bias": "pytorch_model-00001-of-00008.bin",
"model.layers.0.self_attn.k_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.0.self_attn.o_proj.bias": "pytorch_model-00001-of-00008.bin",
"model.layers.0.self_attn.o_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.0.self_attn.q_proj.bias": "pytorch_model-00001-of-00008.bin",
"model.layers.0.self_attn.q_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.0.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00008.bin",
"model.layers.0.self_attn.v_proj.bias": "pytorch_model-00001-of-00008.bin",
"model.layers.0.self_attn.v_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.1.input_layernorm.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.1.mlp.down_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.1.mlp.gate_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.1.mlp.up_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.1.post_attention_layernorm.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.1.self_attn.k_proj.bias": "pytorch_model-00001-of-00008.bin",
"model.layers.1.self_attn.k_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.1.self_attn.o_proj.bias": "pytorch_model-00001-of-00008.bin",
"model.layers.1.self_attn.o_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.1.self_attn.q_proj.bias": "pytorch_model-00001-of-00008.bin",
"model.layers.1.self_attn.q_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.1.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00008.bin",
"model.layers.1.self_attn.v_proj.bias": "pytorch_model-00001-of-00008.bin",
"model.layers.1.self_attn.v_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.10.input_layernorm.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.10.mlp.down_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.10.mlp.gate_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.10.mlp.up_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.10.post_attention_layernorm.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.10.self_attn.k_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.10.self_attn.k_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.10.self_attn.o_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.10.self_attn.o_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.10.self_attn.q_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.10.self_attn.q_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.10.self_attn.rotary_emb.inv_freq": "pytorch_model-00003-of-00008.bin",
"model.layers.10.self_attn.v_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.10.self_attn.v_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.11.input_layernorm.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.11.mlp.down_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.11.mlp.gate_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.11.mlp.up_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.11.post_attention_layernorm.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.11.self_attn.k_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.11.self_attn.k_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.11.self_attn.o_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.11.self_attn.o_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.11.self_attn.q_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.11.self_attn.q_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.11.self_attn.rotary_emb.inv_freq": "pytorch_model-00003-of-00008.bin",
"model.layers.11.self_attn.v_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.11.self_attn.v_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.12.input_layernorm.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.12.mlp.down_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.12.mlp.gate_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.12.mlp.up_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.12.post_attention_layernorm.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.12.self_attn.k_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.12.self_attn.k_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.12.self_attn.o_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.12.self_attn.o_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.12.self_attn.q_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.12.self_attn.q_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.12.self_attn.rotary_emb.inv_freq": "pytorch_model-00003-of-00008.bin",
"model.layers.12.self_attn.v_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.12.self_attn.v_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.13.input_layernorm.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.13.mlp.down_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.13.mlp.gate_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.13.mlp.up_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.13.post_attention_layernorm.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.13.self_attn.k_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.13.self_attn.k_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.13.self_attn.o_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.13.self_attn.o_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.13.self_attn.q_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.13.self_attn.q_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.13.self_attn.rotary_emb.inv_freq": "pytorch_model-00004-of-00008.bin",
"model.layers.13.self_attn.v_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.13.self_attn.v_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.14.input_layernorm.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.14.mlp.down_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.14.mlp.gate_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.14.mlp.up_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.14.post_attention_layernorm.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.14.self_attn.k_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.14.self_attn.k_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.14.self_attn.o_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.14.self_attn.o_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.14.self_attn.q_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.14.self_attn.q_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.14.self_attn.rotary_emb.inv_freq": "pytorch_model-00004-of-00008.bin",
"model.layers.14.self_attn.v_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.14.self_attn.v_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.15.input_layernorm.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.15.mlp.down_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.15.mlp.gate_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.15.mlp.up_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.15.post_attention_layernorm.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.15.self_attn.k_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.15.self_attn.k_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.15.self_attn.o_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.15.self_attn.o_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.15.self_attn.q_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.15.self_attn.q_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.15.self_attn.rotary_emb.inv_freq": "pytorch_model-00004-of-00008.bin",
"model.layers.15.self_attn.v_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.15.self_attn.v_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.16.input_layernorm.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.16.mlp.down_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.16.mlp.gate_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.16.mlp.up_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.16.post_attention_layernorm.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.16.self_attn.k_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.16.self_attn.k_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.16.self_attn.o_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.16.self_attn.o_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.16.self_attn.q_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.16.self_attn.q_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.16.self_attn.rotary_emb.inv_freq": "pytorch_model-00004-of-00008.bin",
"model.layers.16.self_attn.v_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.16.self_attn.v_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.17.input_layernorm.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.17.mlp.down_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.17.mlp.gate_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.17.mlp.up_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.17.post_attention_layernorm.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.17.self_attn.k_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.17.self_attn.k_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.17.self_attn.o_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.17.self_attn.o_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.17.self_attn.q_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.17.self_attn.q_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.17.self_attn.rotary_emb.inv_freq": "pytorch_model-00005-of-00008.bin",
"model.layers.17.self_attn.v_proj.bias": "pytorch_model-00004-of-00008.bin",
"model.layers.17.self_attn.v_proj.weight": "pytorch_model-00004-of-00008.bin",
"model.layers.18.input_layernorm.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.18.mlp.down_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.18.mlp.gate_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.18.mlp.up_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.18.post_attention_layernorm.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.18.self_attn.k_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.18.self_attn.k_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.18.self_attn.o_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.18.self_attn.o_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.18.self_attn.q_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.18.self_attn.q_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.18.self_attn.rotary_emb.inv_freq": "pytorch_model-00005-of-00008.bin",
"model.layers.18.self_attn.v_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.18.self_attn.v_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.19.input_layernorm.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.19.mlp.down_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.19.mlp.gate_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.19.mlp.up_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.19.post_attention_layernorm.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.19.self_attn.k_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.19.self_attn.k_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.19.self_attn.o_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.19.self_attn.o_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.19.self_attn.q_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.19.self_attn.q_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.19.self_attn.rotary_emb.inv_freq": "pytorch_model-00005-of-00008.bin",
"model.layers.19.self_attn.v_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.19.self_attn.v_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.2.input_layernorm.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.2.mlp.down_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.2.mlp.gate_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.2.mlp.up_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.2.post_attention_layernorm.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.2.self_attn.k_proj.bias": "pytorch_model-00001-of-00008.bin",
"model.layers.2.self_attn.k_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.2.self_attn.o_proj.bias": "pytorch_model-00001-of-00008.bin",
"model.layers.2.self_attn.o_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.2.self_attn.q_proj.bias": "pytorch_model-00001-of-00008.bin",
"model.layers.2.self_attn.q_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.2.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00008.bin",
"model.layers.2.self_attn.v_proj.bias": "pytorch_model-00001-of-00008.bin",
"model.layers.2.self_attn.v_proj.weight": "pytorch_model-00001-of-00008.bin",
"model.layers.20.input_layernorm.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.20.mlp.down_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.20.mlp.gate_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.20.mlp.up_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.20.post_attention_layernorm.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.20.self_attn.k_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.20.self_attn.k_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.20.self_attn.o_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.20.self_attn.o_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.20.self_attn.q_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.20.self_attn.q_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.20.self_attn.rotary_emb.inv_freq": "pytorch_model-00005-of-00008.bin",
"model.layers.20.self_attn.v_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.20.self_attn.v_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.21.input_layernorm.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.21.mlp.down_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.21.mlp.gate_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.21.mlp.up_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.21.post_attention_layernorm.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.21.self_attn.k_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.21.self_attn.k_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.21.self_attn.o_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.21.self_attn.o_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.21.self_attn.q_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.21.self_attn.q_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.21.self_attn.rotary_emb.inv_freq": "pytorch_model-00005-of-00008.bin",
"model.layers.21.self_attn.v_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.21.self_attn.v_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.22.input_layernorm.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.22.mlp.down_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.22.mlp.gate_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.22.mlp.up_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.22.post_attention_layernorm.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.22.self_attn.k_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.22.self_attn.k_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.22.self_attn.o_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.22.self_attn.o_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.22.self_attn.q_proj.bias": "pytorch_model-00005-of-00008.bin",
"model.layers.22.self_attn.q_proj.weight": "pytorch_model-00005-of-00008.bin",
"model.layers.22.self_attn.rotary_emb.inv_freq": "pytorch_model-00006-of-00008.bin",
"model.layers.22.self_attn.v_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.22.self_attn.v_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.23.input_layernorm.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.23.mlp.down_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.23.mlp.gate_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.23.mlp.up_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.23.post_attention_layernorm.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.23.self_attn.k_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.23.self_attn.k_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.23.self_attn.o_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.23.self_attn.o_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.23.self_attn.q_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.23.self_attn.q_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.23.self_attn.rotary_emb.inv_freq": "pytorch_model-00006-of-00008.bin",
"model.layers.23.self_attn.v_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.23.self_attn.v_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.24.input_layernorm.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.24.mlp.down_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.24.mlp.gate_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.24.mlp.up_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.24.post_attention_layernorm.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.24.self_attn.k_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.24.self_attn.k_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.24.self_attn.o_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.24.self_attn.o_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.24.self_attn.q_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.24.self_attn.q_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.24.self_attn.rotary_emb.inv_freq": "pytorch_model-00006-of-00008.bin",
"model.layers.24.self_attn.v_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.24.self_attn.v_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.25.input_layernorm.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.25.mlp.down_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.25.mlp.gate_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.25.mlp.up_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.25.post_attention_layernorm.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.25.self_attn.k_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.25.self_attn.k_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.25.self_attn.o_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.25.self_attn.o_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.25.self_attn.q_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.25.self_attn.q_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.25.self_attn.rotary_emb.inv_freq": "pytorch_model-00006-of-00008.bin",
"model.layers.25.self_attn.v_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.25.self_attn.v_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.26.input_layernorm.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.26.mlp.down_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.26.mlp.gate_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.26.mlp.up_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.26.post_attention_layernorm.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.26.self_attn.k_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.26.self_attn.k_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.26.self_attn.o_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.26.self_attn.o_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.26.self_attn.q_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.26.self_attn.q_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.26.self_attn.rotary_emb.inv_freq": "pytorch_model-00006-of-00008.bin",
"model.layers.26.self_attn.v_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.26.self_attn.v_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.27.input_layernorm.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.27.mlp.down_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.27.mlp.gate_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.27.mlp.up_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.27.post_attention_layernorm.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.27.self_attn.k_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.27.self_attn.k_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.27.self_attn.o_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.27.self_attn.o_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.27.self_attn.q_proj.bias": "pytorch_model-00006-of-00008.bin",
"model.layers.27.self_attn.q_proj.weight": "pytorch_model-00006-of-00008.bin",
"model.layers.27.self_attn.rotary_emb.inv_freq": "pytorch_model-00007-of-00008.bin",
"model.layers.27.self_attn.v_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.27.self_attn.v_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.28.input_layernorm.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.28.mlp.down_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.28.mlp.gate_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.28.mlp.up_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.28.post_attention_layernorm.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.28.self_attn.k_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.28.self_attn.k_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.28.self_attn.o_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.28.self_attn.o_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.28.self_attn.q_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.28.self_attn.q_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.28.self_attn.rotary_emb.inv_freq": "pytorch_model-00007-of-00008.bin",
"model.layers.28.self_attn.v_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.28.self_attn.v_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.29.input_layernorm.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.29.mlp.down_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.29.mlp.gate_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.29.mlp.up_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.29.post_attention_layernorm.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.29.self_attn.k_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.29.self_attn.k_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.29.self_attn.o_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.29.self_attn.o_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.29.self_attn.q_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.29.self_attn.q_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.29.self_attn.rotary_emb.inv_freq": "pytorch_model-00007-of-00008.bin",
"model.layers.29.self_attn.v_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.29.self_attn.v_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.3.input_layernorm.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.3.mlp.down_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.3.mlp.gate_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.3.mlp.up_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.3.post_attention_layernorm.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.3.self_attn.k_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.3.self_attn.k_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.3.self_attn.o_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.3.self_attn.o_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.3.self_attn.q_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.3.self_attn.q_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.3.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00008.bin",
"model.layers.3.self_attn.v_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.3.self_attn.v_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.30.input_layernorm.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.30.mlp.down_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.30.mlp.gate_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.30.mlp.up_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.30.post_attention_layernorm.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.30.self_attn.k_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.30.self_attn.k_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.30.self_attn.o_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.30.self_attn.o_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.30.self_attn.q_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.30.self_attn.q_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.30.self_attn.rotary_emb.inv_freq": "pytorch_model-00007-of-00008.bin",
"model.layers.30.self_attn.v_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.30.self_attn.v_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.31.input_layernorm.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.31.mlp.down_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.31.mlp.gate_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.31.mlp.up_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.31.post_attention_layernorm.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.31.self_attn.k_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.31.self_attn.k_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.31.self_attn.o_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.31.self_attn.o_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.31.self_attn.q_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.31.self_attn.q_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.31.self_attn.rotary_emb.inv_freq": "pytorch_model-00007-of-00008.bin",
"model.layers.31.self_attn.v_proj.bias": "pytorch_model-00007-of-00008.bin",
"model.layers.31.self_attn.v_proj.weight": "pytorch_model-00007-of-00008.bin",
"model.layers.4.input_layernorm.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.4.mlp.down_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.4.mlp.gate_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.4.mlp.up_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.4.post_attention_layernorm.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.4.self_attn.k_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.4.self_attn.k_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.4.self_attn.o_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.4.self_attn.o_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.4.self_attn.q_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.4.self_attn.q_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.4.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00008.bin",
"model.layers.4.self_attn.v_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.4.self_attn.v_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.5.input_layernorm.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.5.mlp.down_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.5.mlp.gate_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.5.mlp.up_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.5.post_attention_layernorm.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.5.self_attn.k_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.5.self_attn.k_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.5.self_attn.o_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.5.self_attn.o_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.5.self_attn.q_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.5.self_attn.q_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.5.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00008.bin",
"model.layers.5.self_attn.v_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.5.self_attn.v_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.6.input_layernorm.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.6.mlp.down_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.6.mlp.gate_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.6.mlp.up_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.6.post_attention_layernorm.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.6.self_attn.k_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.6.self_attn.k_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.6.self_attn.o_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.6.self_attn.o_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.6.self_attn.q_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.6.self_attn.q_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.6.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00008.bin",
"model.layers.6.self_attn.v_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.6.self_attn.v_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.7.input_layernorm.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.7.mlp.down_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.7.mlp.gate_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.7.mlp.up_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.7.post_attention_layernorm.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.7.self_attn.k_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.7.self_attn.k_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.7.self_attn.o_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.7.self_attn.o_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.7.self_attn.q_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.7.self_attn.q_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.7.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00008.bin",
"model.layers.7.self_attn.v_proj.bias": "pytorch_model-00002-of-00008.bin",
"model.layers.7.self_attn.v_proj.weight": "pytorch_model-00002-of-00008.bin",
"model.layers.8.input_layernorm.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.8.mlp.down_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.8.mlp.gate_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.8.mlp.up_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.8.post_attention_layernorm.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.8.self_attn.k_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.8.self_attn.k_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.8.self_attn.o_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.8.self_attn.o_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.8.self_attn.q_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.8.self_attn.q_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.8.self_attn.rotary_emb.inv_freq": "pytorch_model-00003-of-00008.bin",
"model.layers.8.self_attn.v_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.8.self_attn.v_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.9.input_layernorm.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.9.mlp.down_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.9.mlp.gate_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.9.mlp.up_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.9.post_attention_layernorm.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.9.self_attn.k_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.9.self_attn.k_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.9.self_attn.o_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.9.self_attn.o_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.9.self_attn.q_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.9.self_attn.q_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.layers.9.self_attn.rotary_emb.inv_freq": "pytorch_model-00003-of-00008.bin",
"model.layers.9.self_attn.v_proj.bias": "pytorch_model-00003-of-00008.bin",
"model.layers.9.self_attn.v_proj.weight": "pytorch_model-00003-of-00008.bin",
"model.norm.weight": "pytorch_model-00007-of-00008.bin"
}
}

6
special_tokens_map.json Normal file
View File

@@ -0,0 +1,6 @@
{
"bos_token": "<s>",
"eos_token": "</s>",
"pad_token": "</s>",
"unk_token": "<unk>"
}

237
tokenization_internlm.py Normal file
View File

@@ -0,0 +1,237 @@
# 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 -> InternLM2Tokenizer
class InternLMTokenizer(PreTrainedTokenizer):
"""
Construct a InternLM 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
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:aab622d98c98677a1a51f969e25765154487bf3e85c7819db105db2fcacba83f
size 1658691

15
tokenizer_config.json Normal file
View File

@@ -0,0 +1,15 @@
{
"auto_map": {
"AutoTokenizer": [
"tokenization_internlm.InternLMTokenizer",
null
]
},
"bos_token": "<s>",
"clean_up_tokenization_spaces": false,
"eos_token": "</s>",
"model_max_length": 1000000000000000019884624838656,
"pad_token": "</s>",
"tokenizer_class": "InternLMTokenizer",
"unk_token": "<unk>"
}