upload model v1.0.0
Browse files- LICENSE +39 -0
- added_tokens.json +44 -0
- config.json +28 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +46 -0
- tokenization_inflm.py +292 -0
- tokenizer.model +3 -0
- tokenizer_config.json +393 -0
LICENSE
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Version Release Date: July 16, 2024
|
2 |
+
|
3 |
+
By engaging in any of the following activities with the Model or any Derivative Model, or by accepting the terms of this Agreement, you consent to be bound by the terms.
|
4 |
+
|
5 |
+
1. Definitions.
|
6 |
+
The following definitions apply to this Agreement:
|
7 |
+
1.1. "Derivative Model" refers to any of the following related to the Model: a. Modifications made to the Model; b. Works created based on the Model. c. Any other works derived from the Model.
|
8 |
+
1.2. "Legal Entity" means the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of fifty percent (50%) or more of the outstanding shares, or (c) beneficial ownership of such entity.
|
9 |
+
1.3. "Model" encompasses the following components of the machine learning model shared under this Agreement: Software,Checkpoints,Algorithms,Model Weights,Configuration files,Documentation,Code.
|
10 |
+
1.4. "Distribution" means any transmission, reproduction, publication or other sharing of the Model or Derivatives of the Model to a third party, including providing the Model as a hosted service made available by electronic or other remote means - e.g. API-based or web access.
|
11 |
+
1.5. "You" or "Your" means an individual or Legal Entity exercising permissions granted by this Agreement.
|
12 |
+
1.6. "INF" (or "we") means INF Technology (Shanghai) Co., Ltd. and/or any of their affiliates.
|
13 |
+
1.7. "Third Parties" means individuals or legal entities that are not under common control with INF or You.
|
14 |
+
|
15 |
+
2. Grant of Rights.
|
16 |
+
Your use of the following rights is strictly dependent on your complete adherence to the terms of this Agreement. In accordance with the stipulations of this Agreement, INF grants you the following rights, which are perpetual, global, non-exclusive, free of charge, and royalty-free, and are subject to revocation:
|
17 |
+
2.1. The right to publicly perform and display the Model.
|
18 |
+
2.2. The right to reproduce and utilize the Model.
|
19 |
+
2.3. The right to create derivative works based on the Model.
|
20 |
+
2.4. The authority to manufacture, have manufactured, and sell the Model or its derivatives.
|
21 |
+
2.5. The ability to offer for sale, distribute, and import the Model or its derivatives through various distribution channels.
|
22 |
+
|
23 |
+
3. Redistribution.
|
24 |
+
You are permitted to reproduce and distribute the Model or any Derivative Models, either in their original form or with modifications, across various mediums, as long as you fulfill the following requirements:
|
25 |
+
3.1. If you choose to distribute the Model, it is mandatory to:
|
26 |
+
Provide each recipient with a copy of this Agreement.
|
27 |
+
3.2. You have the right to:
|
28 |
+
a. Append your own copyright statement to the modifications you make.
|
29 |
+
b. Offer alternative or supplementary licensing terms and conditions for the use, reproduction, or distribution of your modifications.
|
30 |
+
c. Establish terms and conditions for the Derivative Models as a whole.
|
31 |
+
d. However, this is only permissible if your use, reproduction, and distribution of the original Model align with the conditions laid out in this Agreement.
|
32 |
+
|
33 |
+
4. Other Provisions
|
34 |
+
4.1. Trademarks. No rights are given to use the trade names, trademarks, service marks, or product names of INF as part of this agreement, except as required for reasonable and customary use in describing the origin of the Model and fulfilling the notice requirements explicitly stated in this Agreement.
|
35 |
+
4.2. Disclaimer of Warranty. Unless explicitly stipulated in writing or mandated by law, INF offers the Model strictly in its existing condition, without any form of warranty, whether stated or implied. This includes, but is not limited to, any warranties or conditions regarding the title, non-infringement, merchantability, or suitability for a specific purpose. It is your sole responsibility to assess the suitability of using or redistributing the Model, its derivatives, and any outputs. You also assume all risks related to the exercise of the rights granted by this Agreement.
|
36 |
+
4.3. Governing Law and Jurisdiction. This agreement will be governed and construed under PRC laws without regard to choice of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this agreement. The People's Courts in Shanghai shall have exclusive jurisdiction over any dispute arising out of this Agreement.
|
37 |
+
4.5. If any provision of this License is held to be invalid, illegal or unenforceable, the remaining provisions shall be unaffected thereby and remain valid as if such provision had not been set forth herein.
|
38 |
+
4.6. Personal information, IP rights and related. This Model may contain personal information and works with IP rights. You commit to complying with applicable laws and regulations in the handling of personal information and the use of such works. Please note that INF's license granted to you to use the Model does not imply that you have obtained a legitimate basis for processing the related information or works. As an independent personal information processor and IP rights user, you need to ensure full compliance with relevant legal and regulatory requirements when handling personal information and works with IP rights that may be contained in the Model, and are willing to assume solely any risks and consequences that may arise from that.
|
39 |
+
4.7. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall INF be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Model and the Complementary Material (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if INF has been advised of the possibility of such damages.
|
added_tokens.json
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"<code_to_intermediate>": 96521,
|
3 |
+
"<empty_output>": 96520,
|
4 |
+
"<file_sep>": 96511,
|
5 |
+
"<fim_middle>": 96508,
|
6 |
+
"<fim_prefix>": 96507,
|
7 |
+
"<fim_suffix>": 96509,
|
8 |
+
"<intermediate_to_code>": 96522,
|
9 |
+
"<issue_closed>": 96514,
|
10 |
+
"<issue_comment>": 96513,
|
11 |
+
"<issue_start>": 96512,
|
12 |
+
"<jupyter_code>": 96517,
|
13 |
+
"<jupyter_output>": 96518,
|
14 |
+
"<jupyter_script>": 96519,
|
15 |
+
"<jupyter_start>": 96515,
|
16 |
+
"<jupyter_text>": 96516,
|
17 |
+
"<pr>": 96523,
|
18 |
+
"<pr_base>": 96526,
|
19 |
+
"<pr_base_code>": 96528,
|
20 |
+
"<pr_comment>": 96531,
|
21 |
+
"<pr_diff>": 96529,
|
22 |
+
"<pr_diff_hunk>": 96530,
|
23 |
+
"<pr_diff_hunk_comment_line>": 96538,
|
24 |
+
"<pr_event_id>": 96532,
|
25 |
+
"<pr_file>": 96527,
|
26 |
+
"<pr_in_reply_to_comment_id>": 96537,
|
27 |
+
"<pr_in_reply_to_review_id>": 96536,
|
28 |
+
"<pr_is_merged>": 96525,
|
29 |
+
"<pr_review>": 96533,
|
30 |
+
"<pr_review_comment>": 96535,
|
31 |
+
"<pr_review_state>": 96534,
|
32 |
+
"<pr_status>": 96524,
|
33 |
+
"<repo_name>": 96510,
|
34 |
+
"<|endoftext|>": 96506,
|
35 |
+
"<|end|>": 96500,
|
36 |
+
"<|im_end|>": 96539,
|
37 |
+
"<|im_start|>": 96540,
|
38 |
+
"<|message|>": 96501,
|
39 |
+
"<|pad|>": 96505,
|
40 |
+
"<|start|>": 96499,
|
41 |
+
"<|tool_end|>": 96504,
|
42 |
+
"<|tool_excute|>": 96503,
|
43 |
+
"<|tool_start|>": 96502
|
44 |
+
}
|
config.json
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"LlamaForCausalLM"
|
4 |
+
],
|
5 |
+
"attention_bias": false,
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 1,
|
8 |
+
"eos_token_id": 96539,
|
9 |
+
"hidden_act": "silu",
|
10 |
+
"hidden_size": 2240,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"intermediate_size": 6144,
|
13 |
+
"max_position_embeddings": 4096,
|
14 |
+
"mlp_bias": false,
|
15 |
+
"model_type": "llama",
|
16 |
+
"num_attention_heads": 14,
|
17 |
+
"num_hidden_layers": 24,
|
18 |
+
"num_key_value_heads": 14,
|
19 |
+
"pretraining_tp": 1,
|
20 |
+
"rms_norm_eps": 1e-05,
|
21 |
+
"rope_scaling": null,
|
22 |
+
"rope_theta": 10000.0,
|
23 |
+
"tie_word_embeddings": false,
|
24 |
+
"torch_dtype": "bfloat16",
|
25 |
+
"transformers_version": "4.44.2",
|
26 |
+
"use_cache": true,
|
27 |
+
"vocab_size": 96640
|
28 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7289efa40bc6caec7853851045f493f428a39e5daf647005350a0f6833cabc6f
|
3 |
+
size 3811365114
|
special_tokens_map.json
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"additional_special_tokens": [
|
3 |
+
{
|
4 |
+
"content": "<|im_end|>",
|
5 |
+
"lstrip": false,
|
6 |
+
"normalized": false,
|
7 |
+
"rstrip": false,
|
8 |
+
"single_word": false
|
9 |
+
},
|
10 |
+
{
|
11 |
+
"content": "<|im_start|>",
|
12 |
+
"lstrip": false,
|
13 |
+
"normalized": false,
|
14 |
+
"rstrip": false,
|
15 |
+
"single_word": false
|
16 |
+
}
|
17 |
+
],
|
18 |
+
"bos_token": {
|
19 |
+
"content": "<s>",
|
20 |
+
"lstrip": false,
|
21 |
+
"normalized": false,
|
22 |
+
"rstrip": false,
|
23 |
+
"single_word": false
|
24 |
+
},
|
25 |
+
"eos_token": {
|
26 |
+
"content": "</s>",
|
27 |
+
"lstrip": false,
|
28 |
+
"normalized": false,
|
29 |
+
"rstrip": false,
|
30 |
+
"single_word": false
|
31 |
+
},
|
32 |
+
"pad_token": {
|
33 |
+
"content": "<pad>",
|
34 |
+
"lstrip": false,
|
35 |
+
"normalized": false,
|
36 |
+
"rstrip": false,
|
37 |
+
"single_word": false
|
38 |
+
},
|
39 |
+
"unk_token": {
|
40 |
+
"content": "<unk>",
|
41 |
+
"lstrip": false,
|
42 |
+
"normalized": false,
|
43 |
+
"rstrip": false,
|
44 |
+
"single_word": false
|
45 |
+
}
|
46 |
+
}
|
tokenization_inflm.py
ADDED
@@ -0,0 +1,292 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
|
3 |
+
#
|
4 |
+
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
|
5 |
+
# and OPT implementations in this library. It has been modified from its
|
6 |
+
# original forms to accommodate minor architectural differences compared
|
7 |
+
# to GPT-NeoX and OPT used by the Meta AI team that trained the model.
|
8 |
+
#
|
9 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
10 |
+
# you may not use this file except in compliance with the License.
|
11 |
+
# You may obtain a copy of the License at
|
12 |
+
#
|
13 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
14 |
+
#
|
15 |
+
# Unless required by applicable law or agreed to in writing, software
|
16 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
17 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18 |
+
# See the License for the specific language governing permissions and
|
19 |
+
# limitations under the License.
|
20 |
+
|
21 |
+
"""Tokenization classes for INFLMTokenizer."""
|
22 |
+
import os
|
23 |
+
from shutil import copyfile
|
24 |
+
from typing import Any, Dict, List, Optional, Tuple
|
25 |
+
|
26 |
+
import sentencepiece as spm
|
27 |
+
|
28 |
+
from transformers.tokenization_utils import PreTrainedTokenizer
|
29 |
+
from transformers.utils import logging
|
30 |
+
|
31 |
+
from tokenizers import pre_tokenizers,Regex,decoders
|
32 |
+
from tokenizers.pre_tokenizers import Digits, Split, ByteLevel
|
33 |
+
import os
|
34 |
+
|
35 |
+
# same as gpt4 cl-base-100k
|
36 |
+
PATTERN = Regex("(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+\s+(\S)+")
|
37 |
+
|
38 |
+
logger = logging.get_logger(__name__)
|
39 |
+
|
40 |
+
VOCAB_FILES_NAMES = {"vocab_file": "./tokenizer.model"}
|
41 |
+
|
42 |
+
PRETRAINED_VOCAB_FILES_MAP = {}
|
43 |
+
|
44 |
+
|
45 |
+
class INFLMTokenizer(PreTrainedTokenizer):
|
46 |
+
"""
|
47 |
+
Construct a INFLMTokenizer tokenizer based on sentence-piece
|
48 |
+
|
49 |
+
Args:
|
50 |
+
vocab_file (`str`):
|
51 |
+
Path to the vocabulary file.
|
52 |
+
"""
|
53 |
+
|
54 |
+
vocab_files_names = VOCAB_FILES_NAMES
|
55 |
+
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
56 |
+
model_input_names = ["input_ids", "attention_mask"]
|
57 |
+
_auto_class = "AutoTokenizer"
|
58 |
+
|
59 |
+
def __init__(
|
60 |
+
self,
|
61 |
+
vocab_file,
|
62 |
+
unk_token="<unk>",
|
63 |
+
bos_token="<s>",
|
64 |
+
eos_token="</s>",
|
65 |
+
pad_token="<pad>",
|
66 |
+
sp_model_kwargs: Optional[Dict[str, Any]] = None,
|
67 |
+
add_bos_token=False,
|
68 |
+
add_eos_token=False,
|
69 |
+
decode_with_prefix_space=False,
|
70 |
+
clean_up_tokenization_spaces=False,
|
71 |
+
spaces_between_special_tokens=False,
|
72 |
+
**kwargs,
|
73 |
+
):
|
74 |
+
self.sp_model_kwargs = {} if sp_model_kwargs is None else sp_model_kwargs
|
75 |
+
self.vocab_file = vocab_file
|
76 |
+
self.add_bos_token = add_bos_token
|
77 |
+
self.add_eos_token = add_eos_token
|
78 |
+
self.decode_with_prefix_space = decode_with_prefix_space
|
79 |
+
self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
|
80 |
+
self.sp_model.Load(vocab_file)
|
81 |
+
self._no_prefix_space_tokens = None
|
82 |
+
self.pre_tokenizer = pre_tokenizers.Sequence([Split(pattern =PATTERN,behavior = "isolated", invert = False)])
|
83 |
+
super().__init__(
|
84 |
+
bos_token=bos_token,
|
85 |
+
eos_token=eos_token,
|
86 |
+
unk_token=unk_token,
|
87 |
+
pad_token=pad_token,
|
88 |
+
clean_up_tokenization_spaces=clean_up_tokenization_spaces,
|
89 |
+
spaces_between_special_tokens=spaces_between_special_tokens,
|
90 |
+
**kwargs,
|
91 |
+
)
|
92 |
+
|
93 |
+
""" Initialisation"""
|
94 |
+
|
95 |
+
@property
|
96 |
+
def no_prefix_space_tokens(self):
|
97 |
+
if self._no_prefix_space_tokens is None:
|
98 |
+
vocab = self.convert_ids_to_tokens(list(range(self.vocab_size)))
|
99 |
+
self._no_prefix_space_tokens = {i for i, tok in enumerate(vocab) if not tok.startswith("▁")}
|
100 |
+
return self._no_prefix_space_tokens
|
101 |
+
|
102 |
+
@property
|
103 |
+
def vocab_size(self):
|
104 |
+
"""Returns vocab size"""
|
105 |
+
return self.sp_model.get_piece_size()
|
106 |
+
|
107 |
+
@property
|
108 |
+
def bos_token_id(self) -> Optional[int]:
|
109 |
+
return self.sp_model.bos_id()
|
110 |
+
|
111 |
+
@property
|
112 |
+
def eos_token_id(self) -> Optional[int]:
|
113 |
+
return self.sp_model.eos_id()
|
114 |
+
|
115 |
+
def get_vocab(self):
|
116 |
+
"""Returns vocab as a dict"""
|
117 |
+
vocab = {self.convert_ids_to_tokens(i): i for i in range(self.vocab_size)}
|
118 |
+
vocab.update(self.added_tokens_encoder)
|
119 |
+
return vocab
|
120 |
+
|
121 |
+
def _tokenize(self, text):
|
122 |
+
"""Returns a tokenized string."""
|
123 |
+
|
124 |
+
splits = self.pre_tokenizer.pre_tokenize_str(text)
|
125 |
+
texts=[]
|
126 |
+
|
127 |
+
for split in splits:
|
128 |
+
texts.extend(self.sp_model.encode(split[0], out_type=str))
|
129 |
+
return texts
|
130 |
+
|
131 |
+
def _convert_token_to_id(self, token):
|
132 |
+
"""Converts a token (str) in an id using the vocab."""
|
133 |
+
|
134 |
+
return self.sp_model.piece_to_id(token)
|
135 |
+
|
136 |
+
def _convert_id_to_token(self, index):
|
137 |
+
"""Converts an index (integer) in a token (str) using the vocab."""
|
138 |
+
token = self.sp_model.IdToPiece(index)
|
139 |
+
return token
|
140 |
+
|
141 |
+
def _maybe_add_prefix_space(self, tokens, decoded):
|
142 |
+
if tokens and tokens[0] not in self.no_prefix_space_tokens:
|
143 |
+
return " " + decoded
|
144 |
+
else:
|
145 |
+
return decoded
|
146 |
+
|
147 |
+
def convert_tokens_to_string(self, tokens):
|
148 |
+
"""Converts a sequence of tokens (string) in a single string."""
|
149 |
+
current_sub_tokens = []
|
150 |
+
out_string = ""
|
151 |
+
prev_is_special = False
|
152 |
+
for token in tokens:
|
153 |
+
# make sure that special tokens are not decoded using sentencepiece model
|
154 |
+
if token in self.all_special_tokens:
|
155 |
+
out_string += self.sp_model.decode(current_sub_tokens) + token
|
156 |
+
prev_is_special = True
|
157 |
+
current_sub_tokens = []
|
158 |
+
else:
|
159 |
+
current_sub_tokens.append(token)
|
160 |
+
prev_is_special = False
|
161 |
+
out_string += self.sp_model.decode(current_sub_tokens)
|
162 |
+
|
163 |
+
return out_string
|
164 |
+
|
165 |
+
def save_vocabulary(self, save_directory, filename_prefix: Optional[str] = None) -> Tuple[str]:
|
166 |
+
"""
|
167 |
+
Save the vocabulary and special tokens file to a directory.
|
168 |
+
|
169 |
+
Args:
|
170 |
+
save_directory (`str`):
|
171 |
+
The directory in which to save the vocabulary.
|
172 |
+
|
173 |
+
Returns:
|
174 |
+
`Tuple(str)`: Paths to the files saved.
|
175 |
+
"""
|
176 |
+
if not os.path.isdir(save_directory):
|
177 |
+
logger.error(f"Vocabulary path ({save_directory}) should be a directory")
|
178 |
+
return
|
179 |
+
out_vocab_file = os.path.join(
|
180 |
+
save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]
|
181 |
+
)
|
182 |
+
|
183 |
+
if os.path.abspath(self.vocab_file) != os.path.abspath(out_vocab_file) and os.path.isfile(self.vocab_file):
|
184 |
+
copyfile(self.vocab_file, out_vocab_file)
|
185 |
+
elif not os.path.isfile(self.vocab_file):
|
186 |
+
with open(out_vocab_file, "wb") as fi:
|
187 |
+
content_spiece_model = self.sp_model.serialized_model_proto()
|
188 |
+
fi.write(content_spiece_model)
|
189 |
+
|
190 |
+
return (out_vocab_file,)
|
191 |
+
|
192 |
+
def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
|
193 |
+
if self.add_bos_token:
|
194 |
+
bos_token_ids = [self.bos_token_id]
|
195 |
+
else:
|
196 |
+
bos_token_ids = []
|
197 |
+
|
198 |
+
output = bos_token_ids + token_ids_0
|
199 |
+
|
200 |
+
if token_ids_1 is not None:
|
201 |
+
output = output + token_ids_1
|
202 |
+
|
203 |
+
if self.add_eos_token:
|
204 |
+
output = output + [self.eos_token_id]
|
205 |
+
|
206 |
+
return output
|
207 |
+
|
208 |
+
def get_special_tokens_mask(
|
209 |
+
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False
|
210 |
+
) -> List[int]:
|
211 |
+
"""
|
212 |
+
Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
|
213 |
+
special tokens using the tokenizer `prepare_for_model` method.
|
214 |
+
|
215 |
+
Args:
|
216 |
+
token_ids_0 (`List[int]`):
|
217 |
+
List of IDs.
|
218 |
+
token_ids_1 (`List[int]`, *optional*):
|
219 |
+
Optional second list of IDs for sequence pairs.
|
220 |
+
already_has_special_tokens (`bool`, *optional*, defaults to `False`):
|
221 |
+
Whether or not the token list is already formatted with special tokens for the model.
|
222 |
+
|
223 |
+
Returns:
|
224 |
+
`List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
|
225 |
+
"""
|
226 |
+
if already_has_special_tokens:
|
227 |
+
return super().get_special_tokens_mask(
|
228 |
+
token_ids_0=token_ids_0, token_ids_1=token_ids_1, already_has_special_tokens=True
|
229 |
+
)
|
230 |
+
|
231 |
+
eos_token_id = [1] if self.add_eos_token else []
|
232 |
+
if token_ids_1 is None:
|
233 |
+
return ([0] * len(token_ids_0)) + eos_token_id
|
234 |
+
return ([0] * len(token_ids_0)) + eos_token_id + ([0] * len(token_ids_1)) + eos_token_id
|
235 |
+
|
236 |
+
|
237 |
+
def create_token_type_ids_from_sequences(
|
238 |
+
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
|
239 |
+
) -> List[int]:
|
240 |
+
"""
|
241 |
+
Creates a mask from the two sequences passed to be used in a sequence-pair classification task. An ALBERT
|
242 |
+
sequence pair mask has the following format:
|
243 |
+
|
244 |
+
```
|
245 |
+
0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
|
246 |
+
| first sequence | second sequence |
|
247 |
+
```
|
248 |
+
|
249 |
+
if token_ids_1 is None, only returns the first portion of the mask (0s).
|
250 |
+
|
251 |
+
Note this is only used for back compatiblity, thus list of zero is returned.
|
252 |
+
|
253 |
+
Args:
|
254 |
+
token_ids_0 (`List[int]`):
|
255 |
+
List of ids.
|
256 |
+
token_ids_1 (`List[int]`, *optional*):
|
257 |
+
Optional second list of IDs for sequence pairs.
|
258 |
+
|
259 |
+
Returns:
|
260 |
+
`List[int]`: List of zeros.
|
261 |
+
"""
|
262 |
+
eos = [self.eos_token_id]
|
263 |
+
|
264 |
+
if token_ids_1 is None:
|
265 |
+
return len(token_ids_0 + eos) * [0]
|
266 |
+
return len(token_ids_0 + eos + token_ids_1 + eos) * [0]
|
267 |
+
|
268 |
+
|
269 |
+
@property
|
270 |
+
def default_chat_template(self):
|
271 |
+
return None
|
272 |
+
|
273 |
+
|
274 |
+
def decode(
|
275 |
+
self,
|
276 |
+
token_ids,
|
277 |
+
skip_special_tokens: bool = False,
|
278 |
+
clean_up_tokenization_spaces: Optional[bool] = False,
|
279 |
+
spaces_between_special_tokens: bool = False,
|
280 |
+
**kwargs,
|
281 |
+
) -> str:
|
282 |
+
# default spaces_between_special_tokens should be false.
|
283 |
+
if spaces_between_special_tokens:
|
284 |
+
logger.warning_once('spaces_between_special_tokens is set. \
|
285 |
+
It has no effect for bos,eos,pad,unk when transformers<=4.38.')
|
286 |
+
return super().decode(
|
287 |
+
token_ids,
|
288 |
+
skip_special_tokens=skip_special_tokens,
|
289 |
+
clean_up_tokenization_spaces=clean_up_tokenization_spaces,
|
290 |
+
spaces_between_special_tokens=spaces_between_special_tokens,
|
291 |
+
**kwargs,
|
292 |
+
)
|
tokenizer.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:76d43d618fc0c5a7c79dc4e72579f9f29bb803b36e4a4d709d1233626fd8fe2a
|
3 |
+
size 1535725
|
tokenizer_config.json
ADDED
@@ -0,0 +1,393 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": false,
|
3 |
+
"added_tokens_decoder": {
|
4 |
+
"0": {
|
5 |
+
"content": "<unk>",
|
6 |
+
"lstrip": false,
|
7 |
+
"normalized": false,
|
8 |
+
"rstrip": false,
|
9 |
+
"single_word": false,
|
10 |
+
"special": true
|
11 |
+
},
|
12 |
+
"1": {
|
13 |
+
"content": "<s>",
|
14 |
+
"lstrip": false,
|
15 |
+
"normalized": false,
|
16 |
+
"rstrip": false,
|
17 |
+
"single_word": false,
|
18 |
+
"special": true
|
19 |
+
},
|
20 |
+
"2": {
|
21 |
+
"content": "</s>",
|
22 |
+
"lstrip": false,
|
23 |
+
"normalized": false,
|
24 |
+
"rstrip": false,
|
25 |
+
"single_word": false,
|
26 |
+
"special": true
|
27 |
+
},
|
28 |
+
"3": {
|
29 |
+
"content": "<pad>",
|
30 |
+
"lstrip": false,
|
31 |
+
"normalized": false,
|
32 |
+
"rstrip": false,
|
33 |
+
"single_word": false,
|
34 |
+
"special": true
|
35 |
+
},
|
36 |
+
"96499": {
|
37 |
+
"content": "<|start|>",
|
38 |
+
"lstrip": false,
|
39 |
+
"normalized": false,
|
40 |
+
"rstrip": false,
|
41 |
+
"single_word": false,
|
42 |
+
"special": true
|
43 |
+
},
|
44 |
+
"96500": {
|
45 |
+
"content": "<|end|>",
|
46 |
+
"lstrip": false,
|
47 |
+
"normalized": false,
|
48 |
+
"rstrip": false,
|
49 |
+
"single_word": false,
|
50 |
+
"special": true
|
51 |
+
},
|
52 |
+
"96501": {
|
53 |
+
"content": "<|message|>",
|
54 |
+
"lstrip": false,
|
55 |
+
"normalized": false,
|
56 |
+
"rstrip": false,
|
57 |
+
"single_word": false,
|
58 |
+
"special": true
|
59 |
+
},
|
60 |
+
"96502": {
|
61 |
+
"content": "<|tool_start|>",
|
62 |
+
"lstrip": false,
|
63 |
+
"normalized": false,
|
64 |
+
"rstrip": false,
|
65 |
+
"single_word": false,
|
66 |
+
"special": true
|
67 |
+
},
|
68 |
+
"96503": {
|
69 |
+
"content": "<|tool_excute|>",
|
70 |
+
"lstrip": false,
|
71 |
+
"normalized": false,
|
72 |
+
"rstrip": false,
|
73 |
+
"single_word": false,
|
74 |
+
"special": true
|
75 |
+
},
|
76 |
+
"96504": {
|
77 |
+
"content": "<|tool_end|>",
|
78 |
+
"lstrip": false,
|
79 |
+
"normalized": false,
|
80 |
+
"rstrip": false,
|
81 |
+
"single_word": false,
|
82 |
+
"special": true
|
83 |
+
},
|
84 |
+
"96505": {
|
85 |
+
"content": "<|pad|>",
|
86 |
+
"lstrip": false,
|
87 |
+
"normalized": false,
|
88 |
+
"rstrip": false,
|
89 |
+
"single_word": false,
|
90 |
+
"special": true
|
91 |
+
},
|
92 |
+
"96506": {
|
93 |
+
"content": "<|endoftext|>",
|
94 |
+
"lstrip": false,
|
95 |
+
"normalized": false,
|
96 |
+
"rstrip": false,
|
97 |
+
"single_word": false,
|
98 |
+
"special": true
|
99 |
+
},
|
100 |
+
"96507": {
|
101 |
+
"content": "<fim_prefix>",
|
102 |
+
"lstrip": false,
|
103 |
+
"normalized": false,
|
104 |
+
"rstrip": false,
|
105 |
+
"single_word": false,
|
106 |
+
"special": true
|
107 |
+
},
|
108 |
+
"96508": {
|
109 |
+
"content": "<fim_middle>",
|
110 |
+
"lstrip": false,
|
111 |
+
"normalized": false,
|
112 |
+
"rstrip": false,
|
113 |
+
"single_word": false,
|
114 |
+
"special": true
|
115 |
+
},
|
116 |
+
"96509": {
|
117 |
+
"content": "<fim_suffix>",
|
118 |
+
"lstrip": false,
|
119 |
+
"normalized": false,
|
120 |
+
"rstrip": false,
|
121 |
+
"single_word": false,
|
122 |
+
"special": true
|
123 |
+
},
|
124 |
+
"96510": {
|
125 |
+
"content": "<repo_name>",
|
126 |
+
"lstrip": false,
|
127 |
+
"normalized": false,
|
128 |
+
"rstrip": false,
|
129 |
+
"single_word": false,
|
130 |
+
"special": true
|
131 |
+
},
|
132 |
+
"96511": {
|
133 |
+
"content": "<file_sep>",
|
134 |
+
"lstrip": false,
|
135 |
+
"normalized": false,
|
136 |
+
"rstrip": false,
|
137 |
+
"single_word": false,
|
138 |
+
"special": true
|
139 |
+
},
|
140 |
+
"96512": {
|
141 |
+
"content": "<issue_start>",
|
142 |
+
"lstrip": false,
|
143 |
+
"normalized": false,
|
144 |
+
"rstrip": false,
|
145 |
+
"single_word": false,
|
146 |
+
"special": true
|
147 |
+
},
|
148 |
+
"96513": {
|
149 |
+
"content": "<issue_comment>",
|
150 |
+
"lstrip": false,
|
151 |
+
"normalized": false,
|
152 |
+
"rstrip": false,
|
153 |
+
"single_word": false,
|
154 |
+
"special": true
|
155 |
+
},
|
156 |
+
"96514": {
|
157 |
+
"content": "<issue_closed>",
|
158 |
+
"lstrip": false,
|
159 |
+
"normalized": false,
|
160 |
+
"rstrip": false,
|
161 |
+
"single_word": false,
|
162 |
+
"special": true
|
163 |
+
},
|
164 |
+
"96515": {
|
165 |
+
"content": "<jupyter_start>",
|
166 |
+
"lstrip": false,
|
167 |
+
"normalized": false,
|
168 |
+
"rstrip": false,
|
169 |
+
"single_word": false,
|
170 |
+
"special": true
|
171 |
+
},
|
172 |
+
"96516": {
|
173 |
+
"content": "<jupyter_text>",
|
174 |
+
"lstrip": false,
|
175 |
+
"normalized": false,
|
176 |
+
"rstrip": false,
|
177 |
+
"single_word": false,
|
178 |
+
"special": true
|
179 |
+
},
|
180 |
+
"96517": {
|
181 |
+
"content": "<jupyter_code>",
|
182 |
+
"lstrip": false,
|
183 |
+
"normalized": false,
|
184 |
+
"rstrip": false,
|
185 |
+
"single_word": false,
|
186 |
+
"special": true
|
187 |
+
},
|
188 |
+
"96518": {
|
189 |
+
"content": "<jupyter_output>",
|
190 |
+
"lstrip": false,
|
191 |
+
"normalized": false,
|
192 |
+
"rstrip": false,
|
193 |
+
"single_word": false,
|
194 |
+
"special": true
|
195 |
+
},
|
196 |
+
"96519": {
|
197 |
+
"content": "<jupyter_script>",
|
198 |
+
"lstrip": false,
|
199 |
+
"normalized": false,
|
200 |
+
"rstrip": false,
|
201 |
+
"single_word": false,
|
202 |
+
"special": true
|
203 |
+
},
|
204 |
+
"96520": {
|
205 |
+
"content": "<empty_output>",
|
206 |
+
"lstrip": false,
|
207 |
+
"normalized": false,
|
208 |
+
"rstrip": false,
|
209 |
+
"single_word": false,
|
210 |
+
"special": true
|
211 |
+
},
|
212 |
+
"96521": {
|
213 |
+
"content": "<code_to_intermediate>",
|
214 |
+
"lstrip": false,
|
215 |
+
"normalized": false,
|
216 |
+
"rstrip": false,
|
217 |
+
"single_word": false,
|
218 |
+
"special": true
|
219 |
+
},
|
220 |
+
"96522": {
|
221 |
+
"content": "<intermediate_to_code>",
|
222 |
+
"lstrip": false,
|
223 |
+
"normalized": false,
|
224 |
+
"rstrip": false,
|
225 |
+
"single_word": false,
|
226 |
+
"special": true
|
227 |
+
},
|
228 |
+
"96523": {
|
229 |
+
"content": "<pr>",
|
230 |
+
"lstrip": false,
|
231 |
+
"normalized": false,
|
232 |
+
"rstrip": false,
|
233 |
+
"single_word": false,
|
234 |
+
"special": true
|
235 |
+
},
|
236 |
+
"96524": {
|
237 |
+
"content": "<pr_status>",
|
238 |
+
"lstrip": false,
|
239 |
+
"normalized": false,
|
240 |
+
"rstrip": false,
|
241 |
+
"single_word": false,
|
242 |
+
"special": true
|
243 |
+
},
|
244 |
+
"96525": {
|
245 |
+
"content": "<pr_is_merged>",
|
246 |
+
"lstrip": false,
|
247 |
+
"normalized": false,
|
248 |
+
"rstrip": false,
|
249 |
+
"single_word": false,
|
250 |
+
"special": true
|
251 |
+
},
|
252 |
+
"96526": {
|
253 |
+
"content": "<pr_base>",
|
254 |
+
"lstrip": false,
|
255 |
+
"normalized": false,
|
256 |
+
"rstrip": false,
|
257 |
+
"single_word": false,
|
258 |
+
"special": true
|
259 |
+
},
|
260 |
+
"96527": {
|
261 |
+
"content": "<pr_file>",
|
262 |
+
"lstrip": false,
|
263 |
+
"normalized": false,
|
264 |
+
"rstrip": false,
|
265 |
+
"single_word": false,
|
266 |
+
"special": true
|
267 |
+
},
|
268 |
+
"96528": {
|
269 |
+
"content": "<pr_base_code>",
|
270 |
+
"lstrip": false,
|
271 |
+
"normalized": false,
|
272 |
+
"rstrip": false,
|
273 |
+
"single_word": false,
|
274 |
+
"special": true
|
275 |
+
},
|
276 |
+
"96529": {
|
277 |
+
"content": "<pr_diff>",
|
278 |
+
"lstrip": false,
|
279 |
+
"normalized": false,
|
280 |
+
"rstrip": false,
|
281 |
+
"single_word": false,
|
282 |
+
"special": true
|
283 |
+
},
|
284 |
+
"96530": {
|
285 |
+
"content": "<pr_diff_hunk>",
|
286 |
+
"lstrip": false,
|
287 |
+
"normalized": false,
|
288 |
+
"rstrip": false,
|
289 |
+
"single_word": false,
|
290 |
+
"special": true
|
291 |
+
},
|
292 |
+
"96531": {
|
293 |
+
"content": "<pr_comment>",
|
294 |
+
"lstrip": false,
|
295 |
+
"normalized": false,
|
296 |
+
"rstrip": false,
|
297 |
+
"single_word": false,
|
298 |
+
"special": true
|
299 |
+
},
|
300 |
+
"96532": {
|
301 |
+
"content": "<pr_event_id>",
|
302 |
+
"lstrip": false,
|
303 |
+
"normalized": false,
|
304 |
+
"rstrip": false,
|
305 |
+
"single_word": false,
|
306 |
+
"special": true
|
307 |
+
},
|
308 |
+
"96533": {
|
309 |
+
"content": "<pr_review>",
|
310 |
+
"lstrip": false,
|
311 |
+
"normalized": false,
|
312 |
+
"rstrip": false,
|
313 |
+
"single_word": false,
|
314 |
+
"special": true
|
315 |
+
},
|
316 |
+
"96534": {
|
317 |
+
"content": "<pr_review_state>",
|
318 |
+
"lstrip": false,
|
319 |
+
"normalized": false,
|
320 |
+
"rstrip": false,
|
321 |
+
"single_word": false,
|
322 |
+
"special": true
|
323 |
+
},
|
324 |
+
"96535": {
|
325 |
+
"content": "<pr_review_comment>",
|
326 |
+
"lstrip": false,
|
327 |
+
"normalized": false,
|
328 |
+
"rstrip": false,
|
329 |
+
"single_word": false,
|
330 |
+
"special": true
|
331 |
+
},
|
332 |
+
"96536": {
|
333 |
+
"content": "<pr_in_reply_to_review_id>",
|
334 |
+
"lstrip": false,
|
335 |
+
"normalized": false,
|
336 |
+
"rstrip": false,
|
337 |
+
"single_word": false,
|
338 |
+
"special": true
|
339 |
+
},
|
340 |
+
"96537": {
|
341 |
+
"content": "<pr_in_reply_to_comment_id>",
|
342 |
+
"lstrip": false,
|
343 |
+
"normalized": false,
|
344 |
+
"rstrip": false,
|
345 |
+
"single_word": false,
|
346 |
+
"special": true
|
347 |
+
},
|
348 |
+
"96538": {
|
349 |
+
"content": "<pr_diff_hunk_comment_line>",
|
350 |
+
"lstrip": false,
|
351 |
+
"normalized": false,
|
352 |
+
"rstrip": false,
|
353 |
+
"single_word": false,
|
354 |
+
"special": true
|
355 |
+
},
|
356 |
+
"96539": {
|
357 |
+
"content": "<|im_end|>",
|
358 |
+
"lstrip": false,
|
359 |
+
"normalized": false,
|
360 |
+
"rstrip": false,
|
361 |
+
"single_word": false,
|
362 |
+
"special": true
|
363 |
+
},
|
364 |
+
"96540": {
|
365 |
+
"content": "<|im_start|>",
|
366 |
+
"lstrip": false,
|
367 |
+
"normalized": false,
|
368 |
+
"rstrip": false,
|
369 |
+
"single_word": false,
|
370 |
+
"special": true
|
371 |
+
}
|
372 |
+
},
|
373 |
+
"additional_special_tokens": [
|
374 |
+
"<|im_end|>",
|
375 |
+
"<|im_start|>"
|
376 |
+
],
|
377 |
+
"auto_map": {
|
378 |
+
"AutoTokenizer": [
|
379 |
+
"tokenization_inflm.INFLMTokenizer",
|
380 |
+
null
|
381 |
+
]
|
382 |
+
},
|
383 |
+
"bos_token": "<s>",
|
384 |
+
"chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are OpenCoder, created by OpenCoder Team.<|im_end|>\n' }}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
|
385 |
+
"clean_up_tokenization_spaces": false,
|
386 |
+
"eos_token": "<|im_end|>",
|
387 |
+
"model_max_length": 1000000000000000019884624838656,
|
388 |
+
"pad_token": "<pad>",
|
389 |
+
"return_tensors": true,
|
390 |
+
"spaces_between_special_tokens": false,
|
391 |
+
"tokenizer_class": "INFLMTokenizer",
|
392 |
+
"unk_token": "<unk>"
|
393 |
+
}
|