Commit
·
ca67c09
0
Parent(s):
initial commit
Browse files- config.json +52 -0
- conversion.py +89 -0
- generation_config.json +6 -0
- modeling_llama_butler.py +1434 -0
- pytorch_model.bin.index.json +0 -0
- special_tokens_map.json +4 -0
- tokenizer.json +0 -0
- tokenizer_config.json +2061 -0
config.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"modeling_llama_butler.LlamaButlerForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"attn_reduce_factor": 8,
|
| 8 |
+
"auto_map": {
|
| 9 |
+
"AutoConfig": "modeling_llama_butler.LlamaButlerConfig",
|
| 10 |
+
"AutoModel": "modeling_llama_butler.LlamaButlerForCausalLM",
|
| 11 |
+
"AutoModelForCausalLM": "modeling_llama_butler.LlamaButlerForCausalLM"
|
| 12 |
+
},
|
| 13 |
+
"bos_token_id": 128000,
|
| 14 |
+
"dDash": 32,
|
| 15 |
+
"eos_token_id": 128001,
|
| 16 |
+
"eval_llm_mode": "ExpPred",
|
| 17 |
+
"flash_attn": false,
|
| 18 |
+
"head_attn_reduce_factor": 2,
|
| 19 |
+
"head_dim": 128,
|
| 20 |
+
"hidden_act": "silu",
|
| 21 |
+
"hidden_size": 4096,
|
| 22 |
+
"initializer_range": 0.02,
|
| 23 |
+
"intdim": 1024,
|
| 24 |
+
"intermediate_size": 14336,
|
| 25 |
+
"lookahead": 0,
|
| 26 |
+
"max_position_embeddings": 131072,
|
| 27 |
+
"min_sparse_index": 8,
|
| 28 |
+
"mlp_bias": false,
|
| 29 |
+
"model_type": "llama_butler",
|
| 30 |
+
"num_attention_heads": 32,
|
| 31 |
+
"num_hidden_layers": 32,
|
| 32 |
+
"num_key_value_heads": 8,
|
| 33 |
+
"pretraining_tp": 1,
|
| 34 |
+
"producer_frequency": 32,
|
| 35 |
+
"rms_norm_eps": 1e-05,
|
| 36 |
+
"rope_scaling": {
|
| 37 |
+
"factor": 8.0,
|
| 38 |
+
"high_freq_factor": 4.0,
|
| 39 |
+
"low_freq_factor": 1.0,
|
| 40 |
+
"original_max_position_embeddings": 8192,
|
| 41 |
+
"rope_type": "llama3"
|
| 42 |
+
},
|
| 43 |
+
"rope_theta": 500000.0,
|
| 44 |
+
"sliding_window": 128,
|
| 45 |
+
"tie_word_embeddings": false,
|
| 46 |
+
"token_sparse_method": "fixed_50pc",
|
| 47 |
+
"torch_dtype": "float32",
|
| 48 |
+
"train_headpredictor": false,
|
| 49 |
+
"transformers_version": "4.48.3",
|
| 50 |
+
"use_cache": true,
|
| 51 |
+
"vocab_size": 128256
|
| 52 |
+
}
|
conversion.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import LlamaForCausalLM, LlamaConfig, AutoTokenizer
|
| 2 |
+
import torch
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
# huggingface-cli download meta-llama/Llama-3.1-8B tokenizer_config.json --local-dir ./
|
| 6 |
+
# huggingface-cli download meta-llama/Llama-3.1-8B tokenizer.json --local-dir ./
|
| 7 |
+
# huggingface-cli download meta-llama/Llama-3.1-8B special_tokens_map.json --local-dir ./
|
| 8 |
+
|
| 9 |
+
question = "A $y$-intercept is a point on the graph that lies on the $y$-axis, so $x = 0$. Hence, the number $y$-intercepts corresponds to the number of real solutions of the quadratic equation $y^2 - 4y - 1 = 0$. The discriminant of this quadratic equation is $(-4)^2 + 4 \cdot 1 \cdot (-1) = 20$, which is positive, so the quadratic has two distinct real roots. Therefore, the number of $y$-intercepts is $\boxed{2}$. \n \n [asy] \n size(150); \n real ticklen=3; \n real tickspace=2; \n \n real ticklength=0.1cm; \n real axisarrowsize=0.14cm; \n pen axispen=black+1.3bp; \n real vectorarrowsize=0.2cm; \n real tickdown=-0.5; \n real tickdownlength=-0.15inch; \n real tickdownbase=0.3; \n real wholetickdown=tickdown; \n void rr_cartesian_axes(real xleft, real xright, real ybottom, real ytop, real xstep=1, real ystep=1, bool \n \n useticks=false, bool complexplane=false, bool usegrid=true) { \n \n import graph; \n \n real i; \n \n if(complexplane) { \n \n label('$\textnormal{Re}$',(xright,0),SE); \n \n label('$\textnormal{Im}$',(0,ytop),NW); \n \n } else { \n \n label('$x$',(xright+0.4,-0.5)); \n \n label('$y$',(-0.5,ytop+0.2)); \n \n } \n \n ylimits(ybottom,ytop); \n \n xlimits( xleft, xright); \n \n real[] TicksArrx,TicksArry; \n \n for(i=xleft+xstep; i<xright; i+=xstep) { \n \n if(abs(i) >0.1) { \n \n TicksArrx.push(i); \n \n } \n \n } \n \n for(i=ybottom+ystep; i<ytop; i+=ystep) { \n \n if(abs(i) >0.1) { \n \n TicksArry.push(i); \n \n } \n \n } \n \n if(usegrid) {"
|
| 10 |
+
predictor_load_path = "/home/ya255/projects/TokenButler/expt_model/TrainTokenButler_42_finetune_None_None_500_llama_meta-llama_Llama-3.1-8B_L3_8B_1k.csv_L3_8B_1k_Cont_False_False_2000_False_redpajama_1024_1_1_20_0.001_1024/16_False_4_1000_ExpPred_fixed_40pc_True_False_0_None_False_False_4_8_2_32_1024_False_False_True_32_0.3875000000000002__best.pt"
|
| 11 |
+
base_model_name = "meta-llama/Llama-3.1-8B"
|
| 12 |
+
|
| 13 |
+
def get_producer_layers(model):
|
| 14 |
+
"""
|
| 15 |
+
Traverses the model to find the producer layer (layer_idx=0).cc
|
| 16 |
+
"""
|
| 17 |
+
producer_modules = []
|
| 18 |
+
for module in model.modules():
|
| 19 |
+
if module.__class__.__name__.endswith("AttentionExperimental") and module.layer_idx == 0:
|
| 20 |
+
producer_modules.append(module)
|
| 21 |
+
return producer_modules
|
| 22 |
+
|
| 23 |
+
# 1) Load the base model from HF
|
| 24 |
+
base_model = LlamaForCausalLM.from_pretrained(base_model_name, device_map="auto")
|
| 25 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
|
| 26 |
+
inputs = tokenizer(question, return_tensors="pt")
|
| 27 |
+
inputs = {k: v.to(base_model.device) for k, v in inputs.items()}
|
| 28 |
+
question_length = inputs['attention_mask'].shape[1]
|
| 29 |
+
|
| 30 |
+
with torch.no_grad():
|
| 31 |
+
base_output_ids = base_model.generate(
|
| 32 |
+
**inputs,
|
| 33 |
+
max_new_tokens=200,
|
| 34 |
+
do_sample=True,
|
| 35 |
+
top_p=0.95,
|
| 36 |
+
temperature=0.7,
|
| 37 |
+
)
|
| 38 |
+
base_output_text = tokenizer.decode(base_output_ids[0][question_length:], skip_special_tokens=True)
|
| 39 |
+
|
| 40 |
+
# Remove base model from GPU
|
| 41 |
+
base_model_device = base_model.device
|
| 42 |
+
base_model.to("cpu")
|
| 43 |
+
base_state_dict = base_model.state_dict()
|
| 44 |
+
del base_model
|
| 45 |
+
torch.cuda.empty_cache()
|
| 46 |
+
|
| 47 |
+
from modeling_llama_butler import LlamaButlerConfig, LlamaButlerForCausalLM
|
| 48 |
+
butler_config = LlamaButlerConfig.from_pretrained('config.json')
|
| 49 |
+
|
| 50 |
+
butler_model = LlamaButlerForCausalLM(butler_config)
|
| 51 |
+
butler_model.load_state_dict(base_state_dict, strict=False)
|
| 52 |
+
|
| 53 |
+
model_producer_layers = get_producer_layers(butler_model)
|
| 54 |
+
producer_layer_weights = torch.load(predictor_load_path)
|
| 55 |
+
for idx, producer_layer_weight in enumerate(producer_layer_weights):
|
| 56 |
+
try:
|
| 57 |
+
model_producer_layers[idx].load_state_dict(producer_layer_weight, strict=False)
|
| 58 |
+
except Exception as e:
|
| 59 |
+
print(f"Error loading producer layer {idx}: {e}")
|
| 60 |
+
print("\n\nContinuing... !! Bad Perf If Unintentional !!\n\n")
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
butler_model.to(base_model_device)
|
| 64 |
+
butler_model.eval()
|
| 65 |
+
|
| 66 |
+
with torch.no_grad():
|
| 67 |
+
butler_output_ids = butler_model.generate(
|
| 68 |
+
**inputs,
|
| 69 |
+
max_new_tokens=200,
|
| 70 |
+
do_sample=True,
|
| 71 |
+
top_p=0.95,
|
| 72 |
+
temperature=0.7,
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
butler_output_text = tokenizer.decode(butler_output_ids[0][question_length:], skip_special_tokens=True)
|
| 76 |
+
|
| 77 |
+
print("\n=== Base Model Output (Newlines Removed For Brevity) ===\n")
|
| 78 |
+
print(base_output_text.replace("\n", ""))
|
| 79 |
+
print("\n")
|
| 80 |
+
print("=== Butler Model Output (Newlines Removed For Brevity) ===\n")
|
| 81 |
+
print(butler_output_text.replace("\n", ""))
|
| 82 |
+
print("\n")
|
| 83 |
+
|
| 84 |
+
OUTPUT_DIR = "."
|
| 85 |
+
print(f"\nSaving final merged model to: {OUTPUT_DIR}")
|
| 86 |
+
butler_model.save_pretrained(OUTPUT_DIR, safe_serialization=False)
|
| 87 |
+
|
| 88 |
+
# tokenizer.save_pretrained(OUTPUT_DIR)
|
| 89 |
+
print("\nAll done! The folder should now have `pytorch_model.bin` and the updated `config.json`.\n")
|
generation_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 128000,
|
| 4 |
+
"eos_token_id": 128001,
|
| 5 |
+
"transformers_version": "4.48.3"
|
| 6 |
+
}
|
modeling_llama_butler.py
ADDED
|
@@ -0,0 +1,1434 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
| 4 |
+
from transformers import LlamaForCausalLM, LlamaConfig
|
| 5 |
+
from transformers.generation.utils import GenerationConfig
|
| 6 |
+
import os
|
| 7 |
+
import pdb
|
| 8 |
+
import copy
|
| 9 |
+
import math
|
| 10 |
+
import numpy as np
|
| 11 |
+
from dataclasses import dataclass
|
| 12 |
+
from typing import Any, Dict, List, Optional, Tuple, Union
|
| 13 |
+
import gc
|
| 14 |
+
|
| 15 |
+
import traceback
|
| 16 |
+
import torch
|
| 17 |
+
from torch import nn
|
| 18 |
+
import torch.utils.checkpoint
|
| 19 |
+
import torch.nn.functional as F
|
| 20 |
+
from torch.cuda.amp import autocast
|
| 21 |
+
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
|
| 22 |
+
|
| 23 |
+
from transformers.models.llama.configuration_llama import LlamaConfig
|
| 24 |
+
from transformers.models.llama.modeling_llama import LlamaRotaryEmbedding, LlamaAttention, apply_rotary_pos_emb
|
| 25 |
+
|
| 26 |
+
from transformers.cache_utils import DynamicCache
|
| 27 |
+
|
| 28 |
+
class PredictorDynamicCache(DynamicCache):
|
| 29 |
+
def __init__(self):
|
| 30 |
+
super().__init__()
|
| 31 |
+
self.predictor_primary_key: List[Optional[torch.Tensor]] = []
|
| 32 |
+
self.predictor_primary_value: List[Optional[torch.Tensor]] = []
|
| 33 |
+
self.predictor_importance_key: List[Optional[torch.Tensor]] = []
|
| 34 |
+
|
| 35 |
+
def update_predictor_primary(
|
| 36 |
+
self,
|
| 37 |
+
key_states: torch.Tensor,
|
| 38 |
+
value_states: torch.Tensor,
|
| 39 |
+
layer_idx: int,
|
| 40 |
+
) -> Tuple[torch.Tensor, torch.Tensor]:
|
| 41 |
+
"""
|
| 42 |
+
Append or create the predictor's "primary" K/V states for `layer_idx`.
|
| 43 |
+
|
| 44 |
+
shape for key_states, value_states is typically [batch_size, num_heads, seq_len, head_dim].
|
| 45 |
+
"""
|
| 46 |
+
# Extend the lists so that `predictor_primary_key[layer_idx]` and
|
| 47 |
+
# `predictor_primary_value[layer_idx]` exist.
|
| 48 |
+
self._ensure_list_capacity(
|
| 49 |
+
self.predictor_primary_key, layer_idx, fill=None
|
| 50 |
+
)
|
| 51 |
+
self._ensure_list_capacity(
|
| 52 |
+
self.predictor_primary_value, layer_idx, fill=None
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
# If this is the very first time we are updating that layer's predictor cache, just assign
|
| 56 |
+
if self.predictor_primary_key[layer_idx] is None:
|
| 57 |
+
self.predictor_primary_key[layer_idx] = key_states
|
| 58 |
+
self.predictor_primary_value[layer_idx] = value_states
|
| 59 |
+
else:
|
| 60 |
+
# Otherwise, concatenate along the seq_len dimension (=-2 or =2 depending on your shape).
|
| 61 |
+
self.predictor_primary_key[layer_idx] = torch.cat(
|
| 62 |
+
[self.predictor_primary_key[layer_idx], key_states], dim=2
|
| 63 |
+
)
|
| 64 |
+
self.predictor_primary_value[layer_idx] = torch.cat(
|
| 65 |
+
[self.predictor_primary_value[layer_idx], value_states], dim=2
|
| 66 |
+
)
|
| 67 |
+
|
| 68 |
+
return (
|
| 69 |
+
self.predictor_primary_key[layer_idx],
|
| 70 |
+
self.predictor_primary_value[layer_idx],
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
def update_predictor_importance(
|
| 74 |
+
self,
|
| 75 |
+
key_states: torch.Tensor,
|
| 76 |
+
layer_idx: int,
|
| 77 |
+
) -> torch.Tensor:
|
| 78 |
+
"""
|
| 79 |
+
Append or create the predictor's "importance" key for `layer_idx`.
|
| 80 |
+
"""
|
| 81 |
+
self._ensure_list_capacity(
|
| 82 |
+
self.predictor_importance_key, layer_idx, fill=None
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
+
if self.predictor_importance_key[layer_idx] is None:
|
| 86 |
+
self.predictor_importance_key[layer_idx] = key_states
|
| 87 |
+
else:
|
| 88 |
+
self.predictor_importance_key[layer_idx] = torch.cat(
|
| 89 |
+
[self.predictor_importance_key[layer_idx], key_states], dim=2
|
| 90 |
+
)
|
| 91 |
+
return self.predictor_importance_key[layer_idx]
|
| 92 |
+
|
| 93 |
+
def crop(self, max_length: int):
|
| 94 |
+
super().crop(max_length)
|
| 95 |
+
# Now also crop predictor caches
|
| 96 |
+
for idx in range(len(self.predictor_primary_key)):
|
| 97 |
+
if self.predictor_primary_key[idx] is not None:
|
| 98 |
+
self.predictor_primary_key[idx] = self.predictor_primary_key[idx][..., :max_length, :]
|
| 99 |
+
self.predictor_primary_value[idx] = self.predictor_primary_value[idx][..., :max_length, :]
|
| 100 |
+
|
| 101 |
+
for idx in range(len(self.predictor_importance_key)):
|
| 102 |
+
if self.predictor_importance_key[idx] is not None:
|
| 103 |
+
self.predictor_importance_key[idx] = self.predictor_importance_key[idx][..., :max_length, :]
|
| 104 |
+
|
| 105 |
+
# Remember to adjust self._seen_tokens accordingly
|
| 106 |
+
self._seen_tokens = min(self._seen_tokens, max_length)
|
| 107 |
+
|
| 108 |
+
def batch_split(
|
| 109 |
+
self, full_batch_size: int, split_size: int, num_hidden_layers: int = None
|
| 110 |
+
) -> List["PredictorDynamicCache"]:
|
| 111 |
+
# Use the base split logic for the standard K/V
|
| 112 |
+
base_splits = super().batch_split(full_batch_size, split_size, num_hidden_layers)
|
| 113 |
+
# `base_splits` is now a list of new DynamicCache objects. But we *actually*
|
| 114 |
+
# want them to be PredictorDynamicCache so we can store the predictor states.
|
| 115 |
+
# Easiest: we can cast and fill them.
|
| 116 |
+
out: List[PredictorDynamicCache] = []
|
| 117 |
+
|
| 118 |
+
for split_i, base_split in enumerate(base_splits):
|
| 119 |
+
# Construct an empty PredictorDynamicCache
|
| 120 |
+
new_cache = PredictorDynamicCache()
|
| 121 |
+
# Copy over the underlying fields from base_split
|
| 122 |
+
new_cache.key_cache = base_split.key_cache
|
| 123 |
+
new_cache.value_cache = base_split.value_cache
|
| 124 |
+
new_cache._seen_tokens = base_split._seen_tokens
|
| 125 |
+
|
| 126 |
+
# Now also slice our predictor fields
|
| 127 |
+
# The slice in batch dim is [i:i+split_size].
|
| 128 |
+
b_start = split_i * split_size
|
| 129 |
+
b_end = min(full_batch_size, b_start + split_size)
|
| 130 |
+
|
| 131 |
+
new_cache.predictor_primary_key = self._slice_list_tensors(
|
| 132 |
+
self.predictor_primary_key, b_start, b_end
|
| 133 |
+
)
|
| 134 |
+
new_cache.predictor_primary_value = self._slice_list_tensors(
|
| 135 |
+
self.predictor_primary_value, b_start, b_end
|
| 136 |
+
)
|
| 137 |
+
new_cache.predictor_importance_key = self._slice_list_tensors(
|
| 138 |
+
self.predictor_importance_key, b_start, b_end
|
| 139 |
+
)
|
| 140 |
+
|
| 141 |
+
out.append(new_cache)
|
| 142 |
+
|
| 143 |
+
return out
|
| 144 |
+
|
| 145 |
+
@classmethod
|
| 146 |
+
def from_batch_splits(cls, splits: List["PredictorDynamicCache"], num_hidden_layers: int = None) -> "PredictorDynamicCache":
|
| 147 |
+
# Let the base class handle the normal K/V merges
|
| 148 |
+
base_merged = DynamicCache.from_batch_splits(splits, num_hidden_layers=num_hidden_layers)
|
| 149 |
+
merged = cls()
|
| 150 |
+
merged.key_cache = base_merged.key_cache
|
| 151 |
+
merged.value_cache = base_merged.value_cache
|
| 152 |
+
merged._seen_tokens = base_merged._seen_tokens
|
| 153 |
+
|
| 154 |
+
# Now unify predictor states by concatenating along batch dim=0
|
| 155 |
+
merged.predictor_primary_key = cls._merge_list_tensors(
|
| 156 |
+
[split.predictor_primary_key for split in splits]
|
| 157 |
+
)
|
| 158 |
+
merged.predictor_primary_value = cls._merge_list_tensors(
|
| 159 |
+
[split.predictor_primary_value for split in splits]
|
| 160 |
+
)
|
| 161 |
+
merged.predictor_importance_key = cls._merge_list_tensors(
|
| 162 |
+
[split.predictor_importance_key for split in splits]
|
| 163 |
+
)
|
| 164 |
+
|
| 165 |
+
return merged
|
| 166 |
+
|
| 167 |
+
def batch_repeat_interleave(self, repeats: int):
|
| 168 |
+
super().batch_repeat_interleave(repeats)
|
| 169 |
+
self.predictor_primary_key = self._repeat_list_tensors(
|
| 170 |
+
self.predictor_primary_key, repeats
|
| 171 |
+
)
|
| 172 |
+
self.predictor_primary_value = self._repeat_list_tensors(
|
| 173 |
+
self.predictor_primary_value, repeats
|
| 174 |
+
)
|
| 175 |
+
self.predictor_importance_key = self._repeat_list_tensors(
|
| 176 |
+
self.predictor_importance_key, repeats
|
| 177 |
+
)
|
| 178 |
+
|
| 179 |
+
def batch_select_indices(self, indices: torch.Tensor):
|
| 180 |
+
super().batch_select_indices(indices)
|
| 181 |
+
self.predictor_primary_key = self._select_list_tensors(
|
| 182 |
+
self.predictor_primary_key, indices
|
| 183 |
+
)
|
| 184 |
+
self.predictor_primary_value = self._select_list_tensors(
|
| 185 |
+
self.predictor_primary_value, indices
|
| 186 |
+
)
|
| 187 |
+
self.predictor_importance_key = self._select_list_tensors(
|
| 188 |
+
self.predictor_importance_key, indices
|
| 189 |
+
)
|
| 190 |
+
|
| 191 |
+
@staticmethod
|
| 192 |
+
def _ensure_list_capacity(lst: list, idx: int, fill=None):
|
| 193 |
+
if len(lst) <= idx:
|
| 194 |
+
lst.extend([fill] * (idx + 1 - len(lst)))
|
| 195 |
+
|
| 196 |
+
@staticmethod
|
| 197 |
+
def _slice_list_tensors(
|
| 198 |
+
tensor_list: List[Optional[torch.Tensor]], start: int, end: int
|
| 199 |
+
) -> List[Optional[torch.Tensor]]:
|
| 200 |
+
out = []
|
| 201 |
+
for t in tensor_list:
|
| 202 |
+
if t is None:
|
| 203 |
+
out.append(None)
|
| 204 |
+
else:
|
| 205 |
+
out.append(t[start:end, ...])
|
| 206 |
+
return out
|
| 207 |
+
|
| 208 |
+
@classmethod
|
| 209 |
+
def _merge_list_tensors(
|
| 210 |
+
cls, list_of_lists: List[List[Optional[torch.Tensor]]]
|
| 211 |
+
) -> List[Optional[torch.Tensor]]:
|
| 212 |
+
# If no splits, return empty
|
| 213 |
+
if not list_of_lists:
|
| 214 |
+
return []
|
| 215 |
+
|
| 216 |
+
# Number of layers is length of the sub-list from the first split
|
| 217 |
+
max_len = len(list_of_lists[0])
|
| 218 |
+
merged = [None] * max_len
|
| 219 |
+
|
| 220 |
+
for layer_idx in range(max_len):
|
| 221 |
+
# collect that layer_idx from each split
|
| 222 |
+
chunk_tensors = []
|
| 223 |
+
for split in list_of_lists:
|
| 224 |
+
t = split[layer_idx] if layer_idx < len(split) else None
|
| 225 |
+
if t is not None:
|
| 226 |
+
chunk_tensors.append(t)
|
| 227 |
+
if len(chunk_tensors) == 0:
|
| 228 |
+
merged[layer_idx] = None
|
| 229 |
+
else:
|
| 230 |
+
merged[layer_idx] = torch.cat(chunk_tensors, dim=0)
|
| 231 |
+
return merged
|
| 232 |
+
|
| 233 |
+
@staticmethod
|
| 234 |
+
def _repeat_list_tensors(
|
| 235 |
+
tensor_list: List[Optional[torch.Tensor]], repeats: int
|
| 236 |
+
) -> List[Optional[torch.Tensor]]:
|
| 237 |
+
out = []
|
| 238 |
+
for t in tensor_list:
|
| 239 |
+
if t is None:
|
| 240 |
+
out.append(None)
|
| 241 |
+
else:
|
| 242 |
+
out.append(t.repeat_interleave(repeats, dim=0))
|
| 243 |
+
return out
|
| 244 |
+
|
| 245 |
+
@staticmethod
|
| 246 |
+
def _select_list_tensors(
|
| 247 |
+
tensor_list: List[Optional[torch.Tensor]], indices: torch.Tensor
|
| 248 |
+
) -> List[Optional[torch.Tensor]]:
|
| 249 |
+
out = []
|
| 250 |
+
for t in tensor_list:
|
| 251 |
+
if t is None:
|
| 252 |
+
out.append(None)
|
| 253 |
+
else:
|
| 254 |
+
out.append(t.index_select(0, indices))
|
| 255 |
+
return out
|
| 256 |
+
|
| 257 |
+
|
| 258 |
+
class TokenImportancePredictorAttentive(nn.Module):
|
| 259 |
+
def __init__(self, config, pred_hid_size, num_heads, num_hidden_layers, dDash, intdim, \
|
| 260 |
+
attn_reduce_factor, dropout=0.1):
|
| 261 |
+
"""
|
| 262 |
+
Optimized Token Importance Predictor with parallel Q-K projections and simplified mapping.
|
| 263 |
+
|
| 264 |
+
Args:
|
| 265 |
+
config: Configuration object containing model parameters.
|
| 266 |
+
pred_hid_size (int): Hidden size for the predictor's attention layer.
|
| 267 |
+
num_heads (int): Number of attention heads.
|
| 268 |
+
num_hidden_layers (int): Number of transformer layers to predict.
|
| 269 |
+
dropout (float): Dropout probability.
|
| 270 |
+
q_downscale (int): Factor to downscale the Q dimension for efficiency.
|
| 271 |
+
intermediate_dim (int): Intermediate dimension for non-linear transformations in projections.
|
| 272 |
+
"""
|
| 273 |
+
super().__init__()
|
| 274 |
+
self.config = config
|
| 275 |
+
self.hidden_size = pred_hid_size
|
| 276 |
+
self.num_heads = num_heads
|
| 277 |
+
self.num_hidden_layers = num_hidden_layers
|
| 278 |
+
self.dropout = dropout
|
| 279 |
+
self.head_dim = pred_hid_size // (num_heads * 4) # Predictor head dimension is not the same as the model head dimension.
|
| 280 |
+
self.rope_theta = config.rope_theta
|
| 281 |
+
self.dDash = dDash
|
| 282 |
+
self.intermediate_dim = intdim
|
| 283 |
+
self.attn_reduce_factor = attn_reduce_factor
|
| 284 |
+
self.max_position_embeddings = config.max_position_embeddings
|
| 285 |
+
self.flash_attn = False
|
| 286 |
+
assert pred_hid_size % (num_heads * 4) == 0, "pred_hid_size must be divisible by num_heads * 4."
|
| 287 |
+
|
| 288 |
+
# Reduce the hidden size for attention computations
|
| 289 |
+
self.hidden_size_reduced = self.hidden_size // self.attn_reduce_factor # For example, reduce to 1/4th
|
| 290 |
+
assert self.hidden_size_reduced % self.num_heads == 0, "Reduced hidden size must be divisible by num_heads"
|
| 291 |
+
self.attn_head_dim = self.hidden_size_reduced // self.num_heads
|
| 292 |
+
|
| 293 |
+
# Input projection to reduce hidden size
|
| 294 |
+
self.input_proj = nn.Linear(self.hidden_size, self.hidden_size_reduced, bias=False)
|
| 295 |
+
|
| 296 |
+
# Query, Key, Value projections for attention
|
| 297 |
+
self.q_proj_attn = nn.Linear(self.hidden_size_reduced, self.hidden_size_reduced, bias=False)
|
| 298 |
+
self.k_proj_attn = nn.Linear(self.hidden_size_reduced, self.hidden_size_reduced, bias=False)
|
| 299 |
+
self.v_proj_attn = nn.Linear(self.hidden_size_reduced, self.hidden_size_reduced, bias=False)
|
| 300 |
+
# Output projection to restore hidden size
|
| 301 |
+
# self.o_proj_attn = nn.Linear(self.hidden_size_reduced, self.hidden_size_reduced, bias=False)
|
| 302 |
+
self.attn_dropout = nn.Dropout(self.dropout)
|
| 303 |
+
|
| 304 |
+
# LayerNorm and Feed-forward network
|
| 305 |
+
self.norm1 = nn.LayerNorm(self.hidden_size_reduced)
|
| 306 |
+
self.norm2 = nn.LayerNorm(self.hidden_size)
|
| 307 |
+
|
| 308 |
+
self.ffn_hidden_size = 2 * self.hidden_size_reduced # Typical FFN hidden size
|
| 309 |
+
self.ffn = nn.Sequential(
|
| 310 |
+
nn.Linear(self.hidden_size_reduced, self.ffn_hidden_size),
|
| 311 |
+
nn.GELU(),
|
| 312 |
+
nn.Linear(self.ffn_hidden_size, self.hidden_size),
|
| 313 |
+
nn.Dropout(self.dropout)
|
| 314 |
+
)
|
| 315 |
+
# Add extra LayerNorm for the importance branch when not using the old design.
|
| 316 |
+
self.norm_importance = nn.LayerNorm(self.hidden_size)
|
| 317 |
+
|
| 318 |
+
# Define Q and K projection layers for all layers in parallel with non-linearity[]
|
| 319 |
+
# Output shape: [B, L, N * H * D']
|
| 320 |
+
self.q_proj_importance = nn.Sequential(
|
| 321 |
+
nn.Linear(pred_hid_size, self.intermediate_dim, bias=False),
|
| 322 |
+
nn.SiLU(),
|
| 323 |
+
nn.Linear(self.intermediate_dim, num_hidden_layers * num_heads * self.dDash, bias=False)
|
| 324 |
+
)
|
| 325 |
+
self.k_proj_importance = nn.Sequential(
|
| 326 |
+
nn.Linear(pred_hid_size, self.intermediate_dim, bias=False),
|
| 327 |
+
nn.SiLU(),
|
| 328 |
+
nn.Linear(self.intermediate_dim, num_hidden_layers * num_heads * self.dDash, bias=False)
|
| 329 |
+
)
|
| 330 |
+
|
| 331 |
+
# Initialize rotary positional embeddings
|
| 332 |
+
self._init_rope()
|
| 333 |
+
self._initialize_weights()
|
| 334 |
+
self.device = None
|
| 335 |
+
|
| 336 |
+
def _initialize_weights(self):
|
| 337 |
+
for name, module in self.named_modules():
|
| 338 |
+
if isinstance(module, nn.Linear):
|
| 339 |
+
nn.init.xavier_uniform_(module.weight) # Xavier initialization for linear layers
|
| 340 |
+
if module.bias is not None:
|
| 341 |
+
nn.init.constant_(module.bias, 0)
|
| 342 |
+
elif isinstance(module, nn.LayerNorm):
|
| 343 |
+
nn.init.constant_(module.weight, 1.0)
|
| 344 |
+
nn.init.constant_(module.bias, 0.0)
|
| 345 |
+
elif isinstance(module, nn.MultiheadAttention):
|
| 346 |
+
# Initialize in_proj_weight
|
| 347 |
+
nn.init.xavier_uniform_(module.in_proj_weight)
|
| 348 |
+
if module.in_proj_bias is not None:
|
| 349 |
+
nn.init.constant_(module.in_proj_bias, 0)
|
| 350 |
+
|
| 351 |
+
# Initialize out_proj
|
| 352 |
+
nn.init.xavier_uniform_(module.out_proj.weight)
|
| 353 |
+
if module.out_proj.bias is not None:
|
| 354 |
+
nn.init.constant_(module.out_proj.bias, 0)
|
| 355 |
+
|
| 356 |
+
def _init_rope(self):
|
| 357 |
+
|
| 358 |
+
# send self.config but after modifying head_dim to be self.head_dim just in the function call
|
| 359 |
+
config_copy = copy.deepcopy(self.config)
|
| 360 |
+
config_copy.rope_scaling = {
|
| 361 |
+
"factor": 32.0,
|
| 362 |
+
"high_freq_factor": 4.0,
|
| 363 |
+
"low_freq_factor": 1.0,
|
| 364 |
+
"original_max_position_embeddings": 8192,
|
| 365 |
+
"rope_type": "llama3"
|
| 366 |
+
}
|
| 367 |
+
config_copy.head_dim = self.attn_head_dim
|
| 368 |
+
|
| 369 |
+
# Rotary embedding for attention layer
|
| 370 |
+
self.rotary_emb_attn = LlamaRotaryEmbedding(
|
| 371 |
+
config_copy
|
| 372 |
+
)
|
| 373 |
+
|
| 374 |
+
config_copy.head_dim = self.dDash
|
| 375 |
+
# Rotary embedding for importance projection
|
| 376 |
+
self.rotary_emb_importance = LlamaRotaryEmbedding(
|
| 377 |
+
config_copy
|
| 378 |
+
)
|
| 379 |
+
|
| 380 |
+
def forward(self, hidden_states, attention_mask=None, position_ids=None, past_key_value=None, use_cache=False, layer_idx=None):
|
| 381 |
+
"""
|
| 382 |
+
Forward pass for the Optimized Token Importance Predictor.
|
| 383 |
+
|
| 384 |
+
Args:
|
| 385 |
+
hidden_states (torch.Tensor): Input tensor of shape [B, L, HQ].
|
| 386 |
+
attention_mask (torch.Tensor, optional): Attention mask of shape [B, 1, 1, L] or [B, 1, L, L].
|
| 387 |
+
position_ids (torch.Tensor, optional): Position IDs.
|
| 388 |
+
past_key_value (tuple, optional): Past key and value states.
|
| 389 |
+
use_cache (bool, optional): Whether to use cache.
|
| 390 |
+
|
| 391 |
+
Returns:
|
| 392 |
+
torch.Tensor: Importance scores of shape [B, N, H, L, L].
|
| 393 |
+
"""
|
| 394 |
+
layer_idx = 0 # Guaranteed to be 0, as we only have one predictor!
|
| 395 |
+
|
| 396 |
+
# Set device if not already set
|
| 397 |
+
if self.device != hidden_states.device:
|
| 398 |
+
self.device = hidden_states.device
|
| 399 |
+
self.to(self.device)
|
| 400 |
+
|
| 401 |
+
B, L, E = hidden_states.size()
|
| 402 |
+
|
| 403 |
+
# Reduce hidden size
|
| 404 |
+
hidden_states = hidden_states.to(self.input_proj.weight.dtype)
|
| 405 |
+
hidden_states_reduced = self.input_proj(hidden_states) # [B, L, hidden_size_reduced]
|
| 406 |
+
# Compute q, k, v for attention
|
| 407 |
+
q = self.q_proj_attn(hidden_states_reduced) # [B, L, hidden_size_reduced]
|
| 408 |
+
k = self.k_proj_attn(hidden_states_reduced) # [B, L, hidden_size_reduced]
|
| 409 |
+
v = self.v_proj_attn(hidden_states_reduced) # [B, L, hidden_size_reduced]
|
| 410 |
+
# Reshape q, k, v to [B, num_heads, L, attn_head_dim]
|
| 411 |
+
q = q.view(B, L, self.num_heads, self.attn_head_dim).transpose(1, 2) # [B, num_heads, L, attn_head_dim]
|
| 412 |
+
k = k.view(B, L, self.num_heads, self.attn_head_dim).transpose(1, 2) # [B, num_heads, L, attn_head_dim]
|
| 413 |
+
v = v.view(B, L, self.num_heads, self.attn_head_dim).transpose(1, 2) # [B, num_heads, L, attn_head_dim]
|
| 414 |
+
if (past_key_value is not None
|
| 415 |
+
and layer_idx < len(past_key_value.predictor_primary_key)
|
| 416 |
+
and past_key_value.predictor_primary_key[layer_idx] is not None):
|
| 417 |
+
offset = past_key_value.predictor_primary_key[layer_idx].shape[2] # old_k.shape[2]
|
| 418 |
+
else:
|
| 419 |
+
offset = 0
|
| 420 |
+
|
| 421 |
+
# total seq length for new + old
|
| 422 |
+
kv_seq_len = offset + L
|
| 423 |
+
|
| 424 |
+
# Step 2: build position_ids for just the new chunk [offset..offset+L-1]
|
| 425 |
+
if position_ids is None:
|
| 426 |
+
# shape [B, L], e.g. [0..(offset+L-1)]
|
| 427 |
+
position_ids = torch.arange(offset, offset + L, dtype=torch.long, device=self.device)
|
| 428 |
+
position_ids = position_ids.unsqueeze(0).expand(B, L)
|
| 429 |
+
|
| 430 |
+
# Step 3: apply rotary to just the new chunk k,v with the correct offset
|
| 431 |
+
cos, sin = self.rotary_emb_attn(v, position_ids)
|
| 432 |
+
q, k = apply_rotary_pos_emb(q, k, cos, sin, position_ids)
|
| 433 |
+
|
| 434 |
+
# Step 4: ask the cache to append them. Then re‐assign k, v to the full cat
|
| 435 |
+
if use_cache and past_key_value is not None:
|
| 436 |
+
k, v = past_key_value.update_predictor_primary(k.detach(), v.detach(), layer_idx)
|
| 437 |
+
kv_seq_len = k.size(2) # now includes old + new
|
| 438 |
+
|
| 439 |
+
attn_output = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=None, is_causal=True)
|
| 440 |
+
attn_output = attn_output.to(q.dtype)
|
| 441 |
+
attn_output = attn_output.transpose(1, 2).contiguous().view(B, L, self.hidden_size_reduced)
|
| 442 |
+
attn_output = self.norm1(attn_output)
|
| 443 |
+
ffn_output = self.ffn(attn_output)
|
| 444 |
+
# Temporary measure, till old predictor fully deprecated
|
| 445 |
+
hidden_states = self.norm2(hidden_states + ffn_output)
|
| 446 |
+
|
| 447 |
+
B, L, E = hidden_states.size()
|
| 448 |
+
# Importance projections
|
| 449 |
+
H = self.num_heads
|
| 450 |
+
N = self.num_hidden_layers
|
| 451 |
+
|
| 452 |
+
hidden_states_for_importance = self.norm_importance(hidden_states)
|
| 453 |
+
q_importance = self.q_proj_importance(hidden_states_for_importance)
|
| 454 |
+
k_importance = self.k_proj_importance(hidden_states_for_importance)
|
| 455 |
+
|
| 456 |
+
# Reshape and permute to [B, N, H, L, D']
|
| 457 |
+
q_importance = q_importance.view(B, L, N, H, self.dDash).permute(0, 2, 3, 1, 4).contiguous() # [B, N, H, L, D']
|
| 458 |
+
k_importance = k_importance.view(B, L, N, H, self.dDash).permute(0, 2, 3, 1, 4).contiguous() # [B, N, H, L, D']
|
| 459 |
+
|
| 460 |
+
# Flatten N and H for efficient computation
|
| 461 |
+
q_importance = q_importance.view(B * N * H, L, self.dDash) # [BNH, L, D']
|
| 462 |
+
k_importance = k_importance.view(B * N * H, L, self.dDash) # [BNH, L, D']
|
| 463 |
+
|
| 464 |
+
# Apply rotary positional embeddings
|
| 465 |
+
cos, sin = self.rotary_emb_importance(k_importance, position_ids)
|
| 466 |
+
q_importance, k_importance = apply_rotary_pos_emb(q_importance, k_importance, cos, sin, position_ids)
|
| 467 |
+
|
| 468 |
+
if use_cache and past_key_value is not None:
|
| 469 |
+
k_importance = past_key_value.update_predictor_importance(k_importance.detach(), layer_idx)
|
| 470 |
+
|
| 471 |
+
k_importance = k_importance.view(B * H, N, -1, self.dDash) # [BNH, L, D']
|
| 472 |
+
q_importance = q_importance.view(B * H, N, -1, self.dDash) # [BH, N, L, D']
|
| 473 |
+
return q_importance, k_importance
|
| 474 |
+
|
| 475 |
+
|
| 476 |
+
|
| 477 |
+
class HeadImportancePredictor(nn.Module):
|
| 478 |
+
def __init__(self, config, pred_hid_size, num_heads, num_hidden_layers, dDash, intdim, \
|
| 479 |
+
attn_reduce_factor, dropout=0.1):
|
| 480 |
+
"""
|
| 481 |
+
Optimized Token Importance Predictor with parallel Q-K projections and simplified mapping.
|
| 482 |
+
|
| 483 |
+
Args:
|
| 484 |
+
config: Configuration object containing model parameters.
|
| 485 |
+
pred_hid_size (int): Hidden size for the predictor's attention layer.
|
| 486 |
+
num_heads (int): Number of attention heads.
|
| 487 |
+
num_hidden_layers (int): Number of transformer layers to predict.
|
| 488 |
+
dropout (float): Dropout probability.
|
| 489 |
+
q_downscale (int): Factor to downscale the Q dimension for efficiency.
|
| 490 |
+
intermediate_dim (int): Intermediate dimension for non-linear transformations in projections.
|
| 491 |
+
"""
|
| 492 |
+
super().__init__()
|
| 493 |
+
self.is_head_predictor = None
|
| 494 |
+
self.config = config
|
| 495 |
+
self.hidden_size = pred_hid_size
|
| 496 |
+
self.num_heads = num_heads
|
| 497 |
+
self.num_hidden_layers = num_hidden_layers
|
| 498 |
+
self.dropout = dropout
|
| 499 |
+
self.head_dim = pred_hid_size // (num_heads * 4)
|
| 500 |
+
self.rope_theta = config.rope_theta
|
| 501 |
+
self.dDash = dDash
|
| 502 |
+
self.intermediate_dim = intdim
|
| 503 |
+
self.attn_reduce_factor = attn_reduce_factor
|
| 504 |
+
self.max_position_embeddings = config.max_position_embeddings
|
| 505 |
+
self.flash_attn = False
|
| 506 |
+
|
| 507 |
+
# Reduce the hidden size for attention computations
|
| 508 |
+
self.hidden_size_reduced = self.hidden_size // self.attn_reduce_factor # For example, reduce to 1/4th
|
| 509 |
+
assert self.hidden_size_reduced % self.num_heads == 0, "Reduced hidden size must be divisible by num_heads"
|
| 510 |
+
self.attn_head_dim = self.hidden_size_reduced // self.num_heads
|
| 511 |
+
|
| 512 |
+
# Input projection to reduce hidden size
|
| 513 |
+
self.input_proj = nn.Linear(self.hidden_size, self.hidden_size_reduced, bias=False)
|
| 514 |
+
|
| 515 |
+
# Query, Key, Value projections for attention
|
| 516 |
+
self.q_proj_attn = nn.Linear(self.hidden_size_reduced, self.hidden_size_reduced, bias=False)
|
| 517 |
+
self.k_proj_attn = nn.Linear(self.hidden_size_reduced, self.hidden_size_reduced, bias=False)
|
| 518 |
+
self.v_proj_attn = nn.Linear(self.hidden_size_reduced, self.hidden_size_reduced, bias=False)
|
| 519 |
+
# Output projection to restore hidden size
|
| 520 |
+
# self.o_proj_attn = nn.Linear(self.hidden_size_reduced, self.hidden_size_reduced, bias=False)
|
| 521 |
+
self.attn_dropout = nn.Dropout(self.dropout)
|
| 522 |
+
|
| 523 |
+
# LayerNorm and Feed-forward network
|
| 524 |
+
self.norm1 = nn.LayerNorm(self.hidden_size_reduced)
|
| 525 |
+
self.norm2 = nn.LayerNorm(self.hidden_size)
|
| 526 |
+
|
| 527 |
+
self.ffn_hidden_size = 4 * self.hidden_size_reduced # Typical FFN hidden size
|
| 528 |
+
self.ffn = nn.Sequential(
|
| 529 |
+
nn.Linear(self.hidden_size_reduced, self.ffn_hidden_size),
|
| 530 |
+
nn.GELU(),
|
| 531 |
+
nn.Linear(self.ffn_hidden_size, self.num_heads * self.num_hidden_layers),
|
| 532 |
+
)
|
| 533 |
+
|
| 534 |
+
# Initialize rotary positional embeddings
|
| 535 |
+
self._init_rope()
|
| 536 |
+
self._initialize_weights()
|
| 537 |
+
self.device = None
|
| 538 |
+
|
| 539 |
+
def _initialize_weights(self):
|
| 540 |
+
for name, module in self.named_modules():
|
| 541 |
+
if isinstance(module, nn.Linear):
|
| 542 |
+
nn.init.xavier_uniform_(module.weight) # Xavier initialization for linear layers
|
| 543 |
+
if module.bias is not None:
|
| 544 |
+
nn.init.constant_(module.bias, 0)
|
| 545 |
+
elif isinstance(module, nn.LayerNorm):
|
| 546 |
+
nn.init.constant_(module.weight, 1.0)
|
| 547 |
+
nn.init.constant_(module.bias, 0.0)
|
| 548 |
+
elif isinstance(module, nn.MultiheadAttention):
|
| 549 |
+
# Initialize in_proj_weight
|
| 550 |
+
nn.init.xavier_uniform_(module.in_proj_weight)
|
| 551 |
+
if module.in_proj_bias is not None:
|
| 552 |
+
nn.init.constant_(module.in_proj_bias, 0)
|
| 553 |
+
|
| 554 |
+
# Initialize out_proj
|
| 555 |
+
nn.init.xavier_uniform_(module.out_proj.weight)
|
| 556 |
+
if module.out_proj.bias is not None:
|
| 557 |
+
nn.init.constant_(module.out_proj.bias, 0)
|
| 558 |
+
|
| 559 |
+
def _init_rope(self):
|
| 560 |
+
config_copy = copy.deepcopy(self.config)
|
| 561 |
+
config_copy.head_dim = self.attn_head_dim
|
| 562 |
+
# Rotary embedding for attention layer
|
| 563 |
+
self.rotary_emb_attn = LlamaRotaryEmbedding(
|
| 564 |
+
config_copy
|
| 565 |
+
)
|
| 566 |
+
# Rotary embedding for importance projection
|
| 567 |
+
self.rotary_emb_importance = LlamaRotaryEmbedding(
|
| 568 |
+
config_copy
|
| 569 |
+
)
|
| 570 |
+
|
| 571 |
+
def forward(self, hidden_states, attention_mask=None, position_ids=None, past_key_value=None, use_cache=False):
|
| 572 |
+
"""
|
| 573 |
+
Forward pass for the Optimized Token Importance Predictor.
|
| 574 |
+
|
| 575 |
+
Args:
|
| 576 |
+
hidden_states (torch.Tensor): Input tensor of shape [B, L, HQ].
|
| 577 |
+
attention_mask (torch.Tensor, optional): Attention mask of shape [B, 1, 1, L] or [B, 1, L, L].
|
| 578 |
+
position_ids (torch.Tensor, optional): Position IDs.
|
| 579 |
+
past_key_value (tuple, optional): Past key and value states.
|
| 580 |
+
use_cache (bool, optional): Whether to use cache.
|
| 581 |
+
|
| 582 |
+
Returns:
|
| 583 |
+
torch.Tensor: Importance scores of shape [B, N, H, L, L].
|
| 584 |
+
"""
|
| 585 |
+
# Set device if not already set
|
| 586 |
+
if self.device != hidden_states.device:
|
| 587 |
+
self.device = hidden_states.device
|
| 588 |
+
self.to(self.device)
|
| 589 |
+
|
| 590 |
+
B, L, E = hidden_states.size()
|
| 591 |
+
if past_key_value is None:
|
| 592 |
+
past_key_value = {}
|
| 593 |
+
# if L == 1:
|
| 594 |
+
# import pdb; pdb.set_trace()
|
| 595 |
+
past_primary = past_key_value.get('primary', None)
|
| 596 |
+
# Reduce hidden size
|
| 597 |
+
hidden_states = hidden_states.to(self.input_proj.weight.dtype)
|
| 598 |
+
hidden_states_reduced = self.input_proj(hidden_states) # [B, L, hidden_size_reduced]
|
| 599 |
+
# Compute q, k, v for attention
|
| 600 |
+
q = self.q_proj_attn(hidden_states_reduced) # [B, L, hidden_size_reduced]
|
| 601 |
+
k = self.k_proj_attn(hidden_states_reduced) # [B, L, hidden_size_reduced]
|
| 602 |
+
v = self.v_proj_attn(hidden_states_reduced) # [B, L, hidden_size_reduced]
|
| 603 |
+
# Reshape q, k, v to [B, num_heads, L, attn_head_dim]
|
| 604 |
+
q = q.view(B, L, self.num_heads, self.attn_head_dim).transpose(1, 2) # [B, num_heads, L, attn_head_dim]
|
| 605 |
+
k = k.view(B, L, self.num_heads, self.attn_head_dim).transpose(1, 2) # [B, num_heads, L, attn_head_dim]
|
| 606 |
+
v = v.view(B, L, self.num_heads, self.attn_head_dim).transpose(1, 2) # [B, num_heads, L, attn_head_dim]
|
| 607 |
+
# Compute kv_seq_len before concatenation
|
| 608 |
+
if past_primary is not None:
|
| 609 |
+
past_L = past_primary[0].shape[2]
|
| 610 |
+
kv_seq_len = past_L + L
|
| 611 |
+
else:
|
| 612 |
+
kv_seq_len = L
|
| 613 |
+
|
| 614 |
+
# Apply rotary positional embeddings based on kv_seq_len
|
| 615 |
+
cos, sin = self.rotary_emb_attn(v, position_ids)
|
| 616 |
+
if position_ids is None:
|
| 617 |
+
position_ids = torch.arange(kv_seq_len, dtype=torch.long, device=self.device)
|
| 618 |
+
position_ids = position_ids.unsqueeze(0).expand(B, kv_seq_len)
|
| 619 |
+
|
| 620 |
+
if past_primary is not None:
|
| 621 |
+
# Concatenate past k and v
|
| 622 |
+
k = torch.cat([past_primary[0], k], dim=2) # [B, num_heads, past_L + L, attn_head_dim]
|
| 623 |
+
v = torch.cat([past_primary[1], v], dim=2) # [B, num_heads, past_L + L, attn_head_dim]
|
| 624 |
+
|
| 625 |
+
# Apply rotary embeddings after concatenation
|
| 626 |
+
q, k = apply_rotary_pos_emb(q, k, cos, sin, position_ids)
|
| 627 |
+
|
| 628 |
+
# Update cache if use_cache is True
|
| 629 |
+
if use_cache:
|
| 630 |
+
past_key_value['primary'] = (k.detach(), v.detach())
|
| 631 |
+
|
| 632 |
+
# if self.flash_attn:
|
| 633 |
+
# sm_scale = 1.0 / math.sqrt(self.attn_head_dim)
|
| 634 |
+
# attn_output = attention(q.contiguous().to(torch.float16), k.contiguous().to(torch.float16), v.contiguous().to(torch.float16), True, sm_scale).to(q.dtype)
|
| 635 |
+
# else:
|
| 636 |
+
# attn_output = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=None, is_causal=True)
|
| 637 |
+
attn_output = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=None, is_causal=True)
|
| 638 |
+
attn_output = attn_output.to(q.dtype)
|
| 639 |
+
attn_output = attn_output.transpose(1, 2).contiguous().view(B, L, self.hidden_size_reduced)
|
| 640 |
+
attn_output = self.norm1(attn_output)
|
| 641 |
+
head_importances = self.ffn(attn_output)
|
| 642 |
+
return head_importances, past_key_value
|
| 643 |
+
|
| 644 |
+
def calculate_hit_metrics(estimated_importance: torch.Tensor,
|
| 645 |
+
true_importance: torch.Tensor,
|
| 646 |
+
top_k_ratio: float = 0.5) -> Tuple[float, float, float]:
|
| 647 |
+
"""
|
| 648 |
+
Calculate hit accuracy, mean, and max rank correlation between estimated and true importance tensors.
|
| 649 |
+
We compute metrics along the last dimension of the input tensors.
|
| 650 |
+
|
| 651 |
+
Shapes:
|
| 652 |
+
- 4D token-importance: [B, H, L, L]. We slice the last query (index -1) => [B, H, L].
|
| 653 |
+
- 3D head-importance: [B, L, H]. We use all of it as-is => [B, L, H].
|
| 654 |
+
|
| 655 |
+
Args:
|
| 656 |
+
estimated_importance (torch.Tensor): [B, H, L, L] or [B, L, H]
|
| 657 |
+
true_importance (torch.Tensor): [B, H, L, L] or [B, L, H]
|
| 658 |
+
top_k_ratio (float): Fraction of top-k elements to consider for hit accuracy (default=0.5).
|
| 659 |
+
|
| 660 |
+
Returns:
|
| 661 |
+
(hit_accuracy, mean_corr, max_corr):
|
| 662 |
+
hit_accuracy (float): Intersection ratio of top-k sets (0..1).
|
| 663 |
+
mean_corr (float): Average Spearman rank correlation over all [B, ...].
|
| 664 |
+
max_corr (float): Maximum Spearman rank correlation among all [B, ...].
|
| 665 |
+
"""
|
| 666 |
+
|
| 667 |
+
# 1) Standardize shapes so the last dimension is what we rank over.
|
| 668 |
+
if estimated_importance.dim() == 4:
|
| 669 |
+
# Shape is [B, H, L, L] => slice to keep only the last query => [B, H, L]
|
| 670 |
+
estimated_importance = estimated_importance[:, :, -1, :]
|
| 671 |
+
true_importance = true_importance[:, :, -1, :]
|
| 672 |
+
# after slicing: [B, H, L]
|
| 673 |
+
# For intersection denominator => top_k * B * H
|
| 674 |
+
denom_for_hits = estimated_importance.size(0) * estimated_importance.size(1)
|
| 675 |
+
elif estimated_importance.dim() == 3:
|
| 676 |
+
# Shape is [B, L, H], the last dimension is H
|
| 677 |
+
# For intersection denominator => top_k * B * L
|
| 678 |
+
denom_for_hits = estimated_importance.size(0) * estimated_importance.size(1)
|
| 679 |
+
else:
|
| 680 |
+
raise ValueError("Tensors must be either 4D [B,H,L,L] or 3D [B,L,H].")
|
| 681 |
+
|
| 682 |
+
# 2) Compute Spearman rank correlation along the last dimension.
|
| 683 |
+
# Sort indices in descending order => get 'ranks' for correlation.
|
| 684 |
+
_, sorted_esti = torch.sort(estimated_importance, dim=-1, descending=True)
|
| 685 |
+
_, sorted_true = torch.sort(true_importance, dim=-1, descending=True)
|
| 686 |
+
|
| 687 |
+
# Spearman's rho = 1 - 6 * sum(d^2) / [n*(n^2 - 1)]
|
| 688 |
+
n = sorted_esti.shape[-1]
|
| 689 |
+
d = sorted_esti.float() - sorted_true.float()
|
| 690 |
+
d_squared = d ** 2
|
| 691 |
+
sum_d_squared = d_squared.sum(dim=-1)
|
| 692 |
+
rank_corr = 1 - (6 * sum_d_squared) / (n * (n**2 - 1)) # shape: [B,H] or [B,L]
|
| 693 |
+
|
| 694 |
+
mean_corr = rank_corr.mean().item()
|
| 695 |
+
max_corr = rank_corr.max().item()
|
| 696 |
+
|
| 697 |
+
# 3) Compute top-k hit accuracy along the last dimension.
|
| 698 |
+
top_k = max(1, int(n * top_k_ratio))
|
| 699 |
+
_, top_esti_indices = torch.topk(estimated_importance, top_k, dim=-1)
|
| 700 |
+
_, top_true_indices = torch.topk(true_importance, top_k, dim=-1)
|
| 701 |
+
|
| 702 |
+
# top_esti_indices => [B,H,top_k] or [B,L,top_k]
|
| 703 |
+
# top_true_indices => [B,H,top_k] or [B,L,top_k]
|
| 704 |
+
# matches => [B,H,top_k,top_k] or [B,L,top_k,top_k]
|
| 705 |
+
matches = (top_esti_indices.unsqueeze(-1) == top_true_indices.unsqueeze(-2))
|
| 706 |
+
intersection = matches.any(dim=-1).sum(dim=-1) # => [B,H] or [B,L]
|
| 707 |
+
|
| 708 |
+
# Each [B,H] or [B,L] element can have at most 'top_k' matches, so total is top_k * denom_for_hits.
|
| 709 |
+
total_possible = top_k * denom_for_hits
|
| 710 |
+
hit_accuracy = intersection.sum().item() / total_possible # => 0..1
|
| 711 |
+
|
| 712 |
+
return hit_accuracy, mean_corr, max_corr
|
| 713 |
+
|
| 714 |
+
|
| 715 |
+
def threshold_to_mask(unadj_importance_mask, perhead_thresholds, min_sparse_index, bsz, q_len, key_len):
|
| 716 |
+
"""
|
| 717 |
+
Create a mask tensor based on per-head thresholds, setting values below the threshold to -inf.
|
| 718 |
+
|
| 719 |
+
Args:
|
| 720 |
+
- unadj_importance_mask: torch.Tensor of shape [B, H, Lq, Lk].
|
| 721 |
+
- perhead_thresholds: torch.Tensor of shape [H], per-head thresholds.
|
| 722 |
+
- min_sparse_index: Minimum index for sparsity; values below this index will not be masked.
|
| 723 |
+
- bsz: Batch size.
|
| 724 |
+
- q_len: Query length (Lq).
|
| 725 |
+
- key_len: Key length (Lk).
|
| 726 |
+
|
| 727 |
+
Returns:
|
| 728 |
+
- mask_tensor: torch.Tensor of shape [B, H, Lq, Lk], with values below threshold as -inf.
|
| 729 |
+
"""
|
| 730 |
+
# Ensure perhead_thresholds is in the correct shape for broadcasting
|
| 731 |
+
thresholds_broadcast = perhead_thresholds.view(1, -1, 1, 1) # [1, H, 1, 1]
|
| 732 |
+
|
| 733 |
+
# Compare unadj_importance_mask with thresholds to create a mask
|
| 734 |
+
mask_tensor = torch.where(
|
| 735 |
+
unadj_importance_mask >= thresholds_broadcast,
|
| 736 |
+
torch.zeros_like(unadj_importance_mask),
|
| 737 |
+
torch.full_like(unadj_importance_mask, float('-inf'))
|
| 738 |
+
) # [B, H, Lq, Lk]
|
| 739 |
+
|
| 740 |
+
# Ensure mask_tensor has mask_tensor[:, :, :, :min_sparse_index] = 0
|
| 741 |
+
mask_tensor[:, :, :, :min_sparse_index] = 0.0
|
| 742 |
+
|
| 743 |
+
return mask_tensor
|
| 744 |
+
|
| 745 |
+
class SlidingWindowCache:
|
| 746 |
+
def __init__(self, max_seq_len, sliding_window, device):
|
| 747 |
+
self.sliding_window = sliding_window
|
| 748 |
+
self.device = device
|
| 749 |
+
if sliding_window is None:
|
| 750 |
+
self.max_seq_len = 0
|
| 751 |
+
self.window = None
|
| 752 |
+
else:
|
| 753 |
+
self.max_seq_len = max_seq_len
|
| 754 |
+
self.window = self._create_window(self.max_seq_len)
|
| 755 |
+
|
| 756 |
+
def _create_window(self, seq_len):
|
| 757 |
+
idx = torch.arange(seq_len, device=self.device)
|
| 758 |
+
query = idx.unsqueeze(1) # [seq_len, 1]
|
| 759 |
+
key = idx.unsqueeze(0) # [1, seq_len]
|
| 760 |
+
win = (key >= (query - self.sliding_window + 1)) & (key <= query)
|
| 761 |
+
return win.unsqueeze(0).unsqueeze(0) # [1,1,seq_len,seq_len]
|
| 762 |
+
|
| 763 |
+
def get_window(self, q_len, key_len):
|
| 764 |
+
if self.sliding_window is None:
|
| 765 |
+
return None
|
| 766 |
+
req = max(q_len, key_len)
|
| 767 |
+
if req > self.max_seq_len:
|
| 768 |
+
self.max_seq_len = req
|
| 769 |
+
self.window = self._create_window(self.max_seq_len)
|
| 770 |
+
return self.window[:, :, :q_len, :key_len]
|
| 771 |
+
|
| 772 |
+
def enforce_sliding_window(mask_tensor, window):
|
| 773 |
+
if window is None:
|
| 774 |
+
return mask_tensor
|
| 775 |
+
return mask_tensor.masked_fill(window, 0.0)
|
| 776 |
+
|
| 777 |
+
|
| 778 |
+
def sorted_index_to_mask(
|
| 779 |
+
sorted_indices,
|
| 780 |
+
attention_mask,
|
| 781 |
+
min_sparse_index,
|
| 782 |
+
bsz,
|
| 783 |
+
q_len,
|
| 784 |
+
key_len,
|
| 785 |
+
sparse_aggression,
|
| 786 |
+
sliding_window=None
|
| 787 |
+
):
|
| 788 |
+
"""
|
| 789 |
+
sorted_indices: [B, H, q_len, key_len]
|
| 790 |
+
attention_mask: [1, 1, q_len, key_len] (True = keep, False = mask out, or vice versa)
|
| 791 |
+
min_sparse_index: guaranteed front region to keep
|
| 792 |
+
sliding_window: guaranteed trailing region (for each query) to keep
|
| 793 |
+
sparse_aggression: float in [0,1], fraction of keys to drop or keep
|
| 794 |
+
"""
|
| 795 |
+
device = sorted_indices.device
|
| 796 |
+
dtype = sorted_indices.dtype
|
| 797 |
+
|
| 798 |
+
# Step 1: Compute base K
|
| 799 |
+
if q_len == 1:
|
| 800 |
+
query_positions = torch.arange(q_len, device=device).view(1, 1, q_len, 1).float()
|
| 801 |
+
query_positions[0] = key_len + 1
|
| 802 |
+
else:
|
| 803 |
+
query_positions = torch.arange(q_len, device=device).view(1, 1, q_len, 1).float() + 1.0
|
| 804 |
+
K_original = torch.ceil(query_positions * sparse_aggression).long() # [1,1,q_len,1]
|
| 805 |
+
K_original = torch.clamp(K_original, max=key_len)
|
| 806 |
+
|
| 807 |
+
# Step 1b: Incorporate guaranteed region
|
| 808 |
+
guaranteed = min_sparse_index
|
| 809 |
+
if sliding_window is not None:
|
| 810 |
+
guaranteed += sliding_window
|
| 811 |
+
# Subtract guaranteed from the original K
|
| 812 |
+
K_adjusted = K_original - guaranteed
|
| 813 |
+
# Ensure K_adjusted is at least 0
|
| 814 |
+
K_adjusted = torch.clamp(K_adjusted, min=0, max=key_len)
|
| 815 |
+
|
| 816 |
+
# Step 2: Expand attention_mask to [B,H,q_len,key_len]
|
| 817 |
+
attention_mask_expanded = attention_mask.expand(bsz, -1, -1, -1)
|
| 818 |
+
attention_mask_expanded = attention_mask_expanded.expand(-1, sorted_indices.size(1), -1, -1)
|
| 819 |
+
# Convert True -> 1, False -> 0
|
| 820 |
+
attention_mask_expanded = (~attention_mask_expanded.bool()).int()
|
| 821 |
+
|
| 822 |
+
# Step 3: Gather (reorder) mask by sorted_indices
|
| 823 |
+
gathered_mask = torch.gather(attention_mask_expanded, dim=-1, index=sorted_indices)
|
| 824 |
+
|
| 825 |
+
# Step 4: cumsum along sorted dimension
|
| 826 |
+
gathered_mask_float = gathered_mask.float()
|
| 827 |
+
cum_sum = torch.cumsum(gathered_mask_float, dim=-1) # [B,H,q_len,key_len]
|
| 828 |
+
|
| 829 |
+
# Step 5: Compare cumsum <= K_adjusted
|
| 830 |
+
# Expand K_adjusted to [B,H,q_len,key_len] for broadcast
|
| 831 |
+
K_broadcast = K_adjusted.view(1, 1, q_len, 1).expand_as(cum_sum)
|
| 832 |
+
selected_mask = (cum_sum <= K_broadcast)
|
| 833 |
+
|
| 834 |
+
# Step 6: Prepare final mask_tensor with -inf by default
|
| 835 |
+
mask_tensor = torch.full_like(attention_mask_expanded.float(), float('-inf'))
|
| 836 |
+
|
| 837 |
+
# Step 7: Scatter 0 where selected, -inf otherwise
|
| 838 |
+
scatter_values = torch.zeros_like(gathered_mask_float)
|
| 839 |
+
scatter_values = scatter_values.masked_fill(~selected_mask, float('-inf'))
|
| 840 |
+
mask_tensor.scatter_(-1, sorted_indices, scatter_values)
|
| 841 |
+
|
| 842 |
+
# Step 8: Force the guaranteed front region unmasked
|
| 843 |
+
mask_tensor[:, :, :, :min_sparse_index] = 0.0
|
| 844 |
+
|
| 845 |
+
# We do NOT forcibly unmask the trailing `sliding_window` here,
|
| 846 |
+
# because we typically do it with a separate function that
|
| 847 |
+
# ensures the last `sliding_window` positions are unmasked for each query.
|
| 848 |
+
# Replace with self.sliding_window where referenced
|
| 849 |
+
# Where not referenced, reduce budget in calculation.
|
| 850 |
+
|
| 851 |
+
return mask_tensor
|
| 852 |
+
|
| 853 |
+
class LlamaLinearScalingRotaryEmbedding(LlamaRotaryEmbedding):
|
| 854 |
+
"""LlamaRotaryEmbedding extended with linear scaling. Credits to the Reddit user /u/kaiokendev"""
|
| 855 |
+
|
| 856 |
+
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0, config=None):
|
| 857 |
+
self.scaling_factor = scaling_factor
|
| 858 |
+
super().__init__(config)
|
| 859 |
+
|
| 860 |
+
def _set_cos_sin_cache(self, seq_len, device, dtype):
|
| 861 |
+
self.max_seq_len_cached = seq_len
|
| 862 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
|
| 863 |
+
t = t / self.scaling_factor
|
| 864 |
+
|
| 865 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
| 866 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
| 867 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 868 |
+
self.register_buffer("cos_cached", emb.cos()[None, None, :, :].to(dtype), persistent=False)
|
| 869 |
+
self.register_buffer("sin_cached", emb.sin()[None, None, :, :].to(dtype), persistent=False)
|
| 870 |
+
|
| 871 |
+
|
| 872 |
+
class LlamaDynamicNTKScalingRotaryEmbedding(LlamaRotaryEmbedding):
|
| 873 |
+
"""LlamaRotaryEmbedding extended with Dynamic NTK scaling. Credits to the Reddit users /u/bloc97 and /u/emozilla"""
|
| 874 |
+
|
| 875 |
+
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0, config=None):
|
| 876 |
+
self.scaling_factor = scaling_factor
|
| 877 |
+
super().__init__(config)
|
| 878 |
+
|
| 879 |
+
def _set_cos_sin_cache(self, seq_len, device, dtype):
|
| 880 |
+
self.max_seq_len_cached = seq_len
|
| 881 |
+
|
| 882 |
+
if seq_len > self.max_position_embeddings:
|
| 883 |
+
base = self.base * (
|
| 884 |
+
(self.scaling_factor * seq_len / self.max_position_embeddings) - (self.scaling_factor - 1)
|
| 885 |
+
) ** (self.dim / (self.dim - 2))
|
| 886 |
+
inv_freq = 1.0 / (base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
|
| 887 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
| 888 |
+
|
| 889 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
|
| 890 |
+
|
| 891 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
| 892 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
| 893 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 894 |
+
self.register_buffer("cos_cached", emb.cos()[None, None, :, :].to(dtype), persistent=False)
|
| 895 |
+
self.register_buffer("sin_cached", emb.sin()[None, None, :, :].to(dtype), persistent=False)
|
| 896 |
+
|
| 897 |
+
def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
|
| 898 |
+
"""
|
| 899 |
+
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
|
| 900 |
+
num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
|
| 901 |
+
"""
|
| 902 |
+
batch, num_key_value_heads, slen, head_dim = hidden_states.shape
|
| 903 |
+
if n_rep == 1:
|
| 904 |
+
return hidden_states
|
| 905 |
+
hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
|
| 906 |
+
return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
|
| 907 |
+
|
| 908 |
+
|
| 909 |
+
class LlamaAttentionExperimental(nn.Module):
|
| 910 |
+
def __init__(self, config: LlamaConfig, producer=None, layer_idx=0):
|
| 911 |
+
super().__init__()
|
| 912 |
+
self.config = config
|
| 913 |
+
self.hidden_size = config.hidden_size
|
| 914 |
+
self.num_hidden_layers = config.num_hidden_layers
|
| 915 |
+
self.num_heads = config.num_attention_heads
|
| 916 |
+
self.head_dim = self.hidden_size // self.num_heads
|
| 917 |
+
self.num_key_value_heads = config.num_key_value_heads
|
| 918 |
+
self.num_key_value_groups = self.num_heads // self.num_key_value_heads
|
| 919 |
+
self.max_position_embeddings = config.max_position_embeddings
|
| 920 |
+
self.rope_theta = config.rope_theta
|
| 921 |
+
self.inference_mode = False
|
| 922 |
+
self.producer = producer
|
| 923 |
+
self.layer_idx = layer_idx
|
| 924 |
+
self.token_sparse_method = None
|
| 925 |
+
self.sparse_aggression = None
|
| 926 |
+
self.stream_llm_start_size = None
|
| 927 |
+
self.dDash = None
|
| 928 |
+
self.intdim = None
|
| 929 |
+
self.attn_reduce_factor = None
|
| 930 |
+
self.head_attn_reduce_factor = None
|
| 931 |
+
self.effective_sparsity = None
|
| 932 |
+
self.min_sparse_index = None
|
| 933 |
+
self.pred_hid_size = self.hidden_size
|
| 934 |
+
self.num_tok_per_page = None
|
| 935 |
+
self.calc_hitrates = False
|
| 936 |
+
self.flash_attn = False
|
| 937 |
+
self.train_headpredictor = False
|
| 938 |
+
self.calibrate_thresholds = False
|
| 939 |
+
self.test_with_thresholds = False
|
| 940 |
+
self.old_predictor = None
|
| 941 |
+
|
| 942 |
+
if self.layer_idx > 0:
|
| 943 |
+
self.mseloss = MSELoss(reduction='none')
|
| 944 |
+
self.msemagn_loss = None
|
| 945 |
+
self.headmseloss = MSELoss(reduction='none')
|
| 946 |
+
self.headmsemagn_loss = None
|
| 947 |
+
|
| 948 |
+
if self.producer is None: # This is the producer layer
|
| 949 |
+
self.q_importance = None # Shared mask across layers during inference
|
| 950 |
+
self.k_importance = None
|
| 951 |
+
self.head_importances = None
|
| 952 |
+
self.actmagn_masklist = {}
|
| 953 |
+
self.available_tokens = {}
|
| 954 |
+
|
| 955 |
+
# Attention setup
|
| 956 |
+
self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=config.attention_bias)
|
| 957 |
+
self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=config.attention_bias)
|
| 958 |
+
self.v_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=config.attention_bias)
|
| 959 |
+
self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=config.attention_bias)
|
| 960 |
+
self._init_rope()
|
| 961 |
+
|
| 962 |
+
def update_predictor(self):
|
| 963 |
+
self.sparse_token_predictor = TokenImportancePredictorAttentive(
|
| 964 |
+
self.config, self.pred_hid_size, self.num_heads, self.num_layers_pred, dropout=0.1, dDash = self.dDash, \
|
| 965 |
+
intdim = self.intdim, attn_reduce_factor=self.attn_reduce_factor
|
| 966 |
+
).to('cuda:0')
|
| 967 |
+
self.sparse_token_predictor.flash_attn = self.flash_attn
|
| 968 |
+
if self.train_headpredictor:
|
| 969 |
+
self.sparse_head_predictor = HeadImportancePredictor(
|
| 970 |
+
self.config, self.pred_hid_size, self.num_heads, self.num_layers_pred, dropout=0.1, dDash = self.dDash, \
|
| 971 |
+
intdim = self.intdim, attn_reduce_factor=self.head_attn_reduce_factor
|
| 972 |
+
).to('cuda:0')
|
| 973 |
+
self.sparse_head_predictor.flash_attn = self.flash_attn
|
| 974 |
+
|
| 975 |
+
def set_token_sparsity(self):
|
| 976 |
+
assert self.token_sparse_method is not None, "Set token sparse method first!"
|
| 977 |
+
if self.token_sparse_method is not None:
|
| 978 |
+
try:
|
| 979 |
+
mname = self.config._name_or_path.split("/")[-1]
|
| 980 |
+
read_path = f"threshold_calibs/{mname}/{self.token_sparse_method}.pkl"
|
| 981 |
+
threshold_model_dictionary = torch.load(read_path)
|
| 982 |
+
self.tok_calibration_set = threshold_model_dictionary
|
| 983 |
+
except:
|
| 984 |
+
pass
|
| 985 |
+
if self.token_sparse_method == "LazyLLM":
|
| 986 |
+
if self.layer_idx <= 9:
|
| 987 |
+
self.sparse_aggression = 1
|
| 988 |
+
elif self.layer_idx <= 19:
|
| 989 |
+
self.sparse_aggression = 0.7
|
| 990 |
+
elif self.layer_idx <= 28:
|
| 991 |
+
self.sparse_aggression = 0.4
|
| 992 |
+
else:
|
| 993 |
+
self.sparse_aggression = 0.1
|
| 994 |
+
elif "fixed" in self.token_sparse_method:
|
| 995 |
+
if self.layer_idx == 0:
|
| 996 |
+
self.sparse_aggression = 1
|
| 997 |
+
else:
|
| 998 |
+
self.sparse_aggression = 1 - float(self.token_sparse_method.split("_")[1].split("pc")[0])/100.
|
| 999 |
+
elif "progressive" in self.token_sparse_method:
|
| 1000 |
+
pc_drop = float(self.token_sparse_method.split("_")[1].split("pc")[0])/100.
|
| 1001 |
+
self.sparse_aggression = (1 - pc_drop) ** (self.layer_idx) # (x% per layer, progressive_xpc style)
|
| 1002 |
+
else:
|
| 1003 |
+
raise ValueError(f"Unknown token sparsity method {self.token_sparse_method}")
|
| 1004 |
+
|
| 1005 |
+
|
| 1006 |
+
def _init_rope(self):
|
| 1007 |
+
if self.config.rope_scaling is None:
|
| 1008 |
+
self.rotary_emb = LlamaRotaryEmbedding(
|
| 1009 |
+
self.config
|
| 1010 |
+
)
|
| 1011 |
+
else:
|
| 1012 |
+
scaling_type = self.config.rope_scaling.get("type") or self.config.rope_scaling.get("rope_type")
|
| 1013 |
+
scaling_factor = self.config.rope_scaling["factor"]
|
| 1014 |
+
if scaling_type == "linear" or scaling_type == 'llama3':
|
| 1015 |
+
self.rotary_emb = LlamaLinearScalingRotaryEmbedding(
|
| 1016 |
+
self.head_dim,
|
| 1017 |
+
max_position_embeddings=self.max_position_embeddings,
|
| 1018 |
+
scaling_factor=scaling_factor,
|
| 1019 |
+
base=self.rope_theta,
|
| 1020 |
+
config=self.config
|
| 1021 |
+
)
|
| 1022 |
+
elif scaling_type == "dynamic":
|
| 1023 |
+
self.rotary_emb = LlamaDynamicNTKScalingRotaryEmbedding(
|
| 1024 |
+
self.head_dim,
|
| 1025 |
+
max_position_embeddings=self.max_position_embeddings,
|
| 1026 |
+
scaling_factor=scaling_factor,
|
| 1027 |
+
base=self.rope_theta,
|
| 1028 |
+
config=self.config
|
| 1029 |
+
)
|
| 1030 |
+
else:
|
| 1031 |
+
raise ValueError(f"Unknown RoPE scaling type {scaling_type}")
|
| 1032 |
+
|
| 1033 |
+
def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
|
| 1034 |
+
return tensor.view(bsz, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
|
| 1035 |
+
|
| 1036 |
+
def forward(
|
| 1037 |
+
self,
|
| 1038 |
+
hidden_states: torch.Tensor,
|
| 1039 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 1040 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 1041 |
+
past_key_value: Optional[Union[DynamicCache, PredictorDynamicCache]] = None,
|
| 1042 |
+
output_attentions: bool = False,
|
| 1043 |
+
use_cache: bool = False,
|
| 1044 |
+
padding_mask: Optional[torch.LongTensor] = None,
|
| 1045 |
+
cache_position: Optional[torch.LongTensor] = None,
|
| 1046 |
+
position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
|
| 1047 |
+
**kwargs,
|
| 1048 |
+
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[PredictorDynamicCache]]:
|
| 1049 |
+
bsz, q_len, _ = hidden_states.size()
|
| 1050 |
+
Ltrack = hidden_states.size(1)
|
| 1051 |
+
|
| 1052 |
+
if self.config.pretraining_tp > 1:
|
| 1053 |
+
key_value_slicing = (self.num_key_value_heads * self.head_dim) // self.config.pretraining_tp
|
| 1054 |
+
query_slices = self.q_proj.weight.split(
|
| 1055 |
+
(self.num_heads * self.head_dim) // self.config.pretraining_tp, dim=0
|
| 1056 |
+
)
|
| 1057 |
+
key_slices = self.k_proj.weight.split(key_value_slicing, dim=0)
|
| 1058 |
+
value_slices = self.v_proj.weight.split(key_value_slicing, dim=0)
|
| 1059 |
+
|
| 1060 |
+
query_states = [F.linear(hidden_states, query_slices[i]) for i in range(self.config.pretraining_tp)]
|
| 1061 |
+
query_states = torch.cat(query_states, dim=-1)
|
| 1062 |
+
|
| 1063 |
+
key_states = [F.linear(hidden_states, key_slices[i]) for i in range(self.config.pretraining_tp)]
|
| 1064 |
+
key_states = torch.cat(key_states, dim=-1)
|
| 1065 |
+
|
| 1066 |
+
value_states = [F.linear(hidden_states, value_slices[i]) for i in range(self.config.pretraining_tp)]
|
| 1067 |
+
value_states = torch.cat(value_states, dim=-1)
|
| 1068 |
+
else:
|
| 1069 |
+
query_states = self.q_proj(hidden_states)
|
| 1070 |
+
key_states = self.k_proj(hidden_states)
|
| 1071 |
+
value_states = self.v_proj(hidden_states)
|
| 1072 |
+
|
| 1073 |
+
evalmode = self.eval_llm_mode
|
| 1074 |
+
num_tokens_to_keep = int(q_len * self.sparse_aggression)
|
| 1075 |
+
query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
| 1076 |
+
key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
| 1077 |
+
value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
| 1078 |
+
|
| 1079 |
+
# cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len) # AHMED: Modified this to use the newer version.
|
| 1080 |
+
cos, sin = position_embeddings
|
| 1081 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
|
| 1082 |
+
|
| 1083 |
+
if use_cache:
|
| 1084 |
+
key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx)
|
| 1085 |
+
|
| 1086 |
+
kv_seq_len = key_states.shape[-2]
|
| 1087 |
+
final_mask = None
|
| 1088 |
+
|
| 1089 |
+
key_states = repeat_kv(key_states, self.num_key_value_groups)
|
| 1090 |
+
value_states = repeat_kv(value_states, self.num_key_value_groups)
|
| 1091 |
+
|
| 1092 |
+
key_len = key_states.size(2)
|
| 1093 |
+
bsz, q_len = query_states.size(0), query_states.size(2)
|
| 1094 |
+
|
| 1095 |
+
if attention_mask is None:
|
| 1096 |
+
# We want a [q_len, kv_seq_len] boolean upper-triangular mask
|
| 1097 |
+
causal_mask_2d = torch.ones(q_len, kv_seq_len,
|
| 1098 |
+
device=hidden_states.device,
|
| 1099 |
+
dtype=torch.bool).triu(diagonal=1)
|
| 1100 |
+
# Then shape it to [bsz, 1, q_len, kv_seq_len]
|
| 1101 |
+
causal_mask_4d = causal_mask_2d.unsqueeze(0).expand(bsz, 1, q_len, kv_seq_len)
|
| 1102 |
+
# Now fill -inf where the mask is True
|
| 1103 |
+
attention_mask = torch.full_like(causal_mask_4d, 0, dtype=hidden_states.dtype)
|
| 1104 |
+
if q_len != 1:
|
| 1105 |
+
attention_mask = attention_mask.masked_fill(causal_mask_4d, float("-inf"))
|
| 1106 |
+
|
| 1107 |
+
if self.inference_mode:
|
| 1108 |
+
min_sparse_index = self.min_sparse_index
|
| 1109 |
+
with torch.no_grad():
|
| 1110 |
+
if evalmode == "ExpPred":
|
| 1111 |
+
if self.layer_idx > 0:
|
| 1112 |
+
q_importance_tensor = self.producer.q_importance[:, self.layer_idx % self.producer_frequency, :, :].float().to(query_states.device) # [BH, Lq, D']
|
| 1113 |
+
k_importance_tensor = self.producer.k_importance[:, self.layer_idx % self.producer_frequency, :, :].float().to(key_states.device) # [BH, Lk, D']
|
| 1114 |
+
importance_mask = torch.bmm(q_importance_tensor, k_importance_tensor.transpose(-2, -1)) / math.sqrt(self.dDash) # [BH, Lq, Lk]
|
| 1115 |
+
importance_mask = importance_mask.view(bsz, self.num_heads, q_len, key_len) # [B, H, Lq, Lk]
|
| 1116 |
+
attn_weights = torch.matmul(query_states, key_states.transpose(-2, -1)) / math.sqrt(self.head_dim)
|
| 1117 |
+
if self.calc_hitrates:
|
| 1118 |
+
self.tok_hit_acc, self.tok_mean_rank_corr, self.tok_max_rank_corr = calculate_hit_metrics(
|
| 1119 |
+
estimated_importance=importance_mask,
|
| 1120 |
+
true_importance=attn_weights,
|
| 1121 |
+
top_k_ratio=0.5
|
| 1122 |
+
)
|
| 1123 |
+
if self.calibrate_thresholds:
|
| 1124 |
+
### Threshold variance investigation
|
| 1125 |
+
unadj_importance_mask = importance_mask.clone()
|
| 1126 |
+
importance_mask = torch.softmax(importance_mask + attention_mask, dim=-1)
|
| 1127 |
+
sorted_indices = torch.argsort(importance_mask, dim=-1, descending=True)
|
| 1128 |
+
sorted_indices = sorted_indices[:, :, -q_len:, :]
|
| 1129 |
+
sorted_values, sorted_ix = torch.sort(importance_mask, dim=-1)
|
| 1130 |
+
sorted_true_values, _ = torch.sort(torch.gather(unadj_importance_mask, dim=-1, index=sorted_ix), dim=-1)
|
| 1131 |
+
true_thresholds = sorted_true_values[:, :, :, int(importance_mask.size(-1) * self.sparse_aggression)]
|
| 1132 |
+
thresholds = sorted_values[:, :, :, int(importance_mask.size(-1) * self.sparse_aggression)]
|
| 1133 |
+
self.true_threshmean = true_thresholds
|
| 1134 |
+
self.threshmean = thresholds
|
| 1135 |
+
if self.test_with_thresholds:
|
| 1136 |
+
unadj_importance_mask = importance_mask.clone()
|
| 1137 |
+
perhead_thresholds = self.tok_calibration_set[self.layer_idx - 1].to(unadj_importance_mask.device) # 0 does not have calibration data.
|
| 1138 |
+
mask_tensor = threshold_to_mask(unadj_importance_mask, perhead_thresholds, min_sparse_index, bsz, q_len, key_len)
|
| 1139 |
+
else:
|
| 1140 |
+
importance_mask = torch.softmax(importance_mask + attention_mask, dim=-1)
|
| 1141 |
+
sorted_indices = torch.argsort(importance_mask, dim=-1, descending=True)
|
| 1142 |
+
sorted_indices = sorted_indices[:, :, -q_len:, :]
|
| 1143 |
+
mask_tensor = sorted_index_to_mask(sorted_indices, attention_mask, min_sparse_index, bsz, q_len, key_len, self.sparse_aggression, self.sliding_window)
|
| 1144 |
+
### Threshold variance investigation
|
| 1145 |
+
if self.sliding_window is not None:
|
| 1146 |
+
if not hasattr(self, "window_cache"):
|
| 1147 |
+
self.window_cache = SlidingWindowCache(max_seq_len=1024,
|
| 1148 |
+
sliding_window=self.sliding_window,
|
| 1149 |
+
device=mask_tensor.device)
|
| 1150 |
+
window = self.window_cache.get_window(q_len, key_len)
|
| 1151 |
+
mask_tensor = enforce_sliding_window(mask_tensor, window)
|
| 1152 |
+
final_mask = mask_tensor
|
| 1153 |
+
|
| 1154 |
+
self.final_mask_investigate = final_mask
|
| 1155 |
+
attn_weights = attn_weights + mask_tensor + attention_mask
|
| 1156 |
+
else:
|
| 1157 |
+
attn_weights = torch.matmul(query_states, key_states.transpose(-2, -1)) / math.sqrt(self.head_dim)
|
| 1158 |
+
attn_weights = attn_weights + attention_mask
|
| 1159 |
+
else:
|
| 1160 |
+
raise ValueError(f"Unknown eval mode {evalmode}")
|
| 1161 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(value_states.dtype)
|
| 1162 |
+
attn_output = torch.matmul(attn_weights, value_states)
|
| 1163 |
+
|
| 1164 |
+
else:
|
| 1165 |
+
attn_weights = torch.matmul(query_states, key_states.transpose(-2, -1)) / math.sqrt(self.head_dim)
|
| 1166 |
+
if self.layer_idx > 0:
|
| 1167 |
+
q_importance_tensor = self.producer.q_importance[:, self.layer_idx % self.producer_frequency, :, :].float().to(query_states.device) # [BH, Lq, D']
|
| 1168 |
+
k_importance_tensor = self.producer.k_importance[:, self.layer_idx % self.producer_frequency, :, :].float().to(key_states.device) # [BH, Lk, D']
|
| 1169 |
+
importance_mask = torch.bmm(q_importance_tensor, k_importance_tensor.transpose(-2, -1)) / math.sqrt(self.dDash) # [BH, Lq, Lk]
|
| 1170 |
+
importance_mask = importance_mask.view(bsz, self.num_heads, q_len, key_len) # [B, H, Lq, Lk]
|
| 1171 |
+
|
| 1172 |
+
if self.lookahead == 0:
|
| 1173 |
+
self.msemagn_loss = self.mseloss(attn_weights, importance_mask)
|
| 1174 |
+
else:
|
| 1175 |
+
self.msemagn_loss = self.mseloss(attn_weights[:, :, self.lookahead:, :], importance_mask[:, :, :-self.lookahead, :])
|
| 1176 |
+
self.msemagn_loss = (self.msemagn_loss).mean(dim=(-1, -2))
|
| 1177 |
+
self.msemagn_loss = self.msemagn_loss.mean()
|
| 1178 |
+
|
| 1179 |
+
if self.calc_hitrates:
|
| 1180 |
+
self.tok_hit_acc, self.tok_mean_rank_corr, self.tok_max_rank_corr = calculate_hit_metrics(
|
| 1181 |
+
estimated_importance=importance_mask,
|
| 1182 |
+
true_importance=attn_weights,
|
| 1183 |
+
top_k_ratio=0.5
|
| 1184 |
+
)
|
| 1185 |
+
|
| 1186 |
+
if attention_mask is not None:
|
| 1187 |
+
attn_weights = attn_weights + attention_mask
|
| 1188 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(value_states.dtype)
|
| 1189 |
+
attn_output = torch.matmul(attn_weights, value_states)
|
| 1190 |
+
|
| 1191 |
+
if self.layer_idx > 0 and self.train_headpredictor:
|
| 1192 |
+
head_importance_tensor = self.producer.head_importances[:, :, :, self.layer_idx % self.producer_frequency].float().to(attn_output.device)
|
| 1193 |
+
attn_head_weights = attn_output.mean(dim=-1).permute(0, 2, 1)
|
| 1194 |
+
self.headmsemagn_loss = self.headmseloss(attn_head_weights, head_importance_tensor).mean()
|
| 1195 |
+
|
| 1196 |
+
if self.calc_hitrates:
|
| 1197 |
+
self.head_hit_acc, self.head_mean_rank_corr, self.head_max_rank_corr = calculate_hit_metrics(
|
| 1198 |
+
estimated_importance=head_importance_tensor,
|
| 1199 |
+
true_importance=attn_head_weights,
|
| 1200 |
+
top_k_ratio=0.5
|
| 1201 |
+
)
|
| 1202 |
+
else:
|
| 1203 |
+
self.headmsemagn_loss = 0
|
| 1204 |
+
if self.calc_hitrates:
|
| 1205 |
+
self.head_hit_acc, self.head_mean_rank_corr, self.head_max_rank_corr = 0, 0, 0
|
| 1206 |
+
|
| 1207 |
+
|
| 1208 |
+
checkeverytime = hasattr(self, 'test_with_thresholds')
|
| 1209 |
+
if checkeverytime:
|
| 1210 |
+
checkeverytime = self.test_with_thresholds
|
| 1211 |
+
if final_mask is not None:
|
| 1212 |
+
if self.effective_sparsity is None or checkeverytime:
|
| 1213 |
+
true_mask = final_mask + attention_mask
|
| 1214 |
+
num_deact = true_mask.bool().sum(dim=-1) # Number of tokens disabled.
|
| 1215 |
+
causally_deact = (attention_mask.bool()).sum(dim=-1).expand_as(num_deact) # Number of tokens disabled causally anyway
|
| 1216 |
+
additional_deact = (num_deact - causally_deact)
|
| 1217 |
+
num_active = (~attention_mask.bool()).sum(dim=-1).expand_as(num_deact) # Number of tokens active at this position if zero-sparsity
|
| 1218 |
+
effective_sparsity = 100 * (additional_deact.float() / num_active.float()).mean().item()
|
| 1219 |
+
self.effective_sparsity = effective_sparsity
|
| 1220 |
+
print("Effective Sparsity:", effective_sparsity, "%\t Sequence Length:", q_len)
|
| 1221 |
+
if self.layer_idx == 0:
|
| 1222 |
+
if self.effective_sparsity is None:
|
| 1223 |
+
self.effective_sparsity = 0.0
|
| 1224 |
+
|
| 1225 |
+
attn_output = attn_output.transpose(1, 2).contiguous()
|
| 1226 |
+
attn_output = attn_output.view(bsz, -1, self.hidden_size)
|
| 1227 |
+
|
| 1228 |
+
if self.config.pretraining_tp > 1:
|
| 1229 |
+
attn_output = attn_output.split(self.hidden_size // self.config.pretraining_tp, dim=2)
|
| 1230 |
+
o_proj_slices = self.o_proj.weight.split(self.hidden_size // self.config.pretraining_tp, dim=1)
|
| 1231 |
+
attn_output = sum([F.linear(attn_output[i], o_proj_slices[i]) for i in range(self.config.pretraining_tp)])
|
| 1232 |
+
else:
|
| 1233 |
+
attn_output = self.o_proj(attn_output)
|
| 1234 |
+
|
| 1235 |
+
if self.producer is None:
|
| 1236 |
+
try:
|
| 1237 |
+
q_importance, k_importance = self.sparse_token_predictor(
|
| 1238 |
+
hidden_states,
|
| 1239 |
+
attention_mask=attention_mask,
|
| 1240 |
+
position_ids=position_ids,
|
| 1241 |
+
past_key_value=past_key_value, # the same single cache
|
| 1242 |
+
use_cache=use_cache,
|
| 1243 |
+
layer_idx=self.layer_idx, # or pass 0
|
| 1244 |
+
)
|
| 1245 |
+
if self.train_headpredictor:
|
| 1246 |
+
head_importances, past_key_value_hp = self.sparse_head_predictor(
|
| 1247 |
+
hidden_states,
|
| 1248 |
+
attention_mask=attention_mask,
|
| 1249 |
+
position_ids=position_ids,
|
| 1250 |
+
past_key_value=past_key_value_hp,
|
| 1251 |
+
use_cache=use_cache
|
| 1252 |
+
)
|
| 1253 |
+
head_importances = head_importances.view(bsz, q_len, self.num_heads, self.num_hidden_layers) # [B L H N]
|
| 1254 |
+
q_len = attn_output.size(1)
|
| 1255 |
+
k_len = k_importance.size(-1)
|
| 1256 |
+
except:
|
| 1257 |
+
print(traceback.format_exc())
|
| 1258 |
+
import pdb; pdb.set_trace()
|
| 1259 |
+
|
| 1260 |
+
self.q_importance = q_importance
|
| 1261 |
+
self.k_importance = k_importance
|
| 1262 |
+
|
| 1263 |
+
if self.train_headpredictor:
|
| 1264 |
+
if self.head_importances is None:
|
| 1265 |
+
self.head_importances = head_importances
|
| 1266 |
+
else:
|
| 1267 |
+
self.head_importances = torch.cat([self.head_importances, head_importances], dim=1)
|
| 1268 |
+
|
| 1269 |
+
# if self.layer_idx == 31:
|
| 1270 |
+
# if q_len == 1:
|
| 1271 |
+
# self.dtok += 1
|
| 1272 |
+
# print(f"Primary Key-Value Shape: {past_key_value.predictor_primary_key[0].shape}, Importance: {past_key_value.predictor_importance_key[0].shape}, Tok-Decoded: {self.dtok}")
|
| 1273 |
+
# else:
|
| 1274 |
+
# self.dtok = 0
|
| 1275 |
+
|
| 1276 |
+
if not output_attentions:
|
| 1277 |
+
attn_weights = None
|
| 1278 |
+
return attn_output, attn_weights
|
| 1279 |
+
|
| 1280 |
+
def convert_kvcache_experimental(model, config, producer_frequency):
|
| 1281 |
+
producer_layer = None
|
| 1282 |
+
producer_layer_device = None
|
| 1283 |
+
layer_counter = {'idx': 0}
|
| 1284 |
+
|
| 1285 |
+
def recurse_convert(parent_module):
|
| 1286 |
+
nonlocal producer_layer
|
| 1287 |
+
nonlocal producer_layer_device
|
| 1288 |
+
for name, module in parent_module._modules.items():
|
| 1289 |
+
if len(list(module.children())) > 0:
|
| 1290 |
+
recurse_convert(module)
|
| 1291 |
+
if isinstance(module, LlamaAttention):
|
| 1292 |
+
device = next(module.parameters()).device
|
| 1293 |
+
dtype = next(module.parameters()).dtype
|
| 1294 |
+
if layer_counter['idx'] % producer_frequency == 0:
|
| 1295 |
+
new_module = LlamaAttentionExperimental(config).to(dtype).to(device)
|
| 1296 |
+
producer_layer = new_module
|
| 1297 |
+
producer_layer_device = device
|
| 1298 |
+
else:
|
| 1299 |
+
new_module = LlamaAttentionExperimental(
|
| 1300 |
+
config,
|
| 1301 |
+
producer=producer_layer,
|
| 1302 |
+
layer_idx=layer_counter['idx']
|
| 1303 |
+
).to(dtype).to(device)
|
| 1304 |
+
new_module.load_state_dict(module.state_dict(), strict=False)
|
| 1305 |
+
is_producer = layer_counter['idx'] % producer_frequency == 0
|
| 1306 |
+
if is_producer:
|
| 1307 |
+
print(f"Converted Producer layer '{name}' to LlamaAttentionExperimental at layer index {layer_counter['idx']}")
|
| 1308 |
+
else:
|
| 1309 |
+
print(f"Converted layer '{name}' to LlamaAttentionExperimental at layer index {layer_counter['idx']}")
|
| 1310 |
+
parent_module._modules[name] = new_module
|
| 1311 |
+
layer_counter['idx'] += 1
|
| 1312 |
+
recurse_convert(model)
|
| 1313 |
+
producer_layer = producer_layer.to(producer_layer_device)
|
| 1314 |
+
return model
|
| 1315 |
+
|
| 1316 |
+
|
| 1317 |
+
# ---------------------------------------------------------------------
|
| 1318 |
+
# 1) Custom Config subclass
|
| 1319 |
+
# ---------------------------------------------------------------------
|
| 1320 |
+
class LlamaButlerConfig(LlamaConfig):
|
| 1321 |
+
"""
|
| 1322 |
+
Extends HF's LlamaConfig to hold optional extra parameters for the "Butler" logic.
|
| 1323 |
+
You can store your custom attributes here, so they can be serialized in config.json.
|
| 1324 |
+
"""
|
| 1325 |
+
|
| 1326 |
+
model_type = "llama_butler"
|
| 1327 |
+
|
| 1328 |
+
def __init__(
|
| 1329 |
+
self,
|
| 1330 |
+
eval_llm_mode="ExpPred",
|
| 1331 |
+
token_sparse_method="fixed_50pc",
|
| 1332 |
+
producer_frequency=8,
|
| 1333 |
+
dDash=16,
|
| 1334 |
+
attn_reduce_factor=4,
|
| 1335 |
+
head_attn_reduce_factor=4,
|
| 1336 |
+
intdim=256,
|
| 1337 |
+
flash_attn=False,
|
| 1338 |
+
train_headpredictor=False,
|
| 1339 |
+
min_sparse_index=5,
|
| 1340 |
+
lookahead=0,
|
| 1341 |
+
sliding_window=None,
|
| 1342 |
+
**kwargs
|
| 1343 |
+
):
|
| 1344 |
+
super().__init__(**kwargs)
|
| 1345 |
+
self.eval_llm_mode = eval_llm_mode
|
| 1346 |
+
self.token_sparse_method = token_sparse_method
|
| 1347 |
+
self.producer_frequency = producer_frequency
|
| 1348 |
+
self.dDash = dDash
|
| 1349 |
+
self.attn_reduce_factor = attn_reduce_factor
|
| 1350 |
+
self.head_attn_reduce_factor = head_attn_reduce_factor
|
| 1351 |
+
self.intdim = intdim
|
| 1352 |
+
self.flash_attn = flash_attn
|
| 1353 |
+
self.train_headpredictor = train_headpredictor
|
| 1354 |
+
self.min_sparse_index = min_sparse_index
|
| 1355 |
+
self.lookahead = lookahead
|
| 1356 |
+
self.sliding_window = sliding_window
|
| 1357 |
+
|
| 1358 |
+
|
| 1359 |
+
# ---------------------------------------------------------------------
|
| 1360 |
+
# 2) The main Butler model class
|
| 1361 |
+
# ---------------------------------------------------------------------
|
| 1362 |
+
class LlamaButlerForCausalLM(LlamaForCausalLM):
|
| 1363 |
+
"""
|
| 1364 |
+
A subclass of HF's LlamaForCausalLM that:
|
| 1365 |
+
- Patches each LlamaAttention to your LlamaAttentionExperimental
|
| 1366 |
+
- Sets specialized attributes (eval_llm_mode, etc.)
|
| 1367 |
+
- Overrides _prepare_cache_for_generation to inject PredictorDynamicCache
|
| 1368 |
+
"""
|
| 1369 |
+
|
| 1370 |
+
# Let HF auto-detect this config class from config.json:
|
| 1371 |
+
config_class = LlamaButlerConfig
|
| 1372 |
+
|
| 1373 |
+
def __init__(self, config: LlamaButlerConfig):
|
| 1374 |
+
super().__init__(config)
|
| 1375 |
+
"""
|
| 1376 |
+
HF's LlamaForCausalLM initializes:
|
| 1377 |
+
self.model = LlamaModel(config)
|
| 1378 |
+
self.lm_head = nn.Linear(...)
|
| 1379 |
+
"""
|
| 1380 |
+
|
| 1381 |
+
# 1) Patch the underlying LlamaModel to replace LlamaAttention with LlamaAttentionExperimental
|
| 1382 |
+
self.model = convert_kvcache_experimental(
|
| 1383 |
+
self.model,
|
| 1384 |
+
config,
|
| 1385 |
+
config.producer_frequency
|
| 1386 |
+
)
|
| 1387 |
+
|
| 1388 |
+
# 2) Optionally, set per-module attributes so each LlamaAttentionExperimental knows about them:
|
| 1389 |
+
for module in self.model.modules():
|
| 1390 |
+
if module.__class__.__name__.endswith("AttentionExperimental"):
|
| 1391 |
+
# Set these from your config. Or you can hardcode them if you prefer.
|
| 1392 |
+
module.eval_llm_mode = config.eval_llm_mode
|
| 1393 |
+
module.token_sparse_method = config.token_sparse_method
|
| 1394 |
+
module.set_token_sparsity() # e.g. sets module.sparse_aggression
|
| 1395 |
+
|
| 1396 |
+
module.producer_frequency = config.producer_frequency
|
| 1397 |
+
module.dDash = config.dDash
|
| 1398 |
+
module.attn_reduce_factor = config.attn_reduce_factor
|
| 1399 |
+
module.head_attn_reduce_factor = config.head_attn_reduce_factor
|
| 1400 |
+
module.intdim = config.intdim
|
| 1401 |
+
module.flash_attn = config.flash_attn
|
| 1402 |
+
module.train_headpredictor = config.train_headpredictor
|
| 1403 |
+
module.min_sparse_index = config.min_sparse_index
|
| 1404 |
+
module.lookahead = config.lookahead
|
| 1405 |
+
module.sliding_window = config.sliding_window
|
| 1406 |
+
module.num_layers_pred = config.producer_frequency # example usage
|
| 1407 |
+
|
| 1408 |
+
# If this is a "producer layer" (mod.layer_idx % freq == 0), run update_predictor():
|
| 1409 |
+
if hasattr(module, "layer_idx") and (module.layer_idx % config.producer_frequency == 0):
|
| 1410 |
+
module.update_predictor()
|
| 1411 |
+
|
| 1412 |
+
# 3) Patch the dynamic cache (past_key_values) creation. For your evaluation modes:
|
| 1413 |
+
if config.eval_llm_mode in ["ExpPred", "ReplAttn"]:
|
| 1414 |
+
self._prepare_cache_for_generation = self._patched_prepare_cache_for_generation.__get__(
|
| 1415 |
+
self, self.__class__
|
| 1416 |
+
)
|
| 1417 |
+
|
| 1418 |
+
# -----------------------------------------------------------------
|
| 1419 |
+
# 3) The custom `_prepare_cache_for_generation` override
|
| 1420 |
+
# -----------------------------------------------------------------
|
| 1421 |
+
def _patched_prepare_cache_for_generation(
|
| 1422 |
+
self,
|
| 1423 |
+
generation_config: GenerationConfig,
|
| 1424 |
+
model_kwargs: Dict,
|
| 1425 |
+
*args,
|
| 1426 |
+
**kwargs
|
| 1427 |
+
):
|
| 1428 |
+
"""
|
| 1429 |
+
This override injects a PredictorDynamicCache
|
| 1430 |
+
in place of the standard 'past_key_values'.
|
| 1431 |
+
"""
|
| 1432 |
+
if "past_key_values" not in model_kwargs or model_kwargs["past_key_values"] is None:
|
| 1433 |
+
model_kwargs["past_key_values"] = PredictorDynamicCache()
|
| 1434 |
+
return model_kwargs
|
pytorch_model.bin.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"128000": {
|
| 4 |
+
"content": "<|begin_of_text|>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"128001": {
|
| 12 |
+
"content": "<|end_of_text|>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"128002": {
|
| 20 |
+
"content": "<|reserved_special_token_0|>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"128003": {
|
| 28 |
+
"content": "<|reserved_special_token_1|>",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"128004": {
|
| 36 |
+
"content": "<|finetune_right_pad_id|>",
|
| 37 |
+
"lstrip": false,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
},
|
| 43 |
+
"128005": {
|
| 44 |
+
"content": "<|reserved_special_token_2|>",
|
| 45 |
+
"lstrip": false,
|
| 46 |
+
"normalized": false,
|
| 47 |
+
"rstrip": false,
|
| 48 |
+
"single_word": false,
|
| 49 |
+
"special": true
|
| 50 |
+
},
|
| 51 |
+
"128006": {
|
| 52 |
+
"content": "<|start_header_id|>",
|
| 53 |
+
"lstrip": false,
|
| 54 |
+
"normalized": false,
|
| 55 |
+
"rstrip": false,
|
| 56 |
+
"single_word": false,
|
| 57 |
+
"special": true
|
| 58 |
+
},
|
| 59 |
+
"128007": {
|
| 60 |
+
"content": "<|end_header_id|>",
|
| 61 |
+
"lstrip": false,
|
| 62 |
+
"normalized": false,
|
| 63 |
+
"rstrip": false,
|
| 64 |
+
"single_word": false,
|
| 65 |
+
"special": true
|
| 66 |
+
},
|
| 67 |
+
"128008": {
|
| 68 |
+
"content": "<|eom_id|>",
|
| 69 |
+
"lstrip": false,
|
| 70 |
+
"normalized": false,
|
| 71 |
+
"rstrip": false,
|
| 72 |
+
"single_word": false,
|
| 73 |
+
"special": true
|
| 74 |
+
},
|
| 75 |
+
"128009": {
|
| 76 |
+
"content": "<|eot_id|>",
|
| 77 |
+
"lstrip": false,
|
| 78 |
+
"normalized": false,
|
| 79 |
+
"rstrip": false,
|
| 80 |
+
"single_word": false,
|
| 81 |
+
"special": true
|
| 82 |
+
},
|
| 83 |
+
"128010": {
|
| 84 |
+
"content": "<|python_tag|>",
|
| 85 |
+
"lstrip": false,
|
| 86 |
+
"normalized": false,
|
| 87 |
+
"rstrip": false,
|
| 88 |
+
"single_word": false,
|
| 89 |
+
"special": true
|
| 90 |
+
},
|
| 91 |
+
"128011": {
|
| 92 |
+
"content": "<|reserved_special_token_3|>",
|
| 93 |
+
"lstrip": false,
|
| 94 |
+
"normalized": false,
|
| 95 |
+
"rstrip": false,
|
| 96 |
+
"single_word": false,
|
| 97 |
+
"special": true
|
| 98 |
+
},
|
| 99 |
+
"128012": {
|
| 100 |
+
"content": "<|reserved_special_token_4|>",
|
| 101 |
+
"lstrip": false,
|
| 102 |
+
"normalized": false,
|
| 103 |
+
"rstrip": false,
|
| 104 |
+
"single_word": false,
|
| 105 |
+
"special": true
|
| 106 |
+
},
|
| 107 |
+
"128013": {
|
| 108 |
+
"content": "<|reserved_special_token_5|>",
|
| 109 |
+
"lstrip": false,
|
| 110 |
+
"normalized": false,
|
| 111 |
+
"rstrip": false,
|
| 112 |
+
"single_word": false,
|
| 113 |
+
"special": true
|
| 114 |
+
},
|
| 115 |
+
"128014": {
|
| 116 |
+
"content": "<|reserved_special_token_6|>",
|
| 117 |
+
"lstrip": false,
|
| 118 |
+
"normalized": false,
|
| 119 |
+
"rstrip": false,
|
| 120 |
+
"single_word": false,
|
| 121 |
+
"special": true
|
| 122 |
+
},
|
| 123 |
+
"128015": {
|
| 124 |
+
"content": "<|reserved_special_token_7|>",
|
| 125 |
+
"lstrip": false,
|
| 126 |
+
"normalized": false,
|
| 127 |
+
"rstrip": false,
|
| 128 |
+
"single_word": false,
|
| 129 |
+
"special": true
|
| 130 |
+
},
|
| 131 |
+
"128016": {
|
| 132 |
+
"content": "<|reserved_special_token_8|>",
|
| 133 |
+
"lstrip": false,
|
| 134 |
+
"normalized": false,
|
| 135 |
+
"rstrip": false,
|
| 136 |
+
"single_word": false,
|
| 137 |
+
"special": true
|
| 138 |
+
},
|
| 139 |
+
"128017": {
|
| 140 |
+
"content": "<|reserved_special_token_9|>",
|
| 141 |
+
"lstrip": false,
|
| 142 |
+
"normalized": false,
|
| 143 |
+
"rstrip": false,
|
| 144 |
+
"single_word": false,
|
| 145 |
+
"special": true
|
| 146 |
+
},
|
| 147 |
+
"128018": {
|
| 148 |
+
"content": "<|reserved_special_token_10|>",
|
| 149 |
+
"lstrip": false,
|
| 150 |
+
"normalized": false,
|
| 151 |
+
"rstrip": false,
|
| 152 |
+
"single_word": false,
|
| 153 |
+
"special": true
|
| 154 |
+
},
|
| 155 |
+
"128019": {
|
| 156 |
+
"content": "<|reserved_special_token_11|>",
|
| 157 |
+
"lstrip": false,
|
| 158 |
+
"normalized": false,
|
| 159 |
+
"rstrip": false,
|
| 160 |
+
"single_word": false,
|
| 161 |
+
"special": true
|
| 162 |
+
},
|
| 163 |
+
"128020": {
|
| 164 |
+
"content": "<|reserved_special_token_12|>",
|
| 165 |
+
"lstrip": false,
|
| 166 |
+
"normalized": false,
|
| 167 |
+
"rstrip": false,
|
| 168 |
+
"single_word": false,
|
| 169 |
+
"special": true
|
| 170 |
+
},
|
| 171 |
+
"128021": {
|
| 172 |
+
"content": "<|reserved_special_token_13|>",
|
| 173 |
+
"lstrip": false,
|
| 174 |
+
"normalized": false,
|
| 175 |
+
"rstrip": false,
|
| 176 |
+
"single_word": false,
|
| 177 |
+
"special": true
|
| 178 |
+
},
|
| 179 |
+
"128022": {
|
| 180 |
+
"content": "<|reserved_special_token_14|>",
|
| 181 |
+
"lstrip": false,
|
| 182 |
+
"normalized": false,
|
| 183 |
+
"rstrip": false,
|
| 184 |
+
"single_word": false,
|
| 185 |
+
"special": true
|
| 186 |
+
},
|
| 187 |
+
"128023": {
|
| 188 |
+
"content": "<|reserved_special_token_15|>",
|
| 189 |
+
"lstrip": false,
|
| 190 |
+
"normalized": false,
|
| 191 |
+
"rstrip": false,
|
| 192 |
+
"single_word": false,
|
| 193 |
+
"special": true
|
| 194 |
+
},
|
| 195 |
+
"128024": {
|
| 196 |
+
"content": "<|reserved_special_token_16|>",
|
| 197 |
+
"lstrip": false,
|
| 198 |
+
"normalized": false,
|
| 199 |
+
"rstrip": false,
|
| 200 |
+
"single_word": false,
|
| 201 |
+
"special": true
|
| 202 |
+
},
|
| 203 |
+
"128025": {
|
| 204 |
+
"content": "<|reserved_special_token_17|>",
|
| 205 |
+
"lstrip": false,
|
| 206 |
+
"normalized": false,
|
| 207 |
+
"rstrip": false,
|
| 208 |
+
"single_word": false,
|
| 209 |
+
"special": true
|
| 210 |
+
},
|
| 211 |
+
"128026": {
|
| 212 |
+
"content": "<|reserved_special_token_18|>",
|
| 213 |
+
"lstrip": false,
|
| 214 |
+
"normalized": false,
|
| 215 |
+
"rstrip": false,
|
| 216 |
+
"single_word": false,
|
| 217 |
+
"special": true
|
| 218 |
+
},
|
| 219 |
+
"128027": {
|
| 220 |
+
"content": "<|reserved_special_token_19|>",
|
| 221 |
+
"lstrip": false,
|
| 222 |
+
"normalized": false,
|
| 223 |
+
"rstrip": false,
|
| 224 |
+
"single_word": false,
|
| 225 |
+
"special": true
|
| 226 |
+
},
|
| 227 |
+
"128028": {
|
| 228 |
+
"content": "<|reserved_special_token_20|>",
|
| 229 |
+
"lstrip": false,
|
| 230 |
+
"normalized": false,
|
| 231 |
+
"rstrip": false,
|
| 232 |
+
"single_word": false,
|
| 233 |
+
"special": true
|
| 234 |
+
},
|
| 235 |
+
"128029": {
|
| 236 |
+
"content": "<|reserved_special_token_21|>",
|
| 237 |
+
"lstrip": false,
|
| 238 |
+
"normalized": false,
|
| 239 |
+
"rstrip": false,
|
| 240 |
+
"single_word": false,
|
| 241 |
+
"special": true
|
| 242 |
+
},
|
| 243 |
+
"128030": {
|
| 244 |
+
"content": "<|reserved_special_token_22|>",
|
| 245 |
+
"lstrip": false,
|
| 246 |
+
"normalized": false,
|
| 247 |
+
"rstrip": false,
|
| 248 |
+
"single_word": false,
|
| 249 |
+
"special": true
|
| 250 |
+
},
|
| 251 |
+
"128031": {
|
| 252 |
+
"content": "<|reserved_special_token_23|>",
|
| 253 |
+
"lstrip": false,
|
| 254 |
+
"normalized": false,
|
| 255 |
+
"rstrip": false,
|
| 256 |
+
"single_word": false,
|
| 257 |
+
"special": true
|
| 258 |
+
},
|
| 259 |
+
"128032": {
|
| 260 |
+
"content": "<|reserved_special_token_24|>",
|
| 261 |
+
"lstrip": false,
|
| 262 |
+
"normalized": false,
|
| 263 |
+
"rstrip": false,
|
| 264 |
+
"single_word": false,
|
| 265 |
+
"special": true
|
| 266 |
+
},
|
| 267 |
+
"128033": {
|
| 268 |
+
"content": "<|reserved_special_token_25|>",
|
| 269 |
+
"lstrip": false,
|
| 270 |
+
"normalized": false,
|
| 271 |
+
"rstrip": false,
|
| 272 |
+
"single_word": false,
|
| 273 |
+
"special": true
|
| 274 |
+
},
|
| 275 |
+
"128034": {
|
| 276 |
+
"content": "<|reserved_special_token_26|>",
|
| 277 |
+
"lstrip": false,
|
| 278 |
+
"normalized": false,
|
| 279 |
+
"rstrip": false,
|
| 280 |
+
"single_word": false,
|
| 281 |
+
"special": true
|
| 282 |
+
},
|
| 283 |
+
"128035": {
|
| 284 |
+
"content": "<|reserved_special_token_27|>",
|
| 285 |
+
"lstrip": false,
|
| 286 |
+
"normalized": false,
|
| 287 |
+
"rstrip": false,
|
| 288 |
+
"single_word": false,
|
| 289 |
+
"special": true
|
| 290 |
+
},
|
| 291 |
+
"128036": {
|
| 292 |
+
"content": "<|reserved_special_token_28|>",
|
| 293 |
+
"lstrip": false,
|
| 294 |
+
"normalized": false,
|
| 295 |
+
"rstrip": false,
|
| 296 |
+
"single_word": false,
|
| 297 |
+
"special": true
|
| 298 |
+
},
|
| 299 |
+
"128037": {
|
| 300 |
+
"content": "<|reserved_special_token_29|>",
|
| 301 |
+
"lstrip": false,
|
| 302 |
+
"normalized": false,
|
| 303 |
+
"rstrip": false,
|
| 304 |
+
"single_word": false,
|
| 305 |
+
"special": true
|
| 306 |
+
},
|
| 307 |
+
"128038": {
|
| 308 |
+
"content": "<|reserved_special_token_30|>",
|
| 309 |
+
"lstrip": false,
|
| 310 |
+
"normalized": false,
|
| 311 |
+
"rstrip": false,
|
| 312 |
+
"single_word": false,
|
| 313 |
+
"special": true
|
| 314 |
+
},
|
| 315 |
+
"128039": {
|
| 316 |
+
"content": "<|reserved_special_token_31|>",
|
| 317 |
+
"lstrip": false,
|
| 318 |
+
"normalized": false,
|
| 319 |
+
"rstrip": false,
|
| 320 |
+
"single_word": false,
|
| 321 |
+
"special": true
|
| 322 |
+
},
|
| 323 |
+
"128040": {
|
| 324 |
+
"content": "<|reserved_special_token_32|>",
|
| 325 |
+
"lstrip": false,
|
| 326 |
+
"normalized": false,
|
| 327 |
+
"rstrip": false,
|
| 328 |
+
"single_word": false,
|
| 329 |
+
"special": true
|
| 330 |
+
},
|
| 331 |
+
"128041": {
|
| 332 |
+
"content": "<|reserved_special_token_33|>",
|
| 333 |
+
"lstrip": false,
|
| 334 |
+
"normalized": false,
|
| 335 |
+
"rstrip": false,
|
| 336 |
+
"single_word": false,
|
| 337 |
+
"special": true
|
| 338 |
+
},
|
| 339 |
+
"128042": {
|
| 340 |
+
"content": "<|reserved_special_token_34|>",
|
| 341 |
+
"lstrip": false,
|
| 342 |
+
"normalized": false,
|
| 343 |
+
"rstrip": false,
|
| 344 |
+
"single_word": false,
|
| 345 |
+
"special": true
|
| 346 |
+
},
|
| 347 |
+
"128043": {
|
| 348 |
+
"content": "<|reserved_special_token_35|>",
|
| 349 |
+
"lstrip": false,
|
| 350 |
+
"normalized": false,
|
| 351 |
+
"rstrip": false,
|
| 352 |
+
"single_word": false,
|
| 353 |
+
"special": true
|
| 354 |
+
},
|
| 355 |
+
"128044": {
|
| 356 |
+
"content": "<|reserved_special_token_36|>",
|
| 357 |
+
"lstrip": false,
|
| 358 |
+
"normalized": false,
|
| 359 |
+
"rstrip": false,
|
| 360 |
+
"single_word": false,
|
| 361 |
+
"special": true
|
| 362 |
+
},
|
| 363 |
+
"128045": {
|
| 364 |
+
"content": "<|reserved_special_token_37|>",
|
| 365 |
+
"lstrip": false,
|
| 366 |
+
"normalized": false,
|
| 367 |
+
"rstrip": false,
|
| 368 |
+
"single_word": false,
|
| 369 |
+
"special": true
|
| 370 |
+
},
|
| 371 |
+
"128046": {
|
| 372 |
+
"content": "<|reserved_special_token_38|>",
|
| 373 |
+
"lstrip": false,
|
| 374 |
+
"normalized": false,
|
| 375 |
+
"rstrip": false,
|
| 376 |
+
"single_word": false,
|
| 377 |
+
"special": true
|
| 378 |
+
},
|
| 379 |
+
"128047": {
|
| 380 |
+
"content": "<|reserved_special_token_39|>",
|
| 381 |
+
"lstrip": false,
|
| 382 |
+
"normalized": false,
|
| 383 |
+
"rstrip": false,
|
| 384 |
+
"single_word": false,
|
| 385 |
+
"special": true
|
| 386 |
+
},
|
| 387 |
+
"128048": {
|
| 388 |
+
"content": "<|reserved_special_token_40|>",
|
| 389 |
+
"lstrip": false,
|
| 390 |
+
"normalized": false,
|
| 391 |
+
"rstrip": false,
|
| 392 |
+
"single_word": false,
|
| 393 |
+
"special": true
|
| 394 |
+
},
|
| 395 |
+
"128049": {
|
| 396 |
+
"content": "<|reserved_special_token_41|>",
|
| 397 |
+
"lstrip": false,
|
| 398 |
+
"normalized": false,
|
| 399 |
+
"rstrip": false,
|
| 400 |
+
"single_word": false,
|
| 401 |
+
"special": true
|
| 402 |
+
},
|
| 403 |
+
"128050": {
|
| 404 |
+
"content": "<|reserved_special_token_42|>",
|
| 405 |
+
"lstrip": false,
|
| 406 |
+
"normalized": false,
|
| 407 |
+
"rstrip": false,
|
| 408 |
+
"single_word": false,
|
| 409 |
+
"special": true
|
| 410 |
+
},
|
| 411 |
+
"128051": {
|
| 412 |
+
"content": "<|reserved_special_token_43|>",
|
| 413 |
+
"lstrip": false,
|
| 414 |
+
"normalized": false,
|
| 415 |
+
"rstrip": false,
|
| 416 |
+
"single_word": false,
|
| 417 |
+
"special": true
|
| 418 |
+
},
|
| 419 |
+
"128052": {
|
| 420 |
+
"content": "<|reserved_special_token_44|>",
|
| 421 |
+
"lstrip": false,
|
| 422 |
+
"normalized": false,
|
| 423 |
+
"rstrip": false,
|
| 424 |
+
"single_word": false,
|
| 425 |
+
"special": true
|
| 426 |
+
},
|
| 427 |
+
"128053": {
|
| 428 |
+
"content": "<|reserved_special_token_45|>",
|
| 429 |
+
"lstrip": false,
|
| 430 |
+
"normalized": false,
|
| 431 |
+
"rstrip": false,
|
| 432 |
+
"single_word": false,
|
| 433 |
+
"special": true
|
| 434 |
+
},
|
| 435 |
+
"128054": {
|
| 436 |
+
"content": "<|reserved_special_token_46|>",
|
| 437 |
+
"lstrip": false,
|
| 438 |
+
"normalized": false,
|
| 439 |
+
"rstrip": false,
|
| 440 |
+
"single_word": false,
|
| 441 |
+
"special": true
|
| 442 |
+
},
|
| 443 |
+
"128055": {
|
| 444 |
+
"content": "<|reserved_special_token_47|>",
|
| 445 |
+
"lstrip": false,
|
| 446 |
+
"normalized": false,
|
| 447 |
+
"rstrip": false,
|
| 448 |
+
"single_word": false,
|
| 449 |
+
"special": true
|
| 450 |
+
},
|
| 451 |
+
"128056": {
|
| 452 |
+
"content": "<|reserved_special_token_48|>",
|
| 453 |
+
"lstrip": false,
|
| 454 |
+
"normalized": false,
|
| 455 |
+
"rstrip": false,
|
| 456 |
+
"single_word": false,
|
| 457 |
+
"special": true
|
| 458 |
+
},
|
| 459 |
+
"128057": {
|
| 460 |
+
"content": "<|reserved_special_token_49|>",
|
| 461 |
+
"lstrip": false,
|
| 462 |
+
"normalized": false,
|
| 463 |
+
"rstrip": false,
|
| 464 |
+
"single_word": false,
|
| 465 |
+
"special": true
|
| 466 |
+
},
|
| 467 |
+
"128058": {
|
| 468 |
+
"content": "<|reserved_special_token_50|>",
|
| 469 |
+
"lstrip": false,
|
| 470 |
+
"normalized": false,
|
| 471 |
+
"rstrip": false,
|
| 472 |
+
"single_word": false,
|
| 473 |
+
"special": true
|
| 474 |
+
},
|
| 475 |
+
"128059": {
|
| 476 |
+
"content": "<|reserved_special_token_51|>",
|
| 477 |
+
"lstrip": false,
|
| 478 |
+
"normalized": false,
|
| 479 |
+
"rstrip": false,
|
| 480 |
+
"single_word": false,
|
| 481 |
+
"special": true
|
| 482 |
+
},
|
| 483 |
+
"128060": {
|
| 484 |
+
"content": "<|reserved_special_token_52|>",
|
| 485 |
+
"lstrip": false,
|
| 486 |
+
"normalized": false,
|
| 487 |
+
"rstrip": false,
|
| 488 |
+
"single_word": false,
|
| 489 |
+
"special": true
|
| 490 |
+
},
|
| 491 |
+
"128061": {
|
| 492 |
+
"content": "<|reserved_special_token_53|>",
|
| 493 |
+
"lstrip": false,
|
| 494 |
+
"normalized": false,
|
| 495 |
+
"rstrip": false,
|
| 496 |
+
"single_word": false,
|
| 497 |
+
"special": true
|
| 498 |
+
},
|
| 499 |
+
"128062": {
|
| 500 |
+
"content": "<|reserved_special_token_54|>",
|
| 501 |
+
"lstrip": false,
|
| 502 |
+
"normalized": false,
|
| 503 |
+
"rstrip": false,
|
| 504 |
+
"single_word": false,
|
| 505 |
+
"special": true
|
| 506 |
+
},
|
| 507 |
+
"128063": {
|
| 508 |
+
"content": "<|reserved_special_token_55|>",
|
| 509 |
+
"lstrip": false,
|
| 510 |
+
"normalized": false,
|
| 511 |
+
"rstrip": false,
|
| 512 |
+
"single_word": false,
|
| 513 |
+
"special": true
|
| 514 |
+
},
|
| 515 |
+
"128064": {
|
| 516 |
+
"content": "<|reserved_special_token_56|>",
|
| 517 |
+
"lstrip": false,
|
| 518 |
+
"normalized": false,
|
| 519 |
+
"rstrip": false,
|
| 520 |
+
"single_word": false,
|
| 521 |
+
"special": true
|
| 522 |
+
},
|
| 523 |
+
"128065": {
|
| 524 |
+
"content": "<|reserved_special_token_57|>",
|
| 525 |
+
"lstrip": false,
|
| 526 |
+
"normalized": false,
|
| 527 |
+
"rstrip": false,
|
| 528 |
+
"single_word": false,
|
| 529 |
+
"special": true
|
| 530 |
+
},
|
| 531 |
+
"128066": {
|
| 532 |
+
"content": "<|reserved_special_token_58|>",
|
| 533 |
+
"lstrip": false,
|
| 534 |
+
"normalized": false,
|
| 535 |
+
"rstrip": false,
|
| 536 |
+
"single_word": false,
|
| 537 |
+
"special": true
|
| 538 |
+
},
|
| 539 |
+
"128067": {
|
| 540 |
+
"content": "<|reserved_special_token_59|>",
|
| 541 |
+
"lstrip": false,
|
| 542 |
+
"normalized": false,
|
| 543 |
+
"rstrip": false,
|
| 544 |
+
"single_word": false,
|
| 545 |
+
"special": true
|
| 546 |
+
},
|
| 547 |
+
"128068": {
|
| 548 |
+
"content": "<|reserved_special_token_60|>",
|
| 549 |
+
"lstrip": false,
|
| 550 |
+
"normalized": false,
|
| 551 |
+
"rstrip": false,
|
| 552 |
+
"single_word": false,
|
| 553 |
+
"special": true
|
| 554 |
+
},
|
| 555 |
+
"128069": {
|
| 556 |
+
"content": "<|reserved_special_token_61|>",
|
| 557 |
+
"lstrip": false,
|
| 558 |
+
"normalized": false,
|
| 559 |
+
"rstrip": false,
|
| 560 |
+
"single_word": false,
|
| 561 |
+
"special": true
|
| 562 |
+
},
|
| 563 |
+
"128070": {
|
| 564 |
+
"content": "<|reserved_special_token_62|>",
|
| 565 |
+
"lstrip": false,
|
| 566 |
+
"normalized": false,
|
| 567 |
+
"rstrip": false,
|
| 568 |
+
"single_word": false,
|
| 569 |
+
"special": true
|
| 570 |
+
},
|
| 571 |
+
"128071": {
|
| 572 |
+
"content": "<|reserved_special_token_63|>",
|
| 573 |
+
"lstrip": false,
|
| 574 |
+
"normalized": false,
|
| 575 |
+
"rstrip": false,
|
| 576 |
+
"single_word": false,
|
| 577 |
+
"special": true
|
| 578 |
+
},
|
| 579 |
+
"128072": {
|
| 580 |
+
"content": "<|reserved_special_token_64|>",
|
| 581 |
+
"lstrip": false,
|
| 582 |
+
"normalized": false,
|
| 583 |
+
"rstrip": false,
|
| 584 |
+
"single_word": false,
|
| 585 |
+
"special": true
|
| 586 |
+
},
|
| 587 |
+
"128073": {
|
| 588 |
+
"content": "<|reserved_special_token_65|>",
|
| 589 |
+
"lstrip": false,
|
| 590 |
+
"normalized": false,
|
| 591 |
+
"rstrip": false,
|
| 592 |
+
"single_word": false,
|
| 593 |
+
"special": true
|
| 594 |
+
},
|
| 595 |
+
"128074": {
|
| 596 |
+
"content": "<|reserved_special_token_66|>",
|
| 597 |
+
"lstrip": false,
|
| 598 |
+
"normalized": false,
|
| 599 |
+
"rstrip": false,
|
| 600 |
+
"single_word": false,
|
| 601 |
+
"special": true
|
| 602 |
+
},
|
| 603 |
+
"128075": {
|
| 604 |
+
"content": "<|reserved_special_token_67|>",
|
| 605 |
+
"lstrip": false,
|
| 606 |
+
"normalized": false,
|
| 607 |
+
"rstrip": false,
|
| 608 |
+
"single_word": false,
|
| 609 |
+
"special": true
|
| 610 |
+
},
|
| 611 |
+
"128076": {
|
| 612 |
+
"content": "<|reserved_special_token_68|>",
|
| 613 |
+
"lstrip": false,
|
| 614 |
+
"normalized": false,
|
| 615 |
+
"rstrip": false,
|
| 616 |
+
"single_word": false,
|
| 617 |
+
"special": true
|
| 618 |
+
},
|
| 619 |
+
"128077": {
|
| 620 |
+
"content": "<|reserved_special_token_69|>",
|
| 621 |
+
"lstrip": false,
|
| 622 |
+
"normalized": false,
|
| 623 |
+
"rstrip": false,
|
| 624 |
+
"single_word": false,
|
| 625 |
+
"special": true
|
| 626 |
+
},
|
| 627 |
+
"128078": {
|
| 628 |
+
"content": "<|reserved_special_token_70|>",
|
| 629 |
+
"lstrip": false,
|
| 630 |
+
"normalized": false,
|
| 631 |
+
"rstrip": false,
|
| 632 |
+
"single_word": false,
|
| 633 |
+
"special": true
|
| 634 |
+
},
|
| 635 |
+
"128079": {
|
| 636 |
+
"content": "<|reserved_special_token_71|>",
|
| 637 |
+
"lstrip": false,
|
| 638 |
+
"normalized": false,
|
| 639 |
+
"rstrip": false,
|
| 640 |
+
"single_word": false,
|
| 641 |
+
"special": true
|
| 642 |
+
},
|
| 643 |
+
"128080": {
|
| 644 |
+
"content": "<|reserved_special_token_72|>",
|
| 645 |
+
"lstrip": false,
|
| 646 |
+
"normalized": false,
|
| 647 |
+
"rstrip": false,
|
| 648 |
+
"single_word": false,
|
| 649 |
+
"special": true
|
| 650 |
+
},
|
| 651 |
+
"128081": {
|
| 652 |
+
"content": "<|reserved_special_token_73|>",
|
| 653 |
+
"lstrip": false,
|
| 654 |
+
"normalized": false,
|
| 655 |
+
"rstrip": false,
|
| 656 |
+
"single_word": false,
|
| 657 |
+
"special": true
|
| 658 |
+
},
|
| 659 |
+
"128082": {
|
| 660 |
+
"content": "<|reserved_special_token_74|>",
|
| 661 |
+
"lstrip": false,
|
| 662 |
+
"normalized": false,
|
| 663 |
+
"rstrip": false,
|
| 664 |
+
"single_word": false,
|
| 665 |
+
"special": true
|
| 666 |
+
},
|
| 667 |
+
"128083": {
|
| 668 |
+
"content": "<|reserved_special_token_75|>",
|
| 669 |
+
"lstrip": false,
|
| 670 |
+
"normalized": false,
|
| 671 |
+
"rstrip": false,
|
| 672 |
+
"single_word": false,
|
| 673 |
+
"special": true
|
| 674 |
+
},
|
| 675 |
+
"128084": {
|
| 676 |
+
"content": "<|reserved_special_token_76|>",
|
| 677 |
+
"lstrip": false,
|
| 678 |
+
"normalized": false,
|
| 679 |
+
"rstrip": false,
|
| 680 |
+
"single_word": false,
|
| 681 |
+
"special": true
|
| 682 |
+
},
|
| 683 |
+
"128085": {
|
| 684 |
+
"content": "<|reserved_special_token_77|>",
|
| 685 |
+
"lstrip": false,
|
| 686 |
+
"normalized": false,
|
| 687 |
+
"rstrip": false,
|
| 688 |
+
"single_word": false,
|
| 689 |
+
"special": true
|
| 690 |
+
},
|
| 691 |
+
"128086": {
|
| 692 |
+
"content": "<|reserved_special_token_78|>",
|
| 693 |
+
"lstrip": false,
|
| 694 |
+
"normalized": false,
|
| 695 |
+
"rstrip": false,
|
| 696 |
+
"single_word": false,
|
| 697 |
+
"special": true
|
| 698 |
+
},
|
| 699 |
+
"128087": {
|
| 700 |
+
"content": "<|reserved_special_token_79|>",
|
| 701 |
+
"lstrip": false,
|
| 702 |
+
"normalized": false,
|
| 703 |
+
"rstrip": false,
|
| 704 |
+
"single_word": false,
|
| 705 |
+
"special": true
|
| 706 |
+
},
|
| 707 |
+
"128088": {
|
| 708 |
+
"content": "<|reserved_special_token_80|>",
|
| 709 |
+
"lstrip": false,
|
| 710 |
+
"normalized": false,
|
| 711 |
+
"rstrip": false,
|
| 712 |
+
"single_word": false,
|
| 713 |
+
"special": true
|
| 714 |
+
},
|
| 715 |
+
"128089": {
|
| 716 |
+
"content": "<|reserved_special_token_81|>",
|
| 717 |
+
"lstrip": false,
|
| 718 |
+
"normalized": false,
|
| 719 |
+
"rstrip": false,
|
| 720 |
+
"single_word": false,
|
| 721 |
+
"special": true
|
| 722 |
+
},
|
| 723 |
+
"128090": {
|
| 724 |
+
"content": "<|reserved_special_token_82|>",
|
| 725 |
+
"lstrip": false,
|
| 726 |
+
"normalized": false,
|
| 727 |
+
"rstrip": false,
|
| 728 |
+
"single_word": false,
|
| 729 |
+
"special": true
|
| 730 |
+
},
|
| 731 |
+
"128091": {
|
| 732 |
+
"content": "<|reserved_special_token_83|>",
|
| 733 |
+
"lstrip": false,
|
| 734 |
+
"normalized": false,
|
| 735 |
+
"rstrip": false,
|
| 736 |
+
"single_word": false,
|
| 737 |
+
"special": true
|
| 738 |
+
},
|
| 739 |
+
"128092": {
|
| 740 |
+
"content": "<|reserved_special_token_84|>",
|
| 741 |
+
"lstrip": false,
|
| 742 |
+
"normalized": false,
|
| 743 |
+
"rstrip": false,
|
| 744 |
+
"single_word": false,
|
| 745 |
+
"special": true
|
| 746 |
+
},
|
| 747 |
+
"128093": {
|
| 748 |
+
"content": "<|reserved_special_token_85|>",
|
| 749 |
+
"lstrip": false,
|
| 750 |
+
"normalized": false,
|
| 751 |
+
"rstrip": false,
|
| 752 |
+
"single_word": false,
|
| 753 |
+
"special": true
|
| 754 |
+
},
|
| 755 |
+
"128094": {
|
| 756 |
+
"content": "<|reserved_special_token_86|>",
|
| 757 |
+
"lstrip": false,
|
| 758 |
+
"normalized": false,
|
| 759 |
+
"rstrip": false,
|
| 760 |
+
"single_word": false,
|
| 761 |
+
"special": true
|
| 762 |
+
},
|
| 763 |
+
"128095": {
|
| 764 |
+
"content": "<|reserved_special_token_87|>",
|
| 765 |
+
"lstrip": false,
|
| 766 |
+
"normalized": false,
|
| 767 |
+
"rstrip": false,
|
| 768 |
+
"single_word": false,
|
| 769 |
+
"special": true
|
| 770 |
+
},
|
| 771 |
+
"128096": {
|
| 772 |
+
"content": "<|reserved_special_token_88|>",
|
| 773 |
+
"lstrip": false,
|
| 774 |
+
"normalized": false,
|
| 775 |
+
"rstrip": false,
|
| 776 |
+
"single_word": false,
|
| 777 |
+
"special": true
|
| 778 |
+
},
|
| 779 |
+
"128097": {
|
| 780 |
+
"content": "<|reserved_special_token_89|>",
|
| 781 |
+
"lstrip": false,
|
| 782 |
+
"normalized": false,
|
| 783 |
+
"rstrip": false,
|
| 784 |
+
"single_word": false,
|
| 785 |
+
"special": true
|
| 786 |
+
},
|
| 787 |
+
"128098": {
|
| 788 |
+
"content": "<|reserved_special_token_90|>",
|
| 789 |
+
"lstrip": false,
|
| 790 |
+
"normalized": false,
|
| 791 |
+
"rstrip": false,
|
| 792 |
+
"single_word": false,
|
| 793 |
+
"special": true
|
| 794 |
+
},
|
| 795 |
+
"128099": {
|
| 796 |
+
"content": "<|reserved_special_token_91|>",
|
| 797 |
+
"lstrip": false,
|
| 798 |
+
"normalized": false,
|
| 799 |
+
"rstrip": false,
|
| 800 |
+
"single_word": false,
|
| 801 |
+
"special": true
|
| 802 |
+
},
|
| 803 |
+
"128100": {
|
| 804 |
+
"content": "<|reserved_special_token_92|>",
|
| 805 |
+
"lstrip": false,
|
| 806 |
+
"normalized": false,
|
| 807 |
+
"rstrip": false,
|
| 808 |
+
"single_word": false,
|
| 809 |
+
"special": true
|
| 810 |
+
},
|
| 811 |
+
"128101": {
|
| 812 |
+
"content": "<|reserved_special_token_93|>",
|
| 813 |
+
"lstrip": false,
|
| 814 |
+
"normalized": false,
|
| 815 |
+
"rstrip": false,
|
| 816 |
+
"single_word": false,
|
| 817 |
+
"special": true
|
| 818 |
+
},
|
| 819 |
+
"128102": {
|
| 820 |
+
"content": "<|reserved_special_token_94|>",
|
| 821 |
+
"lstrip": false,
|
| 822 |
+
"normalized": false,
|
| 823 |
+
"rstrip": false,
|
| 824 |
+
"single_word": false,
|
| 825 |
+
"special": true
|
| 826 |
+
},
|
| 827 |
+
"128103": {
|
| 828 |
+
"content": "<|reserved_special_token_95|>",
|
| 829 |
+
"lstrip": false,
|
| 830 |
+
"normalized": false,
|
| 831 |
+
"rstrip": false,
|
| 832 |
+
"single_word": false,
|
| 833 |
+
"special": true
|
| 834 |
+
},
|
| 835 |
+
"128104": {
|
| 836 |
+
"content": "<|reserved_special_token_96|>",
|
| 837 |
+
"lstrip": false,
|
| 838 |
+
"normalized": false,
|
| 839 |
+
"rstrip": false,
|
| 840 |
+
"single_word": false,
|
| 841 |
+
"special": true
|
| 842 |
+
},
|
| 843 |
+
"128105": {
|
| 844 |
+
"content": "<|reserved_special_token_97|>",
|
| 845 |
+
"lstrip": false,
|
| 846 |
+
"normalized": false,
|
| 847 |
+
"rstrip": false,
|
| 848 |
+
"single_word": false,
|
| 849 |
+
"special": true
|
| 850 |
+
},
|
| 851 |
+
"128106": {
|
| 852 |
+
"content": "<|reserved_special_token_98|>",
|
| 853 |
+
"lstrip": false,
|
| 854 |
+
"normalized": false,
|
| 855 |
+
"rstrip": false,
|
| 856 |
+
"single_word": false,
|
| 857 |
+
"special": true
|
| 858 |
+
},
|
| 859 |
+
"128107": {
|
| 860 |
+
"content": "<|reserved_special_token_99|>",
|
| 861 |
+
"lstrip": false,
|
| 862 |
+
"normalized": false,
|
| 863 |
+
"rstrip": false,
|
| 864 |
+
"single_word": false,
|
| 865 |
+
"special": true
|
| 866 |
+
},
|
| 867 |
+
"128108": {
|
| 868 |
+
"content": "<|reserved_special_token_100|>",
|
| 869 |
+
"lstrip": false,
|
| 870 |
+
"normalized": false,
|
| 871 |
+
"rstrip": false,
|
| 872 |
+
"single_word": false,
|
| 873 |
+
"special": true
|
| 874 |
+
},
|
| 875 |
+
"128109": {
|
| 876 |
+
"content": "<|reserved_special_token_101|>",
|
| 877 |
+
"lstrip": false,
|
| 878 |
+
"normalized": false,
|
| 879 |
+
"rstrip": false,
|
| 880 |
+
"single_word": false,
|
| 881 |
+
"special": true
|
| 882 |
+
},
|
| 883 |
+
"128110": {
|
| 884 |
+
"content": "<|reserved_special_token_102|>",
|
| 885 |
+
"lstrip": false,
|
| 886 |
+
"normalized": false,
|
| 887 |
+
"rstrip": false,
|
| 888 |
+
"single_word": false,
|
| 889 |
+
"special": true
|
| 890 |
+
},
|
| 891 |
+
"128111": {
|
| 892 |
+
"content": "<|reserved_special_token_103|>",
|
| 893 |
+
"lstrip": false,
|
| 894 |
+
"normalized": false,
|
| 895 |
+
"rstrip": false,
|
| 896 |
+
"single_word": false,
|
| 897 |
+
"special": true
|
| 898 |
+
},
|
| 899 |
+
"128112": {
|
| 900 |
+
"content": "<|reserved_special_token_104|>",
|
| 901 |
+
"lstrip": false,
|
| 902 |
+
"normalized": false,
|
| 903 |
+
"rstrip": false,
|
| 904 |
+
"single_word": false,
|
| 905 |
+
"special": true
|
| 906 |
+
},
|
| 907 |
+
"128113": {
|
| 908 |
+
"content": "<|reserved_special_token_105|>",
|
| 909 |
+
"lstrip": false,
|
| 910 |
+
"normalized": false,
|
| 911 |
+
"rstrip": false,
|
| 912 |
+
"single_word": false,
|
| 913 |
+
"special": true
|
| 914 |
+
},
|
| 915 |
+
"128114": {
|
| 916 |
+
"content": "<|reserved_special_token_106|>",
|
| 917 |
+
"lstrip": false,
|
| 918 |
+
"normalized": false,
|
| 919 |
+
"rstrip": false,
|
| 920 |
+
"single_word": false,
|
| 921 |
+
"special": true
|
| 922 |
+
},
|
| 923 |
+
"128115": {
|
| 924 |
+
"content": "<|reserved_special_token_107|>",
|
| 925 |
+
"lstrip": false,
|
| 926 |
+
"normalized": false,
|
| 927 |
+
"rstrip": false,
|
| 928 |
+
"single_word": false,
|
| 929 |
+
"special": true
|
| 930 |
+
},
|
| 931 |
+
"128116": {
|
| 932 |
+
"content": "<|reserved_special_token_108|>",
|
| 933 |
+
"lstrip": false,
|
| 934 |
+
"normalized": false,
|
| 935 |
+
"rstrip": false,
|
| 936 |
+
"single_word": false,
|
| 937 |
+
"special": true
|
| 938 |
+
},
|
| 939 |
+
"128117": {
|
| 940 |
+
"content": "<|reserved_special_token_109|>",
|
| 941 |
+
"lstrip": false,
|
| 942 |
+
"normalized": false,
|
| 943 |
+
"rstrip": false,
|
| 944 |
+
"single_word": false,
|
| 945 |
+
"special": true
|
| 946 |
+
},
|
| 947 |
+
"128118": {
|
| 948 |
+
"content": "<|reserved_special_token_110|>",
|
| 949 |
+
"lstrip": false,
|
| 950 |
+
"normalized": false,
|
| 951 |
+
"rstrip": false,
|
| 952 |
+
"single_word": false,
|
| 953 |
+
"special": true
|
| 954 |
+
},
|
| 955 |
+
"128119": {
|
| 956 |
+
"content": "<|reserved_special_token_111|>",
|
| 957 |
+
"lstrip": false,
|
| 958 |
+
"normalized": false,
|
| 959 |
+
"rstrip": false,
|
| 960 |
+
"single_word": false,
|
| 961 |
+
"special": true
|
| 962 |
+
},
|
| 963 |
+
"128120": {
|
| 964 |
+
"content": "<|reserved_special_token_112|>",
|
| 965 |
+
"lstrip": false,
|
| 966 |
+
"normalized": false,
|
| 967 |
+
"rstrip": false,
|
| 968 |
+
"single_word": false,
|
| 969 |
+
"special": true
|
| 970 |
+
},
|
| 971 |
+
"128121": {
|
| 972 |
+
"content": "<|reserved_special_token_113|>",
|
| 973 |
+
"lstrip": false,
|
| 974 |
+
"normalized": false,
|
| 975 |
+
"rstrip": false,
|
| 976 |
+
"single_word": false,
|
| 977 |
+
"special": true
|
| 978 |
+
},
|
| 979 |
+
"128122": {
|
| 980 |
+
"content": "<|reserved_special_token_114|>",
|
| 981 |
+
"lstrip": false,
|
| 982 |
+
"normalized": false,
|
| 983 |
+
"rstrip": false,
|
| 984 |
+
"single_word": false,
|
| 985 |
+
"special": true
|
| 986 |
+
},
|
| 987 |
+
"128123": {
|
| 988 |
+
"content": "<|reserved_special_token_115|>",
|
| 989 |
+
"lstrip": false,
|
| 990 |
+
"normalized": false,
|
| 991 |
+
"rstrip": false,
|
| 992 |
+
"single_word": false,
|
| 993 |
+
"special": true
|
| 994 |
+
},
|
| 995 |
+
"128124": {
|
| 996 |
+
"content": "<|reserved_special_token_116|>",
|
| 997 |
+
"lstrip": false,
|
| 998 |
+
"normalized": false,
|
| 999 |
+
"rstrip": false,
|
| 1000 |
+
"single_word": false,
|
| 1001 |
+
"special": true
|
| 1002 |
+
},
|
| 1003 |
+
"128125": {
|
| 1004 |
+
"content": "<|reserved_special_token_117|>",
|
| 1005 |
+
"lstrip": false,
|
| 1006 |
+
"normalized": false,
|
| 1007 |
+
"rstrip": false,
|
| 1008 |
+
"single_word": false,
|
| 1009 |
+
"special": true
|
| 1010 |
+
},
|
| 1011 |
+
"128126": {
|
| 1012 |
+
"content": "<|reserved_special_token_118|>",
|
| 1013 |
+
"lstrip": false,
|
| 1014 |
+
"normalized": false,
|
| 1015 |
+
"rstrip": false,
|
| 1016 |
+
"single_word": false,
|
| 1017 |
+
"special": true
|
| 1018 |
+
},
|
| 1019 |
+
"128127": {
|
| 1020 |
+
"content": "<|reserved_special_token_119|>",
|
| 1021 |
+
"lstrip": false,
|
| 1022 |
+
"normalized": false,
|
| 1023 |
+
"rstrip": false,
|
| 1024 |
+
"single_word": false,
|
| 1025 |
+
"special": true
|
| 1026 |
+
},
|
| 1027 |
+
"128128": {
|
| 1028 |
+
"content": "<|reserved_special_token_120|>",
|
| 1029 |
+
"lstrip": false,
|
| 1030 |
+
"normalized": false,
|
| 1031 |
+
"rstrip": false,
|
| 1032 |
+
"single_word": false,
|
| 1033 |
+
"special": true
|
| 1034 |
+
},
|
| 1035 |
+
"128129": {
|
| 1036 |
+
"content": "<|reserved_special_token_121|>",
|
| 1037 |
+
"lstrip": false,
|
| 1038 |
+
"normalized": false,
|
| 1039 |
+
"rstrip": false,
|
| 1040 |
+
"single_word": false,
|
| 1041 |
+
"special": true
|
| 1042 |
+
},
|
| 1043 |
+
"128130": {
|
| 1044 |
+
"content": "<|reserved_special_token_122|>",
|
| 1045 |
+
"lstrip": false,
|
| 1046 |
+
"normalized": false,
|
| 1047 |
+
"rstrip": false,
|
| 1048 |
+
"single_word": false,
|
| 1049 |
+
"special": true
|
| 1050 |
+
},
|
| 1051 |
+
"128131": {
|
| 1052 |
+
"content": "<|reserved_special_token_123|>",
|
| 1053 |
+
"lstrip": false,
|
| 1054 |
+
"normalized": false,
|
| 1055 |
+
"rstrip": false,
|
| 1056 |
+
"single_word": false,
|
| 1057 |
+
"special": true
|
| 1058 |
+
},
|
| 1059 |
+
"128132": {
|
| 1060 |
+
"content": "<|reserved_special_token_124|>",
|
| 1061 |
+
"lstrip": false,
|
| 1062 |
+
"normalized": false,
|
| 1063 |
+
"rstrip": false,
|
| 1064 |
+
"single_word": false,
|
| 1065 |
+
"special": true
|
| 1066 |
+
},
|
| 1067 |
+
"128133": {
|
| 1068 |
+
"content": "<|reserved_special_token_125|>",
|
| 1069 |
+
"lstrip": false,
|
| 1070 |
+
"normalized": false,
|
| 1071 |
+
"rstrip": false,
|
| 1072 |
+
"single_word": false,
|
| 1073 |
+
"special": true
|
| 1074 |
+
},
|
| 1075 |
+
"128134": {
|
| 1076 |
+
"content": "<|reserved_special_token_126|>",
|
| 1077 |
+
"lstrip": false,
|
| 1078 |
+
"normalized": false,
|
| 1079 |
+
"rstrip": false,
|
| 1080 |
+
"single_word": false,
|
| 1081 |
+
"special": true
|
| 1082 |
+
},
|
| 1083 |
+
"128135": {
|
| 1084 |
+
"content": "<|reserved_special_token_127|>",
|
| 1085 |
+
"lstrip": false,
|
| 1086 |
+
"normalized": false,
|
| 1087 |
+
"rstrip": false,
|
| 1088 |
+
"single_word": false,
|
| 1089 |
+
"special": true
|
| 1090 |
+
},
|
| 1091 |
+
"128136": {
|
| 1092 |
+
"content": "<|reserved_special_token_128|>",
|
| 1093 |
+
"lstrip": false,
|
| 1094 |
+
"normalized": false,
|
| 1095 |
+
"rstrip": false,
|
| 1096 |
+
"single_word": false,
|
| 1097 |
+
"special": true
|
| 1098 |
+
},
|
| 1099 |
+
"128137": {
|
| 1100 |
+
"content": "<|reserved_special_token_129|>",
|
| 1101 |
+
"lstrip": false,
|
| 1102 |
+
"normalized": false,
|
| 1103 |
+
"rstrip": false,
|
| 1104 |
+
"single_word": false,
|
| 1105 |
+
"special": true
|
| 1106 |
+
},
|
| 1107 |
+
"128138": {
|
| 1108 |
+
"content": "<|reserved_special_token_130|>",
|
| 1109 |
+
"lstrip": false,
|
| 1110 |
+
"normalized": false,
|
| 1111 |
+
"rstrip": false,
|
| 1112 |
+
"single_word": false,
|
| 1113 |
+
"special": true
|
| 1114 |
+
},
|
| 1115 |
+
"128139": {
|
| 1116 |
+
"content": "<|reserved_special_token_131|>",
|
| 1117 |
+
"lstrip": false,
|
| 1118 |
+
"normalized": false,
|
| 1119 |
+
"rstrip": false,
|
| 1120 |
+
"single_word": false,
|
| 1121 |
+
"special": true
|
| 1122 |
+
},
|
| 1123 |
+
"128140": {
|
| 1124 |
+
"content": "<|reserved_special_token_132|>",
|
| 1125 |
+
"lstrip": false,
|
| 1126 |
+
"normalized": false,
|
| 1127 |
+
"rstrip": false,
|
| 1128 |
+
"single_word": false,
|
| 1129 |
+
"special": true
|
| 1130 |
+
},
|
| 1131 |
+
"128141": {
|
| 1132 |
+
"content": "<|reserved_special_token_133|>",
|
| 1133 |
+
"lstrip": false,
|
| 1134 |
+
"normalized": false,
|
| 1135 |
+
"rstrip": false,
|
| 1136 |
+
"single_word": false,
|
| 1137 |
+
"special": true
|
| 1138 |
+
},
|
| 1139 |
+
"128142": {
|
| 1140 |
+
"content": "<|reserved_special_token_134|>",
|
| 1141 |
+
"lstrip": false,
|
| 1142 |
+
"normalized": false,
|
| 1143 |
+
"rstrip": false,
|
| 1144 |
+
"single_word": false,
|
| 1145 |
+
"special": true
|
| 1146 |
+
},
|
| 1147 |
+
"128143": {
|
| 1148 |
+
"content": "<|reserved_special_token_135|>",
|
| 1149 |
+
"lstrip": false,
|
| 1150 |
+
"normalized": false,
|
| 1151 |
+
"rstrip": false,
|
| 1152 |
+
"single_word": false,
|
| 1153 |
+
"special": true
|
| 1154 |
+
},
|
| 1155 |
+
"128144": {
|
| 1156 |
+
"content": "<|reserved_special_token_136|>",
|
| 1157 |
+
"lstrip": false,
|
| 1158 |
+
"normalized": false,
|
| 1159 |
+
"rstrip": false,
|
| 1160 |
+
"single_word": false,
|
| 1161 |
+
"special": true
|
| 1162 |
+
},
|
| 1163 |
+
"128145": {
|
| 1164 |
+
"content": "<|reserved_special_token_137|>",
|
| 1165 |
+
"lstrip": false,
|
| 1166 |
+
"normalized": false,
|
| 1167 |
+
"rstrip": false,
|
| 1168 |
+
"single_word": false,
|
| 1169 |
+
"special": true
|
| 1170 |
+
},
|
| 1171 |
+
"128146": {
|
| 1172 |
+
"content": "<|reserved_special_token_138|>",
|
| 1173 |
+
"lstrip": false,
|
| 1174 |
+
"normalized": false,
|
| 1175 |
+
"rstrip": false,
|
| 1176 |
+
"single_word": false,
|
| 1177 |
+
"special": true
|
| 1178 |
+
},
|
| 1179 |
+
"128147": {
|
| 1180 |
+
"content": "<|reserved_special_token_139|>",
|
| 1181 |
+
"lstrip": false,
|
| 1182 |
+
"normalized": false,
|
| 1183 |
+
"rstrip": false,
|
| 1184 |
+
"single_word": false,
|
| 1185 |
+
"special": true
|
| 1186 |
+
},
|
| 1187 |
+
"128148": {
|
| 1188 |
+
"content": "<|reserved_special_token_140|>",
|
| 1189 |
+
"lstrip": false,
|
| 1190 |
+
"normalized": false,
|
| 1191 |
+
"rstrip": false,
|
| 1192 |
+
"single_word": false,
|
| 1193 |
+
"special": true
|
| 1194 |
+
},
|
| 1195 |
+
"128149": {
|
| 1196 |
+
"content": "<|reserved_special_token_141|>",
|
| 1197 |
+
"lstrip": false,
|
| 1198 |
+
"normalized": false,
|
| 1199 |
+
"rstrip": false,
|
| 1200 |
+
"single_word": false,
|
| 1201 |
+
"special": true
|
| 1202 |
+
},
|
| 1203 |
+
"128150": {
|
| 1204 |
+
"content": "<|reserved_special_token_142|>",
|
| 1205 |
+
"lstrip": false,
|
| 1206 |
+
"normalized": false,
|
| 1207 |
+
"rstrip": false,
|
| 1208 |
+
"single_word": false,
|
| 1209 |
+
"special": true
|
| 1210 |
+
},
|
| 1211 |
+
"128151": {
|
| 1212 |
+
"content": "<|reserved_special_token_143|>",
|
| 1213 |
+
"lstrip": false,
|
| 1214 |
+
"normalized": false,
|
| 1215 |
+
"rstrip": false,
|
| 1216 |
+
"single_word": false,
|
| 1217 |
+
"special": true
|
| 1218 |
+
},
|
| 1219 |
+
"128152": {
|
| 1220 |
+
"content": "<|reserved_special_token_144|>",
|
| 1221 |
+
"lstrip": false,
|
| 1222 |
+
"normalized": false,
|
| 1223 |
+
"rstrip": false,
|
| 1224 |
+
"single_word": false,
|
| 1225 |
+
"special": true
|
| 1226 |
+
},
|
| 1227 |
+
"128153": {
|
| 1228 |
+
"content": "<|reserved_special_token_145|>",
|
| 1229 |
+
"lstrip": false,
|
| 1230 |
+
"normalized": false,
|
| 1231 |
+
"rstrip": false,
|
| 1232 |
+
"single_word": false,
|
| 1233 |
+
"special": true
|
| 1234 |
+
},
|
| 1235 |
+
"128154": {
|
| 1236 |
+
"content": "<|reserved_special_token_146|>",
|
| 1237 |
+
"lstrip": false,
|
| 1238 |
+
"normalized": false,
|
| 1239 |
+
"rstrip": false,
|
| 1240 |
+
"single_word": false,
|
| 1241 |
+
"special": true
|
| 1242 |
+
},
|
| 1243 |
+
"128155": {
|
| 1244 |
+
"content": "<|reserved_special_token_147|>",
|
| 1245 |
+
"lstrip": false,
|
| 1246 |
+
"normalized": false,
|
| 1247 |
+
"rstrip": false,
|
| 1248 |
+
"single_word": false,
|
| 1249 |
+
"special": true
|
| 1250 |
+
},
|
| 1251 |
+
"128156": {
|
| 1252 |
+
"content": "<|reserved_special_token_148|>",
|
| 1253 |
+
"lstrip": false,
|
| 1254 |
+
"normalized": false,
|
| 1255 |
+
"rstrip": false,
|
| 1256 |
+
"single_word": false,
|
| 1257 |
+
"special": true
|
| 1258 |
+
},
|
| 1259 |
+
"128157": {
|
| 1260 |
+
"content": "<|reserved_special_token_149|>",
|
| 1261 |
+
"lstrip": false,
|
| 1262 |
+
"normalized": false,
|
| 1263 |
+
"rstrip": false,
|
| 1264 |
+
"single_word": false,
|
| 1265 |
+
"special": true
|
| 1266 |
+
},
|
| 1267 |
+
"128158": {
|
| 1268 |
+
"content": "<|reserved_special_token_150|>",
|
| 1269 |
+
"lstrip": false,
|
| 1270 |
+
"normalized": false,
|
| 1271 |
+
"rstrip": false,
|
| 1272 |
+
"single_word": false,
|
| 1273 |
+
"special": true
|
| 1274 |
+
},
|
| 1275 |
+
"128159": {
|
| 1276 |
+
"content": "<|reserved_special_token_151|>",
|
| 1277 |
+
"lstrip": false,
|
| 1278 |
+
"normalized": false,
|
| 1279 |
+
"rstrip": false,
|
| 1280 |
+
"single_word": false,
|
| 1281 |
+
"special": true
|
| 1282 |
+
},
|
| 1283 |
+
"128160": {
|
| 1284 |
+
"content": "<|reserved_special_token_152|>",
|
| 1285 |
+
"lstrip": false,
|
| 1286 |
+
"normalized": false,
|
| 1287 |
+
"rstrip": false,
|
| 1288 |
+
"single_word": false,
|
| 1289 |
+
"special": true
|
| 1290 |
+
},
|
| 1291 |
+
"128161": {
|
| 1292 |
+
"content": "<|reserved_special_token_153|>",
|
| 1293 |
+
"lstrip": false,
|
| 1294 |
+
"normalized": false,
|
| 1295 |
+
"rstrip": false,
|
| 1296 |
+
"single_word": false,
|
| 1297 |
+
"special": true
|
| 1298 |
+
},
|
| 1299 |
+
"128162": {
|
| 1300 |
+
"content": "<|reserved_special_token_154|>",
|
| 1301 |
+
"lstrip": false,
|
| 1302 |
+
"normalized": false,
|
| 1303 |
+
"rstrip": false,
|
| 1304 |
+
"single_word": false,
|
| 1305 |
+
"special": true
|
| 1306 |
+
},
|
| 1307 |
+
"128163": {
|
| 1308 |
+
"content": "<|reserved_special_token_155|>",
|
| 1309 |
+
"lstrip": false,
|
| 1310 |
+
"normalized": false,
|
| 1311 |
+
"rstrip": false,
|
| 1312 |
+
"single_word": false,
|
| 1313 |
+
"special": true
|
| 1314 |
+
},
|
| 1315 |
+
"128164": {
|
| 1316 |
+
"content": "<|reserved_special_token_156|>",
|
| 1317 |
+
"lstrip": false,
|
| 1318 |
+
"normalized": false,
|
| 1319 |
+
"rstrip": false,
|
| 1320 |
+
"single_word": false,
|
| 1321 |
+
"special": true
|
| 1322 |
+
},
|
| 1323 |
+
"128165": {
|
| 1324 |
+
"content": "<|reserved_special_token_157|>",
|
| 1325 |
+
"lstrip": false,
|
| 1326 |
+
"normalized": false,
|
| 1327 |
+
"rstrip": false,
|
| 1328 |
+
"single_word": false,
|
| 1329 |
+
"special": true
|
| 1330 |
+
},
|
| 1331 |
+
"128166": {
|
| 1332 |
+
"content": "<|reserved_special_token_158|>",
|
| 1333 |
+
"lstrip": false,
|
| 1334 |
+
"normalized": false,
|
| 1335 |
+
"rstrip": false,
|
| 1336 |
+
"single_word": false,
|
| 1337 |
+
"special": true
|
| 1338 |
+
},
|
| 1339 |
+
"128167": {
|
| 1340 |
+
"content": "<|reserved_special_token_159|>",
|
| 1341 |
+
"lstrip": false,
|
| 1342 |
+
"normalized": false,
|
| 1343 |
+
"rstrip": false,
|
| 1344 |
+
"single_word": false,
|
| 1345 |
+
"special": true
|
| 1346 |
+
},
|
| 1347 |
+
"128168": {
|
| 1348 |
+
"content": "<|reserved_special_token_160|>",
|
| 1349 |
+
"lstrip": false,
|
| 1350 |
+
"normalized": false,
|
| 1351 |
+
"rstrip": false,
|
| 1352 |
+
"single_word": false,
|
| 1353 |
+
"special": true
|
| 1354 |
+
},
|
| 1355 |
+
"128169": {
|
| 1356 |
+
"content": "<|reserved_special_token_161|>",
|
| 1357 |
+
"lstrip": false,
|
| 1358 |
+
"normalized": false,
|
| 1359 |
+
"rstrip": false,
|
| 1360 |
+
"single_word": false,
|
| 1361 |
+
"special": true
|
| 1362 |
+
},
|
| 1363 |
+
"128170": {
|
| 1364 |
+
"content": "<|reserved_special_token_162|>",
|
| 1365 |
+
"lstrip": false,
|
| 1366 |
+
"normalized": false,
|
| 1367 |
+
"rstrip": false,
|
| 1368 |
+
"single_word": false,
|
| 1369 |
+
"special": true
|
| 1370 |
+
},
|
| 1371 |
+
"128171": {
|
| 1372 |
+
"content": "<|reserved_special_token_163|>",
|
| 1373 |
+
"lstrip": false,
|
| 1374 |
+
"normalized": false,
|
| 1375 |
+
"rstrip": false,
|
| 1376 |
+
"single_word": false,
|
| 1377 |
+
"special": true
|
| 1378 |
+
},
|
| 1379 |
+
"128172": {
|
| 1380 |
+
"content": "<|reserved_special_token_164|>",
|
| 1381 |
+
"lstrip": false,
|
| 1382 |
+
"normalized": false,
|
| 1383 |
+
"rstrip": false,
|
| 1384 |
+
"single_word": false,
|
| 1385 |
+
"special": true
|
| 1386 |
+
},
|
| 1387 |
+
"128173": {
|
| 1388 |
+
"content": "<|reserved_special_token_165|>",
|
| 1389 |
+
"lstrip": false,
|
| 1390 |
+
"normalized": false,
|
| 1391 |
+
"rstrip": false,
|
| 1392 |
+
"single_word": false,
|
| 1393 |
+
"special": true
|
| 1394 |
+
},
|
| 1395 |
+
"128174": {
|
| 1396 |
+
"content": "<|reserved_special_token_166|>",
|
| 1397 |
+
"lstrip": false,
|
| 1398 |
+
"normalized": false,
|
| 1399 |
+
"rstrip": false,
|
| 1400 |
+
"single_word": false,
|
| 1401 |
+
"special": true
|
| 1402 |
+
},
|
| 1403 |
+
"128175": {
|
| 1404 |
+
"content": "<|reserved_special_token_167|>",
|
| 1405 |
+
"lstrip": false,
|
| 1406 |
+
"normalized": false,
|
| 1407 |
+
"rstrip": false,
|
| 1408 |
+
"single_word": false,
|
| 1409 |
+
"special": true
|
| 1410 |
+
},
|
| 1411 |
+
"128176": {
|
| 1412 |
+
"content": "<|reserved_special_token_168|>",
|
| 1413 |
+
"lstrip": false,
|
| 1414 |
+
"normalized": false,
|
| 1415 |
+
"rstrip": false,
|
| 1416 |
+
"single_word": false,
|
| 1417 |
+
"special": true
|
| 1418 |
+
},
|
| 1419 |
+
"128177": {
|
| 1420 |
+
"content": "<|reserved_special_token_169|>",
|
| 1421 |
+
"lstrip": false,
|
| 1422 |
+
"normalized": false,
|
| 1423 |
+
"rstrip": false,
|
| 1424 |
+
"single_word": false,
|
| 1425 |
+
"special": true
|
| 1426 |
+
},
|
| 1427 |
+
"128178": {
|
| 1428 |
+
"content": "<|reserved_special_token_170|>",
|
| 1429 |
+
"lstrip": false,
|
| 1430 |
+
"normalized": false,
|
| 1431 |
+
"rstrip": false,
|
| 1432 |
+
"single_word": false,
|
| 1433 |
+
"special": true
|
| 1434 |
+
},
|
| 1435 |
+
"128179": {
|
| 1436 |
+
"content": "<|reserved_special_token_171|>",
|
| 1437 |
+
"lstrip": false,
|
| 1438 |
+
"normalized": false,
|
| 1439 |
+
"rstrip": false,
|
| 1440 |
+
"single_word": false,
|
| 1441 |
+
"special": true
|
| 1442 |
+
},
|
| 1443 |
+
"128180": {
|
| 1444 |
+
"content": "<|reserved_special_token_172|>",
|
| 1445 |
+
"lstrip": false,
|
| 1446 |
+
"normalized": false,
|
| 1447 |
+
"rstrip": false,
|
| 1448 |
+
"single_word": false,
|
| 1449 |
+
"special": true
|
| 1450 |
+
},
|
| 1451 |
+
"128181": {
|
| 1452 |
+
"content": "<|reserved_special_token_173|>",
|
| 1453 |
+
"lstrip": false,
|
| 1454 |
+
"normalized": false,
|
| 1455 |
+
"rstrip": false,
|
| 1456 |
+
"single_word": false,
|
| 1457 |
+
"special": true
|
| 1458 |
+
},
|
| 1459 |
+
"128182": {
|
| 1460 |
+
"content": "<|reserved_special_token_174|>",
|
| 1461 |
+
"lstrip": false,
|
| 1462 |
+
"normalized": false,
|
| 1463 |
+
"rstrip": false,
|
| 1464 |
+
"single_word": false,
|
| 1465 |
+
"special": true
|
| 1466 |
+
},
|
| 1467 |
+
"128183": {
|
| 1468 |
+
"content": "<|reserved_special_token_175|>",
|
| 1469 |
+
"lstrip": false,
|
| 1470 |
+
"normalized": false,
|
| 1471 |
+
"rstrip": false,
|
| 1472 |
+
"single_word": false,
|
| 1473 |
+
"special": true
|
| 1474 |
+
},
|
| 1475 |
+
"128184": {
|
| 1476 |
+
"content": "<|reserved_special_token_176|>",
|
| 1477 |
+
"lstrip": false,
|
| 1478 |
+
"normalized": false,
|
| 1479 |
+
"rstrip": false,
|
| 1480 |
+
"single_word": false,
|
| 1481 |
+
"special": true
|
| 1482 |
+
},
|
| 1483 |
+
"128185": {
|
| 1484 |
+
"content": "<|reserved_special_token_177|>",
|
| 1485 |
+
"lstrip": false,
|
| 1486 |
+
"normalized": false,
|
| 1487 |
+
"rstrip": false,
|
| 1488 |
+
"single_word": false,
|
| 1489 |
+
"special": true
|
| 1490 |
+
},
|
| 1491 |
+
"128186": {
|
| 1492 |
+
"content": "<|reserved_special_token_178|>",
|
| 1493 |
+
"lstrip": false,
|
| 1494 |
+
"normalized": false,
|
| 1495 |
+
"rstrip": false,
|
| 1496 |
+
"single_word": false,
|
| 1497 |
+
"special": true
|
| 1498 |
+
},
|
| 1499 |
+
"128187": {
|
| 1500 |
+
"content": "<|reserved_special_token_179|>",
|
| 1501 |
+
"lstrip": false,
|
| 1502 |
+
"normalized": false,
|
| 1503 |
+
"rstrip": false,
|
| 1504 |
+
"single_word": false,
|
| 1505 |
+
"special": true
|
| 1506 |
+
},
|
| 1507 |
+
"128188": {
|
| 1508 |
+
"content": "<|reserved_special_token_180|>",
|
| 1509 |
+
"lstrip": false,
|
| 1510 |
+
"normalized": false,
|
| 1511 |
+
"rstrip": false,
|
| 1512 |
+
"single_word": false,
|
| 1513 |
+
"special": true
|
| 1514 |
+
},
|
| 1515 |
+
"128189": {
|
| 1516 |
+
"content": "<|reserved_special_token_181|>",
|
| 1517 |
+
"lstrip": false,
|
| 1518 |
+
"normalized": false,
|
| 1519 |
+
"rstrip": false,
|
| 1520 |
+
"single_word": false,
|
| 1521 |
+
"special": true
|
| 1522 |
+
},
|
| 1523 |
+
"128190": {
|
| 1524 |
+
"content": "<|reserved_special_token_182|>",
|
| 1525 |
+
"lstrip": false,
|
| 1526 |
+
"normalized": false,
|
| 1527 |
+
"rstrip": false,
|
| 1528 |
+
"single_word": false,
|
| 1529 |
+
"special": true
|
| 1530 |
+
},
|
| 1531 |
+
"128191": {
|
| 1532 |
+
"content": "<|reserved_special_token_183|>",
|
| 1533 |
+
"lstrip": false,
|
| 1534 |
+
"normalized": false,
|
| 1535 |
+
"rstrip": false,
|
| 1536 |
+
"single_word": false,
|
| 1537 |
+
"special": true
|
| 1538 |
+
},
|
| 1539 |
+
"128192": {
|
| 1540 |
+
"content": "<|reserved_special_token_184|>",
|
| 1541 |
+
"lstrip": false,
|
| 1542 |
+
"normalized": false,
|
| 1543 |
+
"rstrip": false,
|
| 1544 |
+
"single_word": false,
|
| 1545 |
+
"special": true
|
| 1546 |
+
},
|
| 1547 |
+
"128193": {
|
| 1548 |
+
"content": "<|reserved_special_token_185|>",
|
| 1549 |
+
"lstrip": false,
|
| 1550 |
+
"normalized": false,
|
| 1551 |
+
"rstrip": false,
|
| 1552 |
+
"single_word": false,
|
| 1553 |
+
"special": true
|
| 1554 |
+
},
|
| 1555 |
+
"128194": {
|
| 1556 |
+
"content": "<|reserved_special_token_186|>",
|
| 1557 |
+
"lstrip": false,
|
| 1558 |
+
"normalized": false,
|
| 1559 |
+
"rstrip": false,
|
| 1560 |
+
"single_word": false,
|
| 1561 |
+
"special": true
|
| 1562 |
+
},
|
| 1563 |
+
"128195": {
|
| 1564 |
+
"content": "<|reserved_special_token_187|>",
|
| 1565 |
+
"lstrip": false,
|
| 1566 |
+
"normalized": false,
|
| 1567 |
+
"rstrip": false,
|
| 1568 |
+
"single_word": false,
|
| 1569 |
+
"special": true
|
| 1570 |
+
},
|
| 1571 |
+
"128196": {
|
| 1572 |
+
"content": "<|reserved_special_token_188|>",
|
| 1573 |
+
"lstrip": false,
|
| 1574 |
+
"normalized": false,
|
| 1575 |
+
"rstrip": false,
|
| 1576 |
+
"single_word": false,
|
| 1577 |
+
"special": true
|
| 1578 |
+
},
|
| 1579 |
+
"128197": {
|
| 1580 |
+
"content": "<|reserved_special_token_189|>",
|
| 1581 |
+
"lstrip": false,
|
| 1582 |
+
"normalized": false,
|
| 1583 |
+
"rstrip": false,
|
| 1584 |
+
"single_word": false,
|
| 1585 |
+
"special": true
|
| 1586 |
+
},
|
| 1587 |
+
"128198": {
|
| 1588 |
+
"content": "<|reserved_special_token_190|>",
|
| 1589 |
+
"lstrip": false,
|
| 1590 |
+
"normalized": false,
|
| 1591 |
+
"rstrip": false,
|
| 1592 |
+
"single_word": false,
|
| 1593 |
+
"special": true
|
| 1594 |
+
},
|
| 1595 |
+
"128199": {
|
| 1596 |
+
"content": "<|reserved_special_token_191|>",
|
| 1597 |
+
"lstrip": false,
|
| 1598 |
+
"normalized": false,
|
| 1599 |
+
"rstrip": false,
|
| 1600 |
+
"single_word": false,
|
| 1601 |
+
"special": true
|
| 1602 |
+
},
|
| 1603 |
+
"128200": {
|
| 1604 |
+
"content": "<|reserved_special_token_192|>",
|
| 1605 |
+
"lstrip": false,
|
| 1606 |
+
"normalized": false,
|
| 1607 |
+
"rstrip": false,
|
| 1608 |
+
"single_word": false,
|
| 1609 |
+
"special": true
|
| 1610 |
+
},
|
| 1611 |
+
"128201": {
|
| 1612 |
+
"content": "<|reserved_special_token_193|>",
|
| 1613 |
+
"lstrip": false,
|
| 1614 |
+
"normalized": false,
|
| 1615 |
+
"rstrip": false,
|
| 1616 |
+
"single_word": false,
|
| 1617 |
+
"special": true
|
| 1618 |
+
},
|
| 1619 |
+
"128202": {
|
| 1620 |
+
"content": "<|reserved_special_token_194|>",
|
| 1621 |
+
"lstrip": false,
|
| 1622 |
+
"normalized": false,
|
| 1623 |
+
"rstrip": false,
|
| 1624 |
+
"single_word": false,
|
| 1625 |
+
"special": true
|
| 1626 |
+
},
|
| 1627 |
+
"128203": {
|
| 1628 |
+
"content": "<|reserved_special_token_195|>",
|
| 1629 |
+
"lstrip": false,
|
| 1630 |
+
"normalized": false,
|
| 1631 |
+
"rstrip": false,
|
| 1632 |
+
"single_word": false,
|
| 1633 |
+
"special": true
|
| 1634 |
+
},
|
| 1635 |
+
"128204": {
|
| 1636 |
+
"content": "<|reserved_special_token_196|>",
|
| 1637 |
+
"lstrip": false,
|
| 1638 |
+
"normalized": false,
|
| 1639 |
+
"rstrip": false,
|
| 1640 |
+
"single_word": false,
|
| 1641 |
+
"special": true
|
| 1642 |
+
},
|
| 1643 |
+
"128205": {
|
| 1644 |
+
"content": "<|reserved_special_token_197|>",
|
| 1645 |
+
"lstrip": false,
|
| 1646 |
+
"normalized": false,
|
| 1647 |
+
"rstrip": false,
|
| 1648 |
+
"single_word": false,
|
| 1649 |
+
"special": true
|
| 1650 |
+
},
|
| 1651 |
+
"128206": {
|
| 1652 |
+
"content": "<|reserved_special_token_198|>",
|
| 1653 |
+
"lstrip": false,
|
| 1654 |
+
"normalized": false,
|
| 1655 |
+
"rstrip": false,
|
| 1656 |
+
"single_word": false,
|
| 1657 |
+
"special": true
|
| 1658 |
+
},
|
| 1659 |
+
"128207": {
|
| 1660 |
+
"content": "<|reserved_special_token_199|>",
|
| 1661 |
+
"lstrip": false,
|
| 1662 |
+
"normalized": false,
|
| 1663 |
+
"rstrip": false,
|
| 1664 |
+
"single_word": false,
|
| 1665 |
+
"special": true
|
| 1666 |
+
},
|
| 1667 |
+
"128208": {
|
| 1668 |
+
"content": "<|reserved_special_token_200|>",
|
| 1669 |
+
"lstrip": false,
|
| 1670 |
+
"normalized": false,
|
| 1671 |
+
"rstrip": false,
|
| 1672 |
+
"single_word": false,
|
| 1673 |
+
"special": true
|
| 1674 |
+
},
|
| 1675 |
+
"128209": {
|
| 1676 |
+
"content": "<|reserved_special_token_201|>",
|
| 1677 |
+
"lstrip": false,
|
| 1678 |
+
"normalized": false,
|
| 1679 |
+
"rstrip": false,
|
| 1680 |
+
"single_word": false,
|
| 1681 |
+
"special": true
|
| 1682 |
+
},
|
| 1683 |
+
"128210": {
|
| 1684 |
+
"content": "<|reserved_special_token_202|>",
|
| 1685 |
+
"lstrip": false,
|
| 1686 |
+
"normalized": false,
|
| 1687 |
+
"rstrip": false,
|
| 1688 |
+
"single_word": false,
|
| 1689 |
+
"special": true
|
| 1690 |
+
},
|
| 1691 |
+
"128211": {
|
| 1692 |
+
"content": "<|reserved_special_token_203|>",
|
| 1693 |
+
"lstrip": false,
|
| 1694 |
+
"normalized": false,
|
| 1695 |
+
"rstrip": false,
|
| 1696 |
+
"single_word": false,
|
| 1697 |
+
"special": true
|
| 1698 |
+
},
|
| 1699 |
+
"128212": {
|
| 1700 |
+
"content": "<|reserved_special_token_204|>",
|
| 1701 |
+
"lstrip": false,
|
| 1702 |
+
"normalized": false,
|
| 1703 |
+
"rstrip": false,
|
| 1704 |
+
"single_word": false,
|
| 1705 |
+
"special": true
|
| 1706 |
+
},
|
| 1707 |
+
"128213": {
|
| 1708 |
+
"content": "<|reserved_special_token_205|>",
|
| 1709 |
+
"lstrip": false,
|
| 1710 |
+
"normalized": false,
|
| 1711 |
+
"rstrip": false,
|
| 1712 |
+
"single_word": false,
|
| 1713 |
+
"special": true
|
| 1714 |
+
},
|
| 1715 |
+
"128214": {
|
| 1716 |
+
"content": "<|reserved_special_token_206|>",
|
| 1717 |
+
"lstrip": false,
|
| 1718 |
+
"normalized": false,
|
| 1719 |
+
"rstrip": false,
|
| 1720 |
+
"single_word": false,
|
| 1721 |
+
"special": true
|
| 1722 |
+
},
|
| 1723 |
+
"128215": {
|
| 1724 |
+
"content": "<|reserved_special_token_207|>",
|
| 1725 |
+
"lstrip": false,
|
| 1726 |
+
"normalized": false,
|
| 1727 |
+
"rstrip": false,
|
| 1728 |
+
"single_word": false,
|
| 1729 |
+
"special": true
|
| 1730 |
+
},
|
| 1731 |
+
"128216": {
|
| 1732 |
+
"content": "<|reserved_special_token_208|>",
|
| 1733 |
+
"lstrip": false,
|
| 1734 |
+
"normalized": false,
|
| 1735 |
+
"rstrip": false,
|
| 1736 |
+
"single_word": false,
|
| 1737 |
+
"special": true
|
| 1738 |
+
},
|
| 1739 |
+
"128217": {
|
| 1740 |
+
"content": "<|reserved_special_token_209|>",
|
| 1741 |
+
"lstrip": false,
|
| 1742 |
+
"normalized": false,
|
| 1743 |
+
"rstrip": false,
|
| 1744 |
+
"single_word": false,
|
| 1745 |
+
"special": true
|
| 1746 |
+
},
|
| 1747 |
+
"128218": {
|
| 1748 |
+
"content": "<|reserved_special_token_210|>",
|
| 1749 |
+
"lstrip": false,
|
| 1750 |
+
"normalized": false,
|
| 1751 |
+
"rstrip": false,
|
| 1752 |
+
"single_word": false,
|
| 1753 |
+
"special": true
|
| 1754 |
+
},
|
| 1755 |
+
"128219": {
|
| 1756 |
+
"content": "<|reserved_special_token_211|>",
|
| 1757 |
+
"lstrip": false,
|
| 1758 |
+
"normalized": false,
|
| 1759 |
+
"rstrip": false,
|
| 1760 |
+
"single_word": false,
|
| 1761 |
+
"special": true
|
| 1762 |
+
},
|
| 1763 |
+
"128220": {
|
| 1764 |
+
"content": "<|reserved_special_token_212|>",
|
| 1765 |
+
"lstrip": false,
|
| 1766 |
+
"normalized": false,
|
| 1767 |
+
"rstrip": false,
|
| 1768 |
+
"single_word": false,
|
| 1769 |
+
"special": true
|
| 1770 |
+
},
|
| 1771 |
+
"128221": {
|
| 1772 |
+
"content": "<|reserved_special_token_213|>",
|
| 1773 |
+
"lstrip": false,
|
| 1774 |
+
"normalized": false,
|
| 1775 |
+
"rstrip": false,
|
| 1776 |
+
"single_word": false,
|
| 1777 |
+
"special": true
|
| 1778 |
+
},
|
| 1779 |
+
"128222": {
|
| 1780 |
+
"content": "<|reserved_special_token_214|>",
|
| 1781 |
+
"lstrip": false,
|
| 1782 |
+
"normalized": false,
|
| 1783 |
+
"rstrip": false,
|
| 1784 |
+
"single_word": false,
|
| 1785 |
+
"special": true
|
| 1786 |
+
},
|
| 1787 |
+
"128223": {
|
| 1788 |
+
"content": "<|reserved_special_token_215|>",
|
| 1789 |
+
"lstrip": false,
|
| 1790 |
+
"normalized": false,
|
| 1791 |
+
"rstrip": false,
|
| 1792 |
+
"single_word": false,
|
| 1793 |
+
"special": true
|
| 1794 |
+
},
|
| 1795 |
+
"128224": {
|
| 1796 |
+
"content": "<|reserved_special_token_216|>",
|
| 1797 |
+
"lstrip": false,
|
| 1798 |
+
"normalized": false,
|
| 1799 |
+
"rstrip": false,
|
| 1800 |
+
"single_word": false,
|
| 1801 |
+
"special": true
|
| 1802 |
+
},
|
| 1803 |
+
"128225": {
|
| 1804 |
+
"content": "<|reserved_special_token_217|>",
|
| 1805 |
+
"lstrip": false,
|
| 1806 |
+
"normalized": false,
|
| 1807 |
+
"rstrip": false,
|
| 1808 |
+
"single_word": false,
|
| 1809 |
+
"special": true
|
| 1810 |
+
},
|
| 1811 |
+
"128226": {
|
| 1812 |
+
"content": "<|reserved_special_token_218|>",
|
| 1813 |
+
"lstrip": false,
|
| 1814 |
+
"normalized": false,
|
| 1815 |
+
"rstrip": false,
|
| 1816 |
+
"single_word": false,
|
| 1817 |
+
"special": true
|
| 1818 |
+
},
|
| 1819 |
+
"128227": {
|
| 1820 |
+
"content": "<|reserved_special_token_219|>",
|
| 1821 |
+
"lstrip": false,
|
| 1822 |
+
"normalized": false,
|
| 1823 |
+
"rstrip": false,
|
| 1824 |
+
"single_word": false,
|
| 1825 |
+
"special": true
|
| 1826 |
+
},
|
| 1827 |
+
"128228": {
|
| 1828 |
+
"content": "<|reserved_special_token_220|>",
|
| 1829 |
+
"lstrip": false,
|
| 1830 |
+
"normalized": false,
|
| 1831 |
+
"rstrip": false,
|
| 1832 |
+
"single_word": false,
|
| 1833 |
+
"special": true
|
| 1834 |
+
},
|
| 1835 |
+
"128229": {
|
| 1836 |
+
"content": "<|reserved_special_token_221|>",
|
| 1837 |
+
"lstrip": false,
|
| 1838 |
+
"normalized": false,
|
| 1839 |
+
"rstrip": false,
|
| 1840 |
+
"single_word": false,
|
| 1841 |
+
"special": true
|
| 1842 |
+
},
|
| 1843 |
+
"128230": {
|
| 1844 |
+
"content": "<|reserved_special_token_222|>",
|
| 1845 |
+
"lstrip": false,
|
| 1846 |
+
"normalized": false,
|
| 1847 |
+
"rstrip": false,
|
| 1848 |
+
"single_word": false,
|
| 1849 |
+
"special": true
|
| 1850 |
+
},
|
| 1851 |
+
"128231": {
|
| 1852 |
+
"content": "<|reserved_special_token_223|>",
|
| 1853 |
+
"lstrip": false,
|
| 1854 |
+
"normalized": false,
|
| 1855 |
+
"rstrip": false,
|
| 1856 |
+
"single_word": false,
|
| 1857 |
+
"special": true
|
| 1858 |
+
},
|
| 1859 |
+
"128232": {
|
| 1860 |
+
"content": "<|reserved_special_token_224|>",
|
| 1861 |
+
"lstrip": false,
|
| 1862 |
+
"normalized": false,
|
| 1863 |
+
"rstrip": false,
|
| 1864 |
+
"single_word": false,
|
| 1865 |
+
"special": true
|
| 1866 |
+
},
|
| 1867 |
+
"128233": {
|
| 1868 |
+
"content": "<|reserved_special_token_225|>",
|
| 1869 |
+
"lstrip": false,
|
| 1870 |
+
"normalized": false,
|
| 1871 |
+
"rstrip": false,
|
| 1872 |
+
"single_word": false,
|
| 1873 |
+
"special": true
|
| 1874 |
+
},
|
| 1875 |
+
"128234": {
|
| 1876 |
+
"content": "<|reserved_special_token_226|>",
|
| 1877 |
+
"lstrip": false,
|
| 1878 |
+
"normalized": false,
|
| 1879 |
+
"rstrip": false,
|
| 1880 |
+
"single_word": false,
|
| 1881 |
+
"special": true
|
| 1882 |
+
},
|
| 1883 |
+
"128235": {
|
| 1884 |
+
"content": "<|reserved_special_token_227|>",
|
| 1885 |
+
"lstrip": false,
|
| 1886 |
+
"normalized": false,
|
| 1887 |
+
"rstrip": false,
|
| 1888 |
+
"single_word": false,
|
| 1889 |
+
"special": true
|
| 1890 |
+
},
|
| 1891 |
+
"128236": {
|
| 1892 |
+
"content": "<|reserved_special_token_228|>",
|
| 1893 |
+
"lstrip": false,
|
| 1894 |
+
"normalized": false,
|
| 1895 |
+
"rstrip": false,
|
| 1896 |
+
"single_word": false,
|
| 1897 |
+
"special": true
|
| 1898 |
+
},
|
| 1899 |
+
"128237": {
|
| 1900 |
+
"content": "<|reserved_special_token_229|>",
|
| 1901 |
+
"lstrip": false,
|
| 1902 |
+
"normalized": false,
|
| 1903 |
+
"rstrip": false,
|
| 1904 |
+
"single_word": false,
|
| 1905 |
+
"special": true
|
| 1906 |
+
},
|
| 1907 |
+
"128238": {
|
| 1908 |
+
"content": "<|reserved_special_token_230|>",
|
| 1909 |
+
"lstrip": false,
|
| 1910 |
+
"normalized": false,
|
| 1911 |
+
"rstrip": false,
|
| 1912 |
+
"single_word": false,
|
| 1913 |
+
"special": true
|
| 1914 |
+
},
|
| 1915 |
+
"128239": {
|
| 1916 |
+
"content": "<|reserved_special_token_231|>",
|
| 1917 |
+
"lstrip": false,
|
| 1918 |
+
"normalized": false,
|
| 1919 |
+
"rstrip": false,
|
| 1920 |
+
"single_word": false,
|
| 1921 |
+
"special": true
|
| 1922 |
+
},
|
| 1923 |
+
"128240": {
|
| 1924 |
+
"content": "<|reserved_special_token_232|>",
|
| 1925 |
+
"lstrip": false,
|
| 1926 |
+
"normalized": false,
|
| 1927 |
+
"rstrip": false,
|
| 1928 |
+
"single_word": false,
|
| 1929 |
+
"special": true
|
| 1930 |
+
},
|
| 1931 |
+
"128241": {
|
| 1932 |
+
"content": "<|reserved_special_token_233|>",
|
| 1933 |
+
"lstrip": false,
|
| 1934 |
+
"normalized": false,
|
| 1935 |
+
"rstrip": false,
|
| 1936 |
+
"single_word": false,
|
| 1937 |
+
"special": true
|
| 1938 |
+
},
|
| 1939 |
+
"128242": {
|
| 1940 |
+
"content": "<|reserved_special_token_234|>",
|
| 1941 |
+
"lstrip": false,
|
| 1942 |
+
"normalized": false,
|
| 1943 |
+
"rstrip": false,
|
| 1944 |
+
"single_word": false,
|
| 1945 |
+
"special": true
|
| 1946 |
+
},
|
| 1947 |
+
"128243": {
|
| 1948 |
+
"content": "<|reserved_special_token_235|>",
|
| 1949 |
+
"lstrip": false,
|
| 1950 |
+
"normalized": false,
|
| 1951 |
+
"rstrip": false,
|
| 1952 |
+
"single_word": false,
|
| 1953 |
+
"special": true
|
| 1954 |
+
},
|
| 1955 |
+
"128244": {
|
| 1956 |
+
"content": "<|reserved_special_token_236|>",
|
| 1957 |
+
"lstrip": false,
|
| 1958 |
+
"normalized": false,
|
| 1959 |
+
"rstrip": false,
|
| 1960 |
+
"single_word": false,
|
| 1961 |
+
"special": true
|
| 1962 |
+
},
|
| 1963 |
+
"128245": {
|
| 1964 |
+
"content": "<|reserved_special_token_237|>",
|
| 1965 |
+
"lstrip": false,
|
| 1966 |
+
"normalized": false,
|
| 1967 |
+
"rstrip": false,
|
| 1968 |
+
"single_word": false,
|
| 1969 |
+
"special": true
|
| 1970 |
+
},
|
| 1971 |
+
"128246": {
|
| 1972 |
+
"content": "<|reserved_special_token_238|>",
|
| 1973 |
+
"lstrip": false,
|
| 1974 |
+
"normalized": false,
|
| 1975 |
+
"rstrip": false,
|
| 1976 |
+
"single_word": false,
|
| 1977 |
+
"special": true
|
| 1978 |
+
},
|
| 1979 |
+
"128247": {
|
| 1980 |
+
"content": "<|reserved_special_token_239|>",
|
| 1981 |
+
"lstrip": false,
|
| 1982 |
+
"normalized": false,
|
| 1983 |
+
"rstrip": false,
|
| 1984 |
+
"single_word": false,
|
| 1985 |
+
"special": true
|
| 1986 |
+
},
|
| 1987 |
+
"128248": {
|
| 1988 |
+
"content": "<|reserved_special_token_240|>",
|
| 1989 |
+
"lstrip": false,
|
| 1990 |
+
"normalized": false,
|
| 1991 |
+
"rstrip": false,
|
| 1992 |
+
"single_word": false,
|
| 1993 |
+
"special": true
|
| 1994 |
+
},
|
| 1995 |
+
"128249": {
|
| 1996 |
+
"content": "<|reserved_special_token_241|>",
|
| 1997 |
+
"lstrip": false,
|
| 1998 |
+
"normalized": false,
|
| 1999 |
+
"rstrip": false,
|
| 2000 |
+
"single_word": false,
|
| 2001 |
+
"special": true
|
| 2002 |
+
},
|
| 2003 |
+
"128250": {
|
| 2004 |
+
"content": "<|reserved_special_token_242|>",
|
| 2005 |
+
"lstrip": false,
|
| 2006 |
+
"normalized": false,
|
| 2007 |
+
"rstrip": false,
|
| 2008 |
+
"single_word": false,
|
| 2009 |
+
"special": true
|
| 2010 |
+
},
|
| 2011 |
+
"128251": {
|
| 2012 |
+
"content": "<|reserved_special_token_243|>",
|
| 2013 |
+
"lstrip": false,
|
| 2014 |
+
"normalized": false,
|
| 2015 |
+
"rstrip": false,
|
| 2016 |
+
"single_word": false,
|
| 2017 |
+
"special": true
|
| 2018 |
+
},
|
| 2019 |
+
"128252": {
|
| 2020 |
+
"content": "<|reserved_special_token_244|>",
|
| 2021 |
+
"lstrip": false,
|
| 2022 |
+
"normalized": false,
|
| 2023 |
+
"rstrip": false,
|
| 2024 |
+
"single_word": false,
|
| 2025 |
+
"special": true
|
| 2026 |
+
},
|
| 2027 |
+
"128253": {
|
| 2028 |
+
"content": "<|reserved_special_token_245|>",
|
| 2029 |
+
"lstrip": false,
|
| 2030 |
+
"normalized": false,
|
| 2031 |
+
"rstrip": false,
|
| 2032 |
+
"single_word": false,
|
| 2033 |
+
"special": true
|
| 2034 |
+
},
|
| 2035 |
+
"128254": {
|
| 2036 |
+
"content": "<|reserved_special_token_246|>",
|
| 2037 |
+
"lstrip": false,
|
| 2038 |
+
"normalized": false,
|
| 2039 |
+
"rstrip": false,
|
| 2040 |
+
"single_word": false,
|
| 2041 |
+
"special": true
|
| 2042 |
+
},
|
| 2043 |
+
"128255": {
|
| 2044 |
+
"content": "<|reserved_special_token_247|>",
|
| 2045 |
+
"lstrip": false,
|
| 2046 |
+
"normalized": false,
|
| 2047 |
+
"rstrip": false,
|
| 2048 |
+
"single_word": false,
|
| 2049 |
+
"special": true
|
| 2050 |
+
}
|
| 2051 |
+
},
|
| 2052 |
+
"bos_token": "<|begin_of_text|>",
|
| 2053 |
+
"clean_up_tokenization_spaces": true,
|
| 2054 |
+
"eos_token": "<|end_of_text|>",
|
| 2055 |
+
"model_input_names": [
|
| 2056 |
+
"input_ids",
|
| 2057 |
+
"attention_mask"
|
| 2058 |
+
],
|
| 2059 |
+
"model_max_length": 131072,
|
| 2060 |
+
"tokenizer_class": "PreTrainedTokenizerFast"
|
| 2061 |
+
}
|