Upload model
Browse files- config.json +60 -0
- configuration_qwen.py +71 -0
- cpp_kernels.py +55 -0
- generation_config.json +4 -0
- modeling_qwen.py +1428 -0
- pytorch_model-00001-of-00002.bin +3 -0
- pytorch_model-00002-of-00002.bin +3 -0
- pytorch_model.bin.index.json +1090 -0
- qwen_generation_utils.py +416 -0
config.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "Qwen-14B-8bit-wikitext-ex512-len4096-hf-safetensors",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"QWenLMHeadModel"
|
| 5 |
+
],
|
| 6 |
+
"attn_dropout_prob": 0.0,
|
| 7 |
+
"auto_map": {
|
| 8 |
+
"AutoConfig": "configuration_qwen.QWenConfig",
|
| 9 |
+
"AutoModelForCausalLM": "modeling_qwen.QWenLMHeadModel"
|
| 10 |
+
},
|
| 11 |
+
"bf16": false,
|
| 12 |
+
"emb_dropout_prob": 0.0,
|
| 13 |
+
"fp16": true,
|
| 14 |
+
"fp32": false,
|
| 15 |
+
"hidden_size": 5120,
|
| 16 |
+
"initializer_range": 0.02,
|
| 17 |
+
"intermediate_size": 27392,
|
| 18 |
+
"kv_channels": 128,
|
| 19 |
+
"layer_norm_epsilon": 1e-06,
|
| 20 |
+
"max_position_embeddings": 8192,
|
| 21 |
+
"model_type": "qwen",
|
| 22 |
+
"no_bias": true,
|
| 23 |
+
"num_attention_heads": 40,
|
| 24 |
+
"num_hidden_layers": 40,
|
| 25 |
+
"onnx_safe": null,
|
| 26 |
+
"quantization_config": {
|
| 27 |
+
"batch_size": 1,
|
| 28 |
+
"bits": 8,
|
| 29 |
+
"block_name_to_quantize": null,
|
| 30 |
+
"damp_percent": 0.01,
|
| 31 |
+
"dataset": null,
|
| 32 |
+
"desc_act": false,
|
| 33 |
+
"disable_exllama": false,
|
| 34 |
+
"group_size": 128,
|
| 35 |
+
"model_seqlen": null,
|
| 36 |
+
"module_name_preceding_first_block": null,
|
| 37 |
+
"pad_token_id": null,
|
| 38 |
+
"quant_method": "gptq",
|
| 39 |
+
"sym": true,
|
| 40 |
+
"tokenizer": null,
|
| 41 |
+
"true_sequential": true,
|
| 42 |
+
"use_cuda_fp16": false
|
| 43 |
+
},
|
| 44 |
+
"rotary_emb_base": 10000,
|
| 45 |
+
"rotary_pct": 1.0,
|
| 46 |
+
"scale_attn_weights": true,
|
| 47 |
+
"seq_length": 2048,
|
| 48 |
+
"softmax_in_fp32": false,
|
| 49 |
+
"tie_word_embeddings": false,
|
| 50 |
+
"tokenizer_class": "QWenTokenizer",
|
| 51 |
+
"torch_dtype": "float16",
|
| 52 |
+
"transformers_version": "4.32.0",
|
| 53 |
+
"use_cache": true,
|
| 54 |
+
"use_cache_kernel": false,
|
| 55 |
+
"use_cache_quantization": false,
|
| 56 |
+
"use_dynamic_ntk": true,
|
| 57 |
+
"use_flash_attn": true,
|
| 58 |
+
"use_logn_attn": true,
|
| 59 |
+
"vocab_size": 152064
|
| 60 |
+
}
|
configuration_qwen.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) Alibaba Cloud.
|
| 2 |
+
#
|
| 3 |
+
# This source code is licensed under the license found in the
|
| 4 |
+
# LICENSE file in the root directory of this source tree.
|
| 5 |
+
|
| 6 |
+
from transformers import PretrainedConfig
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class QWenConfig(PretrainedConfig):
|
| 10 |
+
model_type = "qwen"
|
| 11 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 12 |
+
|
| 13 |
+
def __init__(
|
| 14 |
+
self,
|
| 15 |
+
vocab_size=151936,
|
| 16 |
+
hidden_size=4096,
|
| 17 |
+
num_hidden_layers=32,
|
| 18 |
+
num_attention_heads=32,
|
| 19 |
+
emb_dropout_prob=0.0,
|
| 20 |
+
attn_dropout_prob=0.0,
|
| 21 |
+
layer_norm_epsilon=1e-6,
|
| 22 |
+
initializer_range=0.02,
|
| 23 |
+
max_position_embeddings=8192,
|
| 24 |
+
scale_attn_weights=True,
|
| 25 |
+
use_cache=True,
|
| 26 |
+
bf16=False,
|
| 27 |
+
fp16=False,
|
| 28 |
+
fp32=False,
|
| 29 |
+
kv_channels=128,
|
| 30 |
+
rotary_pct=1.0,
|
| 31 |
+
rotary_emb_base=10000,
|
| 32 |
+
use_dynamic_ntk=True,
|
| 33 |
+
use_logn_attn=True,
|
| 34 |
+
use_flash_attn="auto",
|
| 35 |
+
intermediate_size=22016,
|
| 36 |
+
no_bias=True,
|
| 37 |
+
tie_word_embeddings=False,
|
| 38 |
+
use_cache_quantization=False,
|
| 39 |
+
use_cache_kernel=False,
|
| 40 |
+
softmax_in_fp32=False,
|
| 41 |
+
**kwargs,
|
| 42 |
+
):
|
| 43 |
+
self.vocab_size = vocab_size
|
| 44 |
+
self.hidden_size = hidden_size
|
| 45 |
+
self.intermediate_size = intermediate_size
|
| 46 |
+
self.num_hidden_layers = num_hidden_layers
|
| 47 |
+
self.num_attention_heads = num_attention_heads
|
| 48 |
+
self.emb_dropout_prob = emb_dropout_prob
|
| 49 |
+
self.attn_dropout_prob = attn_dropout_prob
|
| 50 |
+
self.layer_norm_epsilon = layer_norm_epsilon
|
| 51 |
+
self.initializer_range = initializer_range
|
| 52 |
+
self.scale_attn_weights = scale_attn_weights
|
| 53 |
+
self.use_cache = use_cache
|
| 54 |
+
self.max_position_embeddings = max_position_embeddings
|
| 55 |
+
self.bf16 = bf16
|
| 56 |
+
self.fp16 = fp16
|
| 57 |
+
self.fp32 = fp32
|
| 58 |
+
self.kv_channels = kv_channels
|
| 59 |
+
self.rotary_pct = rotary_pct
|
| 60 |
+
self.rotary_emb_base = rotary_emb_base
|
| 61 |
+
self.use_dynamic_ntk = use_dynamic_ntk
|
| 62 |
+
self.use_logn_attn = use_logn_attn
|
| 63 |
+
self.use_flash_attn = use_flash_attn
|
| 64 |
+
self.no_bias = no_bias
|
| 65 |
+
self.use_cache_quantization = use_cache_quantization
|
| 66 |
+
self.use_cache_kernel = use_cache_kernel
|
| 67 |
+
self.softmax_in_fp32 = softmax_in_fp32
|
| 68 |
+
super().__init__(
|
| 69 |
+
tie_word_embeddings=tie_word_embeddings,
|
| 70 |
+
**kwargs
|
| 71 |
+
)
|
cpp_kernels.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from torch.utils import cpp_extension
|
| 2 |
+
import pathlib
|
| 3 |
+
import os
|
| 4 |
+
import subprocess
|
| 5 |
+
|
| 6 |
+
def _get_cuda_bare_metal_version(cuda_dir):
|
| 7 |
+
raw_output = subprocess.check_output([cuda_dir + "/bin/nvcc", "-V"],
|
| 8 |
+
universal_newlines=True)
|
| 9 |
+
output = raw_output.split()
|
| 10 |
+
release_idx = output.index("release") + 1
|
| 11 |
+
release = output[release_idx].split(".")
|
| 12 |
+
bare_metal_major = release[0]
|
| 13 |
+
bare_metal_minor = release[1][0]
|
| 14 |
+
|
| 15 |
+
return raw_output, bare_metal_major, bare_metal_minor
|
| 16 |
+
|
| 17 |
+
def _create_build_dir(buildpath):
|
| 18 |
+
try:
|
| 19 |
+
os.mkdir(buildpath)
|
| 20 |
+
except OSError:
|
| 21 |
+
if not os.path.isdir(buildpath):
|
| 22 |
+
print(f"Creation of the build directory {buildpath} failed")
|
| 23 |
+
|
| 24 |
+
# Check if cuda 11 is installed for compute capability 8.0
|
| 25 |
+
cc_flag = []
|
| 26 |
+
_, bare_metal_major, bare_metal_minor = _get_cuda_bare_metal_version(cpp_extension.CUDA_HOME)
|
| 27 |
+
if int(bare_metal_major) >= 11:
|
| 28 |
+
cc_flag.append('-gencode')
|
| 29 |
+
cc_flag.append('arch=compute_80,code=sm_80')
|
| 30 |
+
if int(bare_metal_minor) >= 7:
|
| 31 |
+
cc_flag.append('-gencode')
|
| 32 |
+
cc_flag.append('arch=compute_90,code=sm_90')
|
| 33 |
+
|
| 34 |
+
# Build path
|
| 35 |
+
srcpath = pathlib.Path(__file__).parent.absolute()
|
| 36 |
+
buildpath = srcpath / 'build'
|
| 37 |
+
_create_build_dir(buildpath)
|
| 38 |
+
|
| 39 |
+
def _cpp_extention_load_helper(name, sources, extra_cuda_flags):
|
| 40 |
+
return cpp_extension.load(
|
| 41 |
+
name=name,
|
| 42 |
+
sources=sources,
|
| 43 |
+
build_directory=buildpath,
|
| 44 |
+
extra_cflags=['-O3', ],
|
| 45 |
+
extra_cuda_cflags=['-O3',
|
| 46 |
+
'-gencode', 'arch=compute_70,code=sm_70',
|
| 47 |
+
'--use_fast_math'] + extra_cuda_flags + cc_flag,
|
| 48 |
+
verbose=1
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
extra_flags = []
|
| 52 |
+
|
| 53 |
+
cache_autogptq_cuda_256_sources = ["./cache_autogptq_cuda_256.cpp",
|
| 54 |
+
"./cache_autogptq_cuda_kernel_256.cu"]
|
| 55 |
+
cache_autogptq_cuda_256 = _cpp_extention_load_helper("cache_autogptq_cuda_256", cache_autogptq_cuda_256_sources, extra_flags)
|
generation_config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"transformers_version": "4.32.0"
|
| 4 |
+
}
|
modeling_qwen.py
ADDED
|
@@ -0,0 +1,1428 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) Alibaba Cloud.
|
| 2 |
+
#
|
| 3 |
+
# This source code is licensed under the license found in the
|
| 4 |
+
# LICENSE file in the root directory of this source tree.
|
| 5 |
+
|
| 6 |
+
import importlib
|
| 7 |
+
import math
|
| 8 |
+
from typing import TYPE_CHECKING, Optional, Tuple, Union, Callable, List, Any, Generator
|
| 9 |
+
|
| 10 |
+
import torch
|
| 11 |
+
import torch.nn.functional as F
|
| 12 |
+
import torch.utils.checkpoint
|
| 13 |
+
from torch.cuda.amp import autocast
|
| 14 |
+
|
| 15 |
+
from torch.nn import CrossEntropyLoss
|
| 16 |
+
from transformers import PreTrainedTokenizer, GenerationConfig, StoppingCriteriaList
|
| 17 |
+
from transformers.generation.logits_process import LogitsProcessorList
|
| 18 |
+
|
| 19 |
+
if TYPE_CHECKING:
|
| 20 |
+
from transformers.generation.streamers import BaseStreamer
|
| 21 |
+
from transformers.generation.utils import GenerateOutput
|
| 22 |
+
from transformers.modeling_outputs import (
|
| 23 |
+
BaseModelOutputWithPast,
|
| 24 |
+
CausalLMOutputWithPast,
|
| 25 |
+
)
|
| 26 |
+
from transformers.modeling_utils import PreTrainedModel
|
| 27 |
+
from transformers.utils import logging
|
| 28 |
+
|
| 29 |
+
try:
|
| 30 |
+
from einops import rearrange
|
| 31 |
+
except ImportError:
|
| 32 |
+
rearrange = None
|
| 33 |
+
from torch import nn
|
| 34 |
+
|
| 35 |
+
SUPPORT_CUDA = torch.cuda.is_available()
|
| 36 |
+
SUPPORT_BF16 = SUPPORT_CUDA and torch.cuda.is_bf16_supported()
|
| 37 |
+
SUPPORT_FP16 = SUPPORT_CUDA and torch.cuda.get_device_capability(0)[0] >= 7
|
| 38 |
+
SUPPORT_TORCH2 = hasattr(torch, '__version__') and int(torch.__version__.split(".")[0]) >= 2
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
from .configuration_qwen import QWenConfig
|
| 42 |
+
from .qwen_generation_utils import (
|
| 43 |
+
HistoryType,
|
| 44 |
+
make_context,
|
| 45 |
+
decode_tokens,
|
| 46 |
+
get_stop_words_ids,
|
| 47 |
+
StopWordsLogitsProcessor,
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
logger = logging.get_logger(__name__)
|
| 52 |
+
|
| 53 |
+
_CHECKPOINT_FOR_DOC = "qwen"
|
| 54 |
+
_CONFIG_FOR_DOC = "QWenConfig"
|
| 55 |
+
|
| 56 |
+
QWen_PRETRAINED_MODEL_ARCHIVE_LIST = ["qwen-7b"]
|
| 57 |
+
|
| 58 |
+
_ERROR_BAD_CHAT_FORMAT = """\
|
| 59 |
+
We detect you are probably using the pretrained model (rather than chat model) for chatting, since the chat_format in generation_config is not "chatml".
|
| 60 |
+
If you are directly using the model downloaded from Huggingface, please make sure you are using our "Qwen/Qwen-7B-Chat" Huggingface model (rather than "Qwen/Qwen-7B") when you call model.chat().
|
| 61 |
+
我们检测到您可能在使用预训练模型(而非chat模型)进行多轮chat,因为您当前在generation_config指定的chat_format,并未设置为我们在对话中所支持的"chatml"格式。
|
| 62 |
+
如果您在直接使用我们从Huggingface提供的模型,请确保您在调用model.chat()时,使用的是"Qwen/Qwen-7B-Chat"模型(而非"Qwen/Qwen-7B"预训练模型)。
|
| 63 |
+
"""
|
| 64 |
+
|
| 65 |
+
_SENTINEL = object()
|
| 66 |
+
_ERROR_STREAM_IN_CHAT = """\
|
| 67 |
+
Pass argument `stream` to model.chat() is buggy, deprecated, and marked for removal. Please use model.chat_stream(...) instead of model.chat(..., stream=True).
|
| 68 |
+
向model.chat()传入参数stream的用法可能存在Bug,该用法已被废弃,将在未来被移除。请使用model.chat_stream(...)代替model.chat(..., stream=True)。
|
| 69 |
+
"""
|
| 70 |
+
|
| 71 |
+
_ERROR_INPUT_CPU_QUERY_WITH_FLASH_ATTN_ACTIVATED = """\
|
| 72 |
+
We detect you have activated flash attention support, but running model computation on CPU. Please make sure that your input data has been placed on GPU. If you actually want to run CPU computation, please following the readme and set device_map="cpu" to disable flash attention when loading the model (calling AutoModelForCausalLM.from_pretrained).
|
| 73 |
+
检测到您的模型已激活了flash attention支持,但正在执行CPU运算任务。如使用flash attention,请您确认模型输入已经传到GPU上。如果您确认要执行CPU运算,请您在载入模型(调用AutoModelForCausalLM.from_pretrained)时,按照readme说法,指定device_map="cpu"以禁用flash attention。
|
| 74 |
+
"""
|
| 75 |
+
|
| 76 |
+
apply_rotary_emb_func = None
|
| 77 |
+
rms_norm = None
|
| 78 |
+
flash_attn_unpadded_func = None
|
| 79 |
+
|
| 80 |
+
def _import_flash_attn():
|
| 81 |
+
global apply_rotary_emb_func, rms_norm, flash_attn_unpadded_func
|
| 82 |
+
try:
|
| 83 |
+
from flash_attn.layers.rotary import apply_rotary_emb_func as __apply_rotary_emb_func
|
| 84 |
+
apply_rotary_emb_func = __apply_rotary_emb_func
|
| 85 |
+
except ImportError:
|
| 86 |
+
logger.warn(
|
| 87 |
+
"Warning: import flash_attn rotary fail, please install FlashAttention rotary to get higher efficiency "
|
| 88 |
+
"https://github.com/Dao-AILab/flash-attention/tree/main/csrc/rotary"
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
try:
|
| 92 |
+
from flash_attn.ops.rms_norm import rms_norm as __rms_norm
|
| 93 |
+
rms_norm = __rms_norm
|
| 94 |
+
except ImportError:
|
| 95 |
+
logger.warn(
|
| 96 |
+
"Warning: import flash_attn rms_norm fail, please install FlashAttention layer_norm to get higher efficiency "
|
| 97 |
+
"https://github.com/Dao-AILab/flash-attention/tree/main/csrc/layer_norm"
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
+
try:
|
| 101 |
+
import flash_attn
|
| 102 |
+
if not hasattr(flash_attn, '__version__'):
|
| 103 |
+
from flash_attn.flash_attn_interface import flash_attn_unpadded_func as __flash_attn_unpadded_func
|
| 104 |
+
else:
|
| 105 |
+
if int(flash_attn.__version__.split(".")[0]) >= 2:
|
| 106 |
+
from flash_attn.flash_attn_interface import flash_attn_varlen_func as __flash_attn_unpadded_func
|
| 107 |
+
else:
|
| 108 |
+
from flash_attn.flash_attn_interface import flash_attn_unpadded_func as __flash_attn_unpadded_func
|
| 109 |
+
flash_attn_unpadded_func = __flash_attn_unpadded_func
|
| 110 |
+
except ImportError:
|
| 111 |
+
logger.warn(
|
| 112 |
+
"Warning: import flash_attn fail, please install FlashAttention to get higher efficiency "
|
| 113 |
+
"https://github.com/Dao-AILab/flash-attention"
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
def quantize_cache_v(fdata, bits, qmax, qmin):
|
| 117 |
+
# b, s, head, h-dim->b, head, s, h-dim
|
| 118 |
+
qtype = torch.uint8
|
| 119 |
+
device = fdata.device
|
| 120 |
+
shape = fdata.shape
|
| 121 |
+
|
| 122 |
+
fdata_cal = torch.flatten(fdata, 2)
|
| 123 |
+
fmax = torch.amax(fdata_cal, dim=-1, keepdim=True)
|
| 124 |
+
fmin = torch.amin(fdata_cal, dim=-1, keepdim=True)
|
| 125 |
+
# Compute params
|
| 126 |
+
if qmax.device != fmax.device:
|
| 127 |
+
qmax = qmax.to(device)
|
| 128 |
+
qmin = qmin.to(device)
|
| 129 |
+
scale = (fmax - fmin) / (qmax - qmin)
|
| 130 |
+
zero = qmin - fmin / scale
|
| 131 |
+
scale = scale.unsqueeze(-1).repeat(1,1,shape[2],1).contiguous()
|
| 132 |
+
zero = zero.unsqueeze(-1).repeat(1,1,shape[2],1).contiguous()
|
| 133 |
+
# Quantize
|
| 134 |
+
res_data = fdata / scale + zero
|
| 135 |
+
qdata = torch.clamp(res_data, qmin, qmax).to(qtype)
|
| 136 |
+
return qdata.contiguous(), scale, zero
|
| 137 |
+
|
| 138 |
+
def dequantize_cache_torch(qdata, scale, zero):
|
| 139 |
+
data = scale * (qdata - zero)
|
| 140 |
+
return data
|
| 141 |
+
|
| 142 |
+
class FlashSelfAttention(torch.nn.Module):
|
| 143 |
+
def __init__(
|
| 144 |
+
self,
|
| 145 |
+
causal=False,
|
| 146 |
+
softmax_scale=None,
|
| 147 |
+
attention_dropout=0.0,
|
| 148 |
+
):
|
| 149 |
+
super().__init__()
|
| 150 |
+
assert flash_attn_unpadded_func is not None, (
|
| 151 |
+
"Please install FlashAttention first, " "e.g., with pip install flash-attn"
|
| 152 |
+
)
|
| 153 |
+
assert (
|
| 154 |
+
rearrange is not None
|
| 155 |
+
), "Please install einops first, e.g., with pip install einops"
|
| 156 |
+
self.causal = causal
|
| 157 |
+
self.softmax_scale = softmax_scale
|
| 158 |
+
self.dropout_p = attention_dropout
|
| 159 |
+
|
| 160 |
+
def unpad_input(self, hidden_states, attention_mask):
|
| 161 |
+
valid_mask = attention_mask.squeeze(1).squeeze(1).eq(0)
|
| 162 |
+
seqlens_in_batch = valid_mask.sum(dim=-1, dtype=torch.int32)
|
| 163 |
+
indices = torch.nonzero(valid_mask.flatten(), as_tuple=False).flatten()
|
| 164 |
+
max_seqlen_in_batch = seqlens_in_batch.max().item()
|
| 165 |
+
cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0))
|
| 166 |
+
hidden_states = hidden_states[indices]
|
| 167 |
+
return hidden_states, indices, cu_seqlens, max_seqlen_in_batch
|
| 168 |
+
|
| 169 |
+
def pad_input(self, hidden_states, indices, batch, seqlen):
|
| 170 |
+
output = torch.zeros(batch * seqlen, *hidden_states.shape[1:], device=hidden_states.device,
|
| 171 |
+
dtype=hidden_states.dtype)
|
| 172 |
+
output[indices] = hidden_states
|
| 173 |
+
return rearrange(output, '(b s) ... -> b s ...', b=batch)
|
| 174 |
+
|
| 175 |
+
def forward(self, q, k, v, attention_mask=None):
|
| 176 |
+
assert all((i.dtype in [torch.float16, torch.bfloat16] for i in (q, k, v)))
|
| 177 |
+
assert all((i.is_cuda for i in (q, k, v)))
|
| 178 |
+
batch_size, seqlen_q = q.shape[0], q.shape[1]
|
| 179 |
+
seqlen_k = k.shape[1]
|
| 180 |
+
seqlen_out = seqlen_q
|
| 181 |
+
|
| 182 |
+
q, k, v = [rearrange(x, "b s ... -> (b s) ...") for x in [q, k, v]]
|
| 183 |
+
cu_seqlens_q = torch.arange(
|
| 184 |
+
0,
|
| 185 |
+
(batch_size + 1) * seqlen_q,
|
| 186 |
+
step=seqlen_q,
|
| 187 |
+
dtype=torch.int32,
|
| 188 |
+
device=q.device,
|
| 189 |
+
)
|
| 190 |
+
|
| 191 |
+
if batch_size > 1 and attention_mask is not None:
|
| 192 |
+
k, indices_k, cu_seqlens_k, seqlen_k = self.unpad_input(k, attention_mask)
|
| 193 |
+
if q.size(0) == v.size(0):
|
| 194 |
+
q = q[indices_k]
|
| 195 |
+
cu_seqlens_q = cu_seqlens_k
|
| 196 |
+
seqlen_q = seqlen_k
|
| 197 |
+
v = v[indices_k]
|
| 198 |
+
else:
|
| 199 |
+
cu_seqlens_k = torch.arange(
|
| 200 |
+
0,
|
| 201 |
+
(batch_size + 1) * seqlen_k,
|
| 202 |
+
step=seqlen_k,
|
| 203 |
+
dtype=torch.int32,
|
| 204 |
+
device=q.device,
|
| 205 |
+
)
|
| 206 |
+
|
| 207 |
+
if self.training:
|
| 208 |
+
assert seqlen_k == seqlen_q
|
| 209 |
+
is_causal = self.causal
|
| 210 |
+
dropout_p = self.dropout_p
|
| 211 |
+
else:
|
| 212 |
+
is_causal = seqlen_q == seqlen_k
|
| 213 |
+
dropout_p = 0
|
| 214 |
+
|
| 215 |
+
output = flash_attn_unpadded_func(
|
| 216 |
+
q,
|
| 217 |
+
k,
|
| 218 |
+
v,
|
| 219 |
+
cu_seqlens_q,
|
| 220 |
+
cu_seqlens_k,
|
| 221 |
+
seqlen_q,
|
| 222 |
+
seqlen_k,
|
| 223 |
+
dropout_p,
|
| 224 |
+
softmax_scale=self.softmax_scale,
|
| 225 |
+
causal=is_causal,
|
| 226 |
+
)
|
| 227 |
+
if batch_size > 1 and attention_mask is not None and seqlen_q == seqlen_k:
|
| 228 |
+
output = self.pad_input(output, indices_k, batch_size, seqlen_out)
|
| 229 |
+
else:
|
| 230 |
+
new_shape = (batch_size, output.shape[0] // batch_size) + output.shape[1:]
|
| 231 |
+
output = output.view(new_shape)
|
| 232 |
+
return output
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
class QWenAttention(nn.Module):
|
| 236 |
+
def __init__(self, config):
|
| 237 |
+
super().__init__()
|
| 238 |
+
|
| 239 |
+
self.register_buffer("masked_bias", torch.tensor(-1e4), persistent=False)
|
| 240 |
+
self.seq_length = config.seq_length
|
| 241 |
+
|
| 242 |
+
self.hidden_size = config.hidden_size
|
| 243 |
+
self.split_size = config.hidden_size
|
| 244 |
+
self.num_heads = config.num_attention_heads
|
| 245 |
+
self.head_dim = self.hidden_size // self.num_heads
|
| 246 |
+
|
| 247 |
+
self.use_flash_attn = config.use_flash_attn
|
| 248 |
+
self.scale_attn_weights = True
|
| 249 |
+
|
| 250 |
+
self.projection_size = config.kv_channels * config.num_attention_heads
|
| 251 |
+
|
| 252 |
+
assert self.projection_size % config.num_attention_heads == 0
|
| 253 |
+
self.hidden_size_per_attention_head = (
|
| 254 |
+
self.projection_size // config.num_attention_heads
|
| 255 |
+
)
|
| 256 |
+
|
| 257 |
+
self.c_attn = nn.Linear(config.hidden_size, 3 * self.projection_size)
|
| 258 |
+
|
| 259 |
+
self.c_proj = nn.Linear(
|
| 260 |
+
config.hidden_size, self.projection_size, bias=not config.no_bias
|
| 261 |
+
)
|
| 262 |
+
|
| 263 |
+
self.is_fp32 = not (config.bf16 or config.fp16)
|
| 264 |
+
if (
|
| 265 |
+
self.use_flash_attn
|
| 266 |
+
and flash_attn_unpadded_func is not None
|
| 267 |
+
and not self.is_fp32
|
| 268 |
+
):
|
| 269 |
+
self.core_attention_flash = FlashSelfAttention(
|
| 270 |
+
causal=True, attention_dropout=config.attn_dropout_prob
|
| 271 |
+
)
|
| 272 |
+
self.bf16 = config.bf16
|
| 273 |
+
|
| 274 |
+
self.use_dynamic_ntk = config.use_dynamic_ntk
|
| 275 |
+
self.use_logn_attn = config.use_logn_attn
|
| 276 |
+
|
| 277 |
+
logn_list = [
|
| 278 |
+
math.log(i, self.seq_length) if i > self.seq_length else 1
|
| 279 |
+
for i in range(1, 32768)
|
| 280 |
+
]
|
| 281 |
+
logn_tensor = torch.tensor(logn_list)[None, :, None, None]
|
| 282 |
+
self.register_buffer("logn_tensor", logn_tensor, persistent=False)
|
| 283 |
+
|
| 284 |
+
self.attn_dropout = nn.Dropout(config.attn_dropout_prob)
|
| 285 |
+
self.softmax_in_fp32 = config.softmax_in_fp32 if hasattr(config, 'softmax_in_fp32') else False
|
| 286 |
+
self.use_cache_quantization = config.use_cache_quantization if hasattr(config, 'use_cache_quantization') else False
|
| 287 |
+
self.use_cache_kernel = config.use_cache_kernel if hasattr(config,'use_cache_kernel') else False
|
| 288 |
+
cache_dtype = torch.float
|
| 289 |
+
if self.bf16:
|
| 290 |
+
cache_dtype=torch.bfloat16
|
| 291 |
+
elif config.fp16:
|
| 292 |
+
cache_dtype = torch.float16
|
| 293 |
+
self.cache_qmax = torch.tensor(torch.iinfo(torch.uint8).max, dtype=cache_dtype)
|
| 294 |
+
self.cache_qmin = torch.tensor(torch.iinfo(torch.uint8).min, dtype=cache_dtype)
|
| 295 |
+
|
| 296 |
+
if config.use_cache_quantization and config.use_cache_kernel:
|
| 297 |
+
from .cpp_kernels import cache_autogptq_cuda_256
|
| 298 |
+
try:
|
| 299 |
+
self.cache_kernels = cache_autogptq_cuda_256
|
| 300 |
+
except ImportError:
|
| 301 |
+
self.cache_kernels = None
|
| 302 |
+
|
| 303 |
+
def _attn(self, query, key, value, registered_causal_mask, attention_mask=None, head_mask=None):
|
| 304 |
+
device = query.device
|
| 305 |
+
if self.use_cache_quantization:
|
| 306 |
+
qk, qk_scale, qk_zero = key
|
| 307 |
+
if self.use_cache_kernel and self.cache_kernels is not None:
|
| 308 |
+
shape = query.shape[:-1] + (qk.shape[-2],)
|
| 309 |
+
attn_weights = torch.zeros(shape, dtype=torch.float16, device=device)
|
| 310 |
+
self.cache_kernels.vecquant8matmul_batched_faster_old(
|
| 311 |
+
query.contiguous() if query.dtype == torch.float16 else query.to(torch.float16).contiguous(),
|
| 312 |
+
qk.transpose(-1, -2).contiguous(),
|
| 313 |
+
attn_weights,
|
| 314 |
+
qk_scale.contiguous() if qk_scale.dtype == torch.float16 else qk_scale.to(torch.float16).contiguous(),
|
| 315 |
+
qk_zero.contiguous()if qk_zero.dtype == torch.float16 else qk_zero.to(torch.float16).contiguous())
|
| 316 |
+
# attn_weights = attn_weights.to(query.dtype).contiguous()
|
| 317 |
+
else:
|
| 318 |
+
key = dequantize_cache_torch(qk, qk_scale, qk_zero)
|
| 319 |
+
attn_weights = torch.matmul(query, key.transpose(-1, -2))
|
| 320 |
+
else:
|
| 321 |
+
attn_weights = torch.matmul(query, key.transpose(-1, -2))
|
| 322 |
+
|
| 323 |
+
if self.scale_attn_weights:
|
| 324 |
+
if self.use_cache_quantization:
|
| 325 |
+
size_temp = value[0].size(-1)
|
| 326 |
+
else:
|
| 327 |
+
size_temp = value.size(-1)
|
| 328 |
+
attn_weights = attn_weights / torch.full(
|
| 329 |
+
[],
|
| 330 |
+
size_temp ** 0.5,
|
| 331 |
+
dtype=attn_weights.dtype,
|
| 332 |
+
device=attn_weights.device,
|
| 333 |
+
)
|
| 334 |
+
if self.use_cache_quantization:
|
| 335 |
+
query_length, key_length = query.size(-2), key[0].size(-2)
|
| 336 |
+
else:
|
| 337 |
+
query_length, key_length = query.size(-2), key.size(-2)
|
| 338 |
+
causal_mask = registered_causal_mask[
|
| 339 |
+
:, :, key_length - query_length : key_length, :key_length
|
| 340 |
+
]
|
| 341 |
+
mask_value = torch.finfo(attn_weights.dtype).min
|
| 342 |
+
mask_value = torch.full([], mask_value, dtype=attn_weights.dtype).to(
|
| 343 |
+
attn_weights.device
|
| 344 |
+
)
|
| 345 |
+
attn_weights = torch.where(
|
| 346 |
+
causal_mask, attn_weights.to(attn_weights.dtype), mask_value
|
| 347 |
+
)
|
| 348 |
+
|
| 349 |
+
if attention_mask is not None:
|
| 350 |
+
attn_weights = attn_weights + attention_mask
|
| 351 |
+
|
| 352 |
+
if self.softmax_in_fp32:
|
| 353 |
+
attn_weights = nn.functional.softmax(attn_weights.float(), dim=-1)
|
| 354 |
+
else:
|
| 355 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1)
|
| 356 |
+
|
| 357 |
+
attn_weights = attn_weights.type(query.dtype)
|
| 358 |
+
attn_weights = self.attn_dropout(attn_weights)
|
| 359 |
+
|
| 360 |
+
if head_mask is not None:
|
| 361 |
+
attn_weights = attn_weights * head_mask
|
| 362 |
+
|
| 363 |
+
if self.use_cache_quantization:
|
| 364 |
+
qv, qv_scale, qv_zero = value
|
| 365 |
+
if self.use_cache_kernel and self.cache_kernels is not None:
|
| 366 |
+
shape = attn_weights.shape[:-1] + (query.shape[-1],)
|
| 367 |
+
attn_output = torch.zeros(shape, dtype=torch.float16, device=device)
|
| 368 |
+
self.cache_kernels.vecquant8matmul_batched_column_compression_faster_old(
|
| 369 |
+
attn_weights.contiguous() if attn_weights.dtype == torch.float16 else attn_weights.to(torch.float16).contiguous(),
|
| 370 |
+
qv.contiguous(), # dtype: int32
|
| 371 |
+
attn_output,
|
| 372 |
+
qv_scale.contiguous() if qv_scale.dtype == torch.float16 else qv_scale.to(torch.float16).contiguous(),
|
| 373 |
+
qv_zero.contiguous() if qv_zero.dtype == torch.float16 else qv_zero.to(torch.float16).contiguous())
|
| 374 |
+
if attn_output.dtype != query.dtype:
|
| 375 |
+
attn_output = attn_output.to(query.dtype)
|
| 376 |
+
attn_weights = attn_weights.to(query.dtype)
|
| 377 |
+
else:
|
| 378 |
+
value = dequantize_cache_torch(qv, qv_scale, qv_zero)
|
| 379 |
+
attn_output = torch.matmul(attn_weights, value)
|
| 380 |
+
else:
|
| 381 |
+
attn_output = torch.matmul(attn_weights, value)
|
| 382 |
+
|
| 383 |
+
attn_output = attn_output.transpose(1, 2)
|
| 384 |
+
|
| 385 |
+
return attn_output, attn_weights
|
| 386 |
+
|
| 387 |
+
def _upcast_and_reordered_attn(
|
| 388 |
+
self, query, key, value, registered_causal_mask, attention_mask=None, head_mask=None
|
| 389 |
+
):
|
| 390 |
+
bsz, num_heads, q_seq_len, dk = query.size()
|
| 391 |
+
_, _, k_seq_len, _ = key.size()
|
| 392 |
+
|
| 393 |
+
attn_weights = torch.empty(
|
| 394 |
+
bsz * num_heads,
|
| 395 |
+
q_seq_len,
|
| 396 |
+
k_seq_len,
|
| 397 |
+
dtype=torch.float32,
|
| 398 |
+
device=query.device,
|
| 399 |
+
)
|
| 400 |
+
|
| 401 |
+
scale_factor = 1.0
|
| 402 |
+
if self.scale_attn_weights:
|
| 403 |
+
scale_factor /= float(value.size(-1)) ** 0.5
|
| 404 |
+
|
| 405 |
+
with autocast(enabled=False):
|
| 406 |
+
q, k = query.reshape(-1, q_seq_len, dk), key.transpose(-1, -2).reshape(
|
| 407 |
+
-1, dk, k_seq_len
|
| 408 |
+
)
|
| 409 |
+
attn_weights = torch.baddbmm(
|
| 410 |
+
attn_weights, q.float(), k.float(), beta=0, alpha=scale_factor
|
| 411 |
+
)
|
| 412 |
+
attn_weights = attn_weights.reshape(bsz, num_heads, q_seq_len, k_seq_len)
|
| 413 |
+
|
| 414 |
+
query_length, key_length = query.size(-2), key.size(-2)
|
| 415 |
+
causal_mask = registered_causal_mask[
|
| 416 |
+
:, :, key_length - query_length : key_length, :key_length
|
| 417 |
+
]
|
| 418 |
+
mask_value = torch.finfo(attn_weights.dtype).min
|
| 419 |
+
mask_value = torch.tensor(mask_value, dtype=attn_weights.dtype).to(
|
| 420 |
+
attn_weights.device
|
| 421 |
+
)
|
| 422 |
+
attn_weights = torch.where(causal_mask, attn_weights, mask_value)
|
| 423 |
+
|
| 424 |
+
if attention_mask is not None:
|
| 425 |
+
attn_weights = attn_weights + attention_mask
|
| 426 |
+
|
| 427 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1)
|
| 428 |
+
|
| 429 |
+
if attn_weights.dtype != torch.float32:
|
| 430 |
+
raise RuntimeError(
|
| 431 |
+
"Error with upcasting, attn_weights does not have dtype torch.float32"
|
| 432 |
+
)
|
| 433 |
+
attn_weights = attn_weights.type(value.dtype)
|
| 434 |
+
attn_weights = self.attn_dropout(attn_weights)
|
| 435 |
+
|
| 436 |
+
if head_mask is not None:
|
| 437 |
+
attn_weights = attn_weights * head_mask
|
| 438 |
+
|
| 439 |
+
attn_output = torch.matmul(attn_weights, value)
|
| 440 |
+
|
| 441 |
+
return attn_output, attn_weights
|
| 442 |
+
|
| 443 |
+
def _split_heads(self, tensor, num_heads, attn_head_size):
|
| 444 |
+
new_shape = tensor.size()[:-1] + (num_heads, attn_head_size)
|
| 445 |
+
tensor = tensor.view(new_shape)
|
| 446 |
+
return tensor
|
| 447 |
+
|
| 448 |
+
def _merge_heads(self, tensor, num_heads, attn_head_size):
|
| 449 |
+
tensor = tensor.contiguous()
|
| 450 |
+
new_shape = tensor.size()[:-2] + (num_heads * attn_head_size,)
|
| 451 |
+
return tensor.view(new_shape)
|
| 452 |
+
|
| 453 |
+
def forward(
|
| 454 |
+
self,
|
| 455 |
+
hidden_states: Optional[Tuple[torch.FloatTensor]],
|
| 456 |
+
rotary_pos_emb_list: Optional[List[List[torch.Tensor]]] = None,
|
| 457 |
+
registered_causal_mask: Optional[torch.Tensor] = None,
|
| 458 |
+
layer_past: Optional[Tuple[torch.Tensor]] = None,
|
| 459 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
| 460 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
| 461 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 462 |
+
encoder_attention_mask: Optional[torch.FloatTensor] = None,
|
| 463 |
+
output_attentions: Optional[bool] = False,
|
| 464 |
+
use_cache: Optional[bool] = False,
|
| 465 |
+
):
|
| 466 |
+
mixed_x_layer = self.c_attn(hidden_states)
|
| 467 |
+
|
| 468 |
+
query, key, value = mixed_x_layer.split(self.split_size, dim=2)
|
| 469 |
+
|
| 470 |
+
query = self._split_heads(query, self.num_heads, self.head_dim)
|
| 471 |
+
key = self._split_heads(key, self.num_heads, self.head_dim)
|
| 472 |
+
value = self._split_heads(value, self.num_heads, self.head_dim)
|
| 473 |
+
|
| 474 |
+
if rotary_pos_emb_list is not None:
|
| 475 |
+
cur_len = query.shape[1]
|
| 476 |
+
if len(rotary_pos_emb_list) == 1:
|
| 477 |
+
rotary_pos_emb = rotary_pos_emb_list[0]
|
| 478 |
+
rotary_pos_emb = [i[:, -cur_len:, :, :] for i in rotary_pos_emb]
|
| 479 |
+
rotary_pos_emb = (rotary_pos_emb,) * 2
|
| 480 |
+
q_pos_emb, k_pos_emb = rotary_pos_emb
|
| 481 |
+
# Slice the pos emb for current inference
|
| 482 |
+
query = apply_rotary_pos_emb(query, q_pos_emb)
|
| 483 |
+
key = apply_rotary_pos_emb(key, k_pos_emb)
|
| 484 |
+
else:
|
| 485 |
+
query_list = []
|
| 486 |
+
key_list = []
|
| 487 |
+
for i, rotary_pos_emb in enumerate(rotary_pos_emb_list):
|
| 488 |
+
rotary_pos_emb = [i[:, -cur_len:, :, :] for i in rotary_pos_emb]
|
| 489 |
+
rotary_pos_emb = (rotary_pos_emb,) * 2
|
| 490 |
+
q_pos_emb, k_pos_emb = rotary_pos_emb
|
| 491 |
+
# Slice the pos emb for current inference
|
| 492 |
+
query_list += [apply_rotary_pos_emb(query[i:i+1, :, :], q_pos_emb)]
|
| 493 |
+
key_list += [apply_rotary_pos_emb(key[i:i+1, :, :], k_pos_emb)]
|
| 494 |
+
query = torch.cat(query_list, dim=0)
|
| 495 |
+
key = torch.cat(key_list, dim=0)
|
| 496 |
+
|
| 497 |
+
if self.use_cache_quantization:
|
| 498 |
+
key = quantize_cache_v(key.permute(0, 2, 1, 3),
|
| 499 |
+
bits=8,
|
| 500 |
+
qmin=self.cache_qmin,
|
| 501 |
+
qmax=self.cache_qmax)
|
| 502 |
+
value = quantize_cache_v(value.permute(0, 2, 1, 3),
|
| 503 |
+
bits=8,
|
| 504 |
+
qmin=self.cache_qmin,
|
| 505 |
+
qmax=self.cache_qmax)
|
| 506 |
+
|
| 507 |
+
|
| 508 |
+
if layer_past is not None:
|
| 509 |
+
past_key, past_value = layer_past[0], layer_past[1]
|
| 510 |
+
if self.use_cache_quantization:
|
| 511 |
+
# use_cache_quantization:
|
| 512 |
+
# present=((q_key,key_scale,key_zero_point),
|
| 513 |
+
# (q_value,value_scale,value_zero_point))
|
| 514 |
+
key = (torch.cat((past_key[0], key[0]), dim=2),
|
| 515 |
+
torch.cat((past_key[1], key[1]), dim=2),
|
| 516 |
+
torch.cat((past_key[2], key[2]), dim=2))
|
| 517 |
+
value = (torch.cat((past_value[0], value[0]), dim=2),
|
| 518 |
+
torch.cat((past_value[1], value[1]), dim=2),
|
| 519 |
+
torch.cat((past_value[2], value[2]), dim=2))
|
| 520 |
+
else:
|
| 521 |
+
# not use_cache_quantization:
|
| 522 |
+
# present=(key,value)
|
| 523 |
+
key = torch.cat((past_key, key), dim=1)
|
| 524 |
+
value = torch.cat((past_value, value), dim=1)
|
| 525 |
+
|
| 526 |
+
if use_cache:
|
| 527 |
+
present = (key, value)
|
| 528 |
+
else:
|
| 529 |
+
present = None
|
| 530 |
+
|
| 531 |
+
if self.use_logn_attn and not self.training:
|
| 532 |
+
if self.use_cache_quantization:
|
| 533 |
+
seq_start = key[0].size(2) - query.size(1)
|
| 534 |
+
seq_end = key[0].size(2)
|
| 535 |
+
else:
|
| 536 |
+
seq_start = key.size(1) - query.size(1)
|
| 537 |
+
seq_end = key.size(1)
|
| 538 |
+
logn_tensor = self.logn_tensor[:, seq_start:seq_end, :, :].type_as(query)
|
| 539 |
+
query = query * logn_tensor.expand_as(query)
|
| 540 |
+
|
| 541 |
+
if (
|
| 542 |
+
self.use_flash_attn
|
| 543 |
+
and flash_attn_unpadded_func is not None
|
| 544 |
+
and not self.is_fp32
|
| 545 |
+
and query.is_cuda
|
| 546 |
+
):
|
| 547 |
+
q, k, v = query, key, value
|
| 548 |
+
attn_output = self.core_attention_flash(q, k, v, attention_mask=attention_mask)
|
| 549 |
+
else:
|
| 550 |
+
query = query.permute(0, 2, 1, 3)
|
| 551 |
+
if not self.use_cache_quantization:
|
| 552 |
+
key = key.permute(0, 2, 1, 3)
|
| 553 |
+
value = value.permute(0, 2, 1, 3)
|
| 554 |
+
if (
|
| 555 |
+
registered_causal_mask is None
|
| 556 |
+
and self.use_flash_attn
|
| 557 |
+
and flash_attn_unpadded_func is not None
|
| 558 |
+
and not self.is_fp32
|
| 559 |
+
and not query.is_cuda
|
| 560 |
+
):
|
| 561 |
+
raise Exception(_ERROR_INPUT_CPU_QUERY_WITH_FLASH_ATTN_ACTIVATED)
|
| 562 |
+
|
| 563 |
+
if not self.use_cache_quantization and SUPPORT_TORCH2:
|
| 564 |
+
causal_mask = registered_causal_mask[
|
| 565 |
+
:, :, key.size(-2) - query.size(-2): key.size(-2), :key.size(-2)
|
| 566 |
+
]
|
| 567 |
+
if attention_mask is not None:
|
| 568 |
+
attention_mask = attention_mask.expand(
|
| 569 |
+
-1, -1, causal_mask.size(2), -1
|
| 570 |
+
).masked_fill(~causal_mask, torch.finfo(query.dtype).min)
|
| 571 |
+
else:
|
| 572 |
+
attention_mask = causal_mask
|
| 573 |
+
attn_output = F.scaled_dot_product_attention(
|
| 574 |
+
query, key, value, attn_mask=attention_mask
|
| 575 |
+
).transpose(1, 2)
|
| 576 |
+
attn_weight = None
|
| 577 |
+
else:
|
| 578 |
+
attn_output, attn_weight = self._attn(
|
| 579 |
+
query, key, value, registered_causal_mask, attention_mask, head_mask
|
| 580 |
+
)
|
| 581 |
+
context_layer = self._merge_heads(
|
| 582 |
+
attn_output, self.num_heads, self.head_dim
|
| 583 |
+
)
|
| 584 |
+
|
| 585 |
+
attn_output = self.c_proj(context_layer)
|
| 586 |
+
|
| 587 |
+
outputs = (attn_output, present)
|
| 588 |
+
if output_attentions:
|
| 589 |
+
if (
|
| 590 |
+
self.use_flash_attn
|
| 591 |
+
and flash_attn_unpadded_func is not None
|
| 592 |
+
and not self.is_fp32
|
| 593 |
+
):
|
| 594 |
+
raise ValueError("Cannot output attentions while using flash-attn")
|
| 595 |
+
else:
|
| 596 |
+
outputs += (attn_weight,)
|
| 597 |
+
|
| 598 |
+
return outputs
|
| 599 |
+
|
| 600 |
+
|
| 601 |
+
class QWenMLP(nn.Module):
|
| 602 |
+
def __init__(self, config):
|
| 603 |
+
super().__init__()
|
| 604 |
+
self.w1 = nn.Linear(
|
| 605 |
+
config.hidden_size, config.intermediate_size // 2, bias=not config.no_bias
|
| 606 |
+
)
|
| 607 |
+
self.w2 = nn.Linear(
|
| 608 |
+
config.hidden_size, config.intermediate_size // 2, bias=not config.no_bias
|
| 609 |
+
)
|
| 610 |
+
ff_dim_in = config.intermediate_size // 2
|
| 611 |
+
self.c_proj = nn.Linear(ff_dim_in, config.hidden_size, bias=not config.no_bias)
|
| 612 |
+
|
| 613 |
+
def forward(self, hidden_states):
|
| 614 |
+
a1 = self.w1(hidden_states)
|
| 615 |
+
a2 = self.w2(hidden_states)
|
| 616 |
+
intermediate_parallel = a1 * F.silu(a2)
|
| 617 |
+
output = self.c_proj(intermediate_parallel)
|
| 618 |
+
return output
|
| 619 |
+
|
| 620 |
+
class QWenBlock(nn.Module):
|
| 621 |
+
def __init__(self, config):
|
| 622 |
+
super().__init__()
|
| 623 |
+
hidden_size = config.hidden_size
|
| 624 |
+
self.bf16 = config.bf16
|
| 625 |
+
|
| 626 |
+
self.ln_1 = RMSNorm(
|
| 627 |
+
hidden_size,
|
| 628 |
+
eps=config.layer_norm_epsilon,
|
| 629 |
+
)
|
| 630 |
+
self.attn = QWenAttention(config)
|
| 631 |
+
self.ln_2 = RMSNorm(
|
| 632 |
+
hidden_size,
|
| 633 |
+
eps=config.layer_norm_epsilon,
|
| 634 |
+
)
|
| 635 |
+
|
| 636 |
+
self.mlp = QWenMLP(config)
|
| 637 |
+
|
| 638 |
+
def forward(
|
| 639 |
+
self,
|
| 640 |
+
hidden_states: Optional[Tuple[torch.FloatTensor]],
|
| 641 |
+
rotary_pos_emb_list: Optional[List[List[torch.Tensor]]] = None,
|
| 642 |
+
registered_causal_mask: Optional[torch.Tensor] = None,
|
| 643 |
+
layer_past: Optional[Tuple[torch.Tensor]] = None,
|
| 644 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
| 645 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
| 646 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 647 |
+
encoder_attention_mask: Optional[torch.FloatTensor] = None,
|
| 648 |
+
use_cache: Optional[bool] = False,
|
| 649 |
+
output_attentions: Optional[bool] = False,
|
| 650 |
+
):
|
| 651 |
+
layernorm_output = self.ln_1(hidden_states)
|
| 652 |
+
|
| 653 |
+
attn_outputs = self.attn(
|
| 654 |
+
layernorm_output,
|
| 655 |
+
rotary_pos_emb_list,
|
| 656 |
+
registered_causal_mask=registered_causal_mask,
|
| 657 |
+
layer_past=layer_past,
|
| 658 |
+
attention_mask=attention_mask,
|
| 659 |
+
head_mask=head_mask,
|
| 660 |
+
use_cache=use_cache,
|
| 661 |
+
output_attentions=output_attentions,
|
| 662 |
+
)
|
| 663 |
+
attn_output = attn_outputs[0]
|
| 664 |
+
|
| 665 |
+
outputs = attn_outputs[1:]
|
| 666 |
+
|
| 667 |
+
residual = hidden_states
|
| 668 |
+
layernorm_input = attn_output + residual
|
| 669 |
+
|
| 670 |
+
layernorm_output = self.ln_2(layernorm_input)
|
| 671 |
+
|
| 672 |
+
residual = layernorm_input
|
| 673 |
+
mlp_output = self.mlp(layernorm_output)
|
| 674 |
+
hidden_states = residual + mlp_output
|
| 675 |
+
|
| 676 |
+
if use_cache:
|
| 677 |
+
outputs = (hidden_states,) + outputs
|
| 678 |
+
else:
|
| 679 |
+
outputs = (hidden_states,) + outputs[1:]
|
| 680 |
+
|
| 681 |
+
return outputs
|
| 682 |
+
|
| 683 |
+
|
| 684 |
+
class QWenPreTrainedModel(PreTrainedModel):
|
| 685 |
+
config_class = QWenConfig
|
| 686 |
+
base_model_prefix = "transformer"
|
| 687 |
+
is_parallelizable = False
|
| 688 |
+
supports_gradient_checkpointing = True
|
| 689 |
+
_no_split_modules = ["QWenBlock"]
|
| 690 |
+
|
| 691 |
+
def __init__(self, *inputs, **kwargs):
|
| 692 |
+
super().__init__(*inputs, **kwargs)
|
| 693 |
+
|
| 694 |
+
def _init_weights(self, module):
|
| 695 |
+
"""Initialize the weights."""
|
| 696 |
+
if isinstance(module, nn.Linear):
|
| 697 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
| 698 |
+
if module.bias is not None:
|
| 699 |
+
module.bias.data.zero_()
|
| 700 |
+
elif isinstance(module, nn.Embedding):
|
| 701 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
| 702 |
+
if module.padding_idx is not None:
|
| 703 |
+
module.weight.data[module.padding_idx].zero_()
|
| 704 |
+
elif isinstance(module, RMSNorm):
|
| 705 |
+
module.weight.data.fill_(1.0)
|
| 706 |
+
|
| 707 |
+
for name, p in module.named_parameters():
|
| 708 |
+
if name == "c_proj.weight":
|
| 709 |
+
p.data.normal_(
|
| 710 |
+
mean=0.0,
|
| 711 |
+
std=(
|
| 712 |
+
self.config.initializer_range
|
| 713 |
+
/ math.sqrt(2 * self.config.num_hidden_layers)
|
| 714 |
+
),
|
| 715 |
+
)
|
| 716 |
+
|
| 717 |
+
def _set_gradient_checkpointing(self, module, value=False):
|
| 718 |
+
if isinstance(module, QWenModel):
|
| 719 |
+
module.gradient_checkpointing = value
|
| 720 |
+
|
| 721 |
+
|
| 722 |
+
class QWenModel(QWenPreTrainedModel):
|
| 723 |
+
_keys_to_ignore_on_load_missing = ["attn.masked_bias"]
|
| 724 |
+
|
| 725 |
+
def __init__(self, config):
|
| 726 |
+
super().__init__(config)
|
| 727 |
+
self.vocab_size = config.vocab_size
|
| 728 |
+
self.num_hidden_layers = config.num_hidden_layers
|
| 729 |
+
self.embed_dim = config.hidden_size
|
| 730 |
+
self.use_cache_quantization = self.config.use_cache_quantization if hasattr(self.config, 'use_cache_quantization') else False
|
| 731 |
+
|
| 732 |
+
self.gradient_checkpointing = False
|
| 733 |
+
self.use_dynamic_ntk = config.use_dynamic_ntk
|
| 734 |
+
self.seq_length = config.seq_length
|
| 735 |
+
|
| 736 |
+
self.wte = nn.Embedding(self.vocab_size, self.embed_dim)
|
| 737 |
+
|
| 738 |
+
self.drop = nn.Dropout(config.emb_dropout_prob)
|
| 739 |
+
|
| 740 |
+
if config.rotary_pct == 1.0:
|
| 741 |
+
self.rotary_ndims = None
|
| 742 |
+
else:
|
| 743 |
+
assert config.rotary_pct < 1
|
| 744 |
+
self.rotary_ndims = int(
|
| 745 |
+
config.kv_channels * config.rotary_pct
|
| 746 |
+
)
|
| 747 |
+
dim = (
|
| 748 |
+
self.rotary_ndims
|
| 749 |
+
if self.rotary_ndims is not None
|
| 750 |
+
else config.kv_channels
|
| 751 |
+
)
|
| 752 |
+
self.rotary_emb = RotaryEmbedding(dim, base=config.rotary_emb_base)
|
| 753 |
+
|
| 754 |
+
self.use_flash_attn = config.use_flash_attn
|
| 755 |
+
self.is_fp32 = not (config.bf16 or config.fp16)
|
| 756 |
+
if (
|
| 757 |
+
self.use_flash_attn
|
| 758 |
+
and flash_attn_unpadded_func is not None
|
| 759 |
+
and not self.is_fp32
|
| 760 |
+
):
|
| 761 |
+
self.registered_causal_mask = None
|
| 762 |
+
else:
|
| 763 |
+
max_positions = config.max_position_embeddings
|
| 764 |
+
self.register_buffer(
|
| 765 |
+
"registered_causal_mask",
|
| 766 |
+
torch.tril(
|
| 767 |
+
torch.ones((max_positions, max_positions), dtype=torch.bool)
|
| 768 |
+
).view(1, 1, max_positions, max_positions),
|
| 769 |
+
persistent=False,
|
| 770 |
+
)
|
| 771 |
+
|
| 772 |
+
self.h = nn.ModuleList(
|
| 773 |
+
[
|
| 774 |
+
QWenBlock(
|
| 775 |
+
config
|
| 776 |
+
)
|
| 777 |
+
for i in range(config.num_hidden_layers)
|
| 778 |
+
]
|
| 779 |
+
)
|
| 780 |
+
self.ln_f = RMSNorm(
|
| 781 |
+
self.embed_dim,
|
| 782 |
+
eps=config.layer_norm_epsilon,
|
| 783 |
+
)
|
| 784 |
+
|
| 785 |
+
self.post_init()
|
| 786 |
+
|
| 787 |
+
def get_input_embeddings(self):
|
| 788 |
+
return self.wte
|
| 789 |
+
|
| 790 |
+
def set_input_embeddings(self, new_embeddings):
|
| 791 |
+
self.wte = new_embeddings
|
| 792 |
+
|
| 793 |
+
def get_ntk_alpha(self, true_seq_len):
|
| 794 |
+
context_value = math.log(true_seq_len / self.seq_length, 2) + 1
|
| 795 |
+
ntk_alpha = 2 ** math.ceil(context_value) - 1
|
| 796 |
+
ntk_alpha = max(ntk_alpha, 1)
|
| 797 |
+
return ntk_alpha
|
| 798 |
+
|
| 799 |
+
def forward(
|
| 800 |
+
self,
|
| 801 |
+
input_ids: Optional[torch.LongTensor] = None,
|
| 802 |
+
past_key_values: Optional[Tuple[Tuple[torch.Tensor]]] = None,
|
| 803 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
| 804 |
+
token_type_ids: Optional[torch.LongTensor] = None,
|
| 805 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 806 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
| 807 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
| 808 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 809 |
+
encoder_attention_mask: Optional[torch.FloatTensor] = None,
|
| 810 |
+
use_cache: Optional[bool] = None,
|
| 811 |
+
output_attentions: Optional[bool] = None,
|
| 812 |
+
output_hidden_states: Optional[bool] = None,
|
| 813 |
+
return_dict: Optional[bool] = None,
|
| 814 |
+
):
|
| 815 |
+
output_attentions = (
|
| 816 |
+
output_attentions
|
| 817 |
+
if output_attentions is not None
|
| 818 |
+
else self.config.output_attentions
|
| 819 |
+
)
|
| 820 |
+
output_hidden_states = (
|
| 821 |
+
output_hidden_states
|
| 822 |
+
if output_hidden_states is not None
|
| 823 |
+
else self.config.output_hidden_states
|
| 824 |
+
)
|
| 825 |
+
use_cache = use_cache if use_cache is not None else self.config.use_cache
|
| 826 |
+
return_dict = (
|
| 827 |
+
return_dict if return_dict is not None else self.config.use_return_dict
|
| 828 |
+
)
|
| 829 |
+
|
| 830 |
+
if input_ids is not None and inputs_embeds is not None:
|
| 831 |
+
raise ValueError(
|
| 832 |
+
"You cannot specify both input_ids and inputs_embeds at the same time"
|
| 833 |
+
)
|
| 834 |
+
elif input_ids is not None:
|
| 835 |
+
input_shape = input_ids.size()
|
| 836 |
+
input_ids = input_ids.view(-1, input_shape[-1])
|
| 837 |
+
batch_size = input_ids.shape[0]
|
| 838 |
+
elif inputs_embeds is not None:
|
| 839 |
+
input_shape = inputs_embeds.size()[:-1]
|
| 840 |
+
batch_size = inputs_embeds.shape[0]
|
| 841 |
+
else:
|
| 842 |
+
raise ValueError("You have to specify either input_ids or inputs_embeds")
|
| 843 |
+
|
| 844 |
+
device = input_ids.device if input_ids is not None else inputs_embeds.device
|
| 845 |
+
|
| 846 |
+
if token_type_ids is not None:
|
| 847 |
+
token_type_ids = token_type_ids.view(-1, input_shape[-1])
|
| 848 |
+
if position_ids is not None:
|
| 849 |
+
position_ids = position_ids.view(-1, input_shape[-1])
|
| 850 |
+
|
| 851 |
+
if past_key_values is None:
|
| 852 |
+
past_length = 0
|
| 853 |
+
past_key_values = tuple([None] * len(self.h))
|
| 854 |
+
else:
|
| 855 |
+
if self.use_cache_quantization:
|
| 856 |
+
past_length = past_key_values[0][0][0].size(2)
|
| 857 |
+
else:
|
| 858 |
+
past_length = past_key_values[0][0].size(-2)
|
| 859 |
+
if position_ids is None:
|
| 860 |
+
position_ids = torch.arange(
|
| 861 |
+
past_length,
|
| 862 |
+
input_shape[-1] + past_length,
|
| 863 |
+
dtype=torch.long,
|
| 864 |
+
device=device,
|
| 865 |
+
)
|
| 866 |
+
position_ids = position_ids.unsqueeze(0).view(-1, input_shape[-1])
|
| 867 |
+
|
| 868 |
+
if attention_mask is not None:
|
| 869 |
+
if batch_size <= 0:
|
| 870 |
+
raise ValueError("batch_size has to be defined and > 0")
|
| 871 |
+
attention_mask = attention_mask.view(batch_size, -1)
|
| 872 |
+
attention_mask = attention_mask[:, None, None, :]
|
| 873 |
+
attention_mask = attention_mask.to(dtype=self.dtype)
|
| 874 |
+
attention_mask = (1.0 - attention_mask) * torch.finfo(self.dtype).min
|
| 875 |
+
|
| 876 |
+
encoder_attention_mask = None
|
| 877 |
+
head_mask = self.get_head_mask(head_mask, self.config.num_hidden_layers)
|
| 878 |
+
|
| 879 |
+
if inputs_embeds is None:
|
| 880 |
+
inputs_embeds = self.wte(input_ids)
|
| 881 |
+
hidden_states = inputs_embeds
|
| 882 |
+
|
| 883 |
+
kv_seq_len = hidden_states.size()[1]
|
| 884 |
+
if past_key_values[0] is not None:
|
| 885 |
+
# past key values[0][0] shape: bs * seq_len * head_num * dim
|
| 886 |
+
if self.use_cache_quantization:
|
| 887 |
+
kv_seq_len += past_key_values[0][0][0].shape[2]
|
| 888 |
+
else:
|
| 889 |
+
kv_seq_len += past_key_values[0][0].shape[1]
|
| 890 |
+
|
| 891 |
+
if self.training or not self.use_dynamic_ntk:
|
| 892 |
+
ntk_alpha_list = [1.0]
|
| 893 |
+
elif kv_seq_len != hidden_states.size()[1]:
|
| 894 |
+
ntk_alpha_list = self.rotary_emb._ntk_alpha_cached_list
|
| 895 |
+
else:
|
| 896 |
+
ntk_alpha_list = []
|
| 897 |
+
if attention_mask is not None and kv_seq_len > self.seq_length:
|
| 898 |
+
true_seq_lens = attention_mask.squeeze(1).squeeze(1).eq(0).sum(dim=-1, dtype=torch.int32)
|
| 899 |
+
for i in range(hidden_states.size()[0]):
|
| 900 |
+
true_seq_len = true_seq_lens[i].item()
|
| 901 |
+
ntk_alpha = self.get_ntk_alpha(true_seq_len)
|
| 902 |
+
ntk_alpha_list.append(ntk_alpha)
|
| 903 |
+
else:
|
| 904 |
+
ntk_alpha = self.get_ntk_alpha(kv_seq_len)
|
| 905 |
+
ntk_alpha_list.append(ntk_alpha)
|
| 906 |
+
self.rotary_emb._ntk_alpha_cached_list = ntk_alpha_list
|
| 907 |
+
rotary_pos_emb_list = [
|
| 908 |
+
self.rotary_emb(kv_seq_len, ntk_alpha=ntk_alpha) for ntk_alpha in ntk_alpha_list
|
| 909 |
+
]
|
| 910 |
+
|
| 911 |
+
hidden_states = self.drop(hidden_states)
|
| 912 |
+
output_shape = input_shape + (hidden_states.size(-1),)
|
| 913 |
+
|
| 914 |
+
if self.gradient_checkpointing and self.training:
|
| 915 |
+
if use_cache:
|
| 916 |
+
logger.warning_once(
|
| 917 |
+
"`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
|
| 918 |
+
)
|
| 919 |
+
use_cache = False
|
| 920 |
+
|
| 921 |
+
presents = () if use_cache else None
|
| 922 |
+
all_self_attentions = () if output_attentions else None
|
| 923 |
+
all_hidden_states = () if output_hidden_states else None
|
| 924 |
+
for i, (block, layer_past) in enumerate(zip(self.h, past_key_values)):
|
| 925 |
+
|
| 926 |
+
if output_hidden_states:
|
| 927 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
| 928 |
+
|
| 929 |
+
if self.gradient_checkpointing and self.training:
|
| 930 |
+
|
| 931 |
+
def create_custom_forward(module):
|
| 932 |
+
def custom_forward(*inputs):
|
| 933 |
+
# None for past_key_value
|
| 934 |
+
return module(*inputs, use_cache, output_attentions)
|
| 935 |
+
|
| 936 |
+
return custom_forward
|
| 937 |
+
|
| 938 |
+
outputs = torch.utils.checkpoint.checkpoint(
|
| 939 |
+
create_custom_forward(block),
|
| 940 |
+
hidden_states,
|
| 941 |
+
rotary_pos_emb_list,
|
| 942 |
+
self.registered_causal_mask,
|
| 943 |
+
None,
|
| 944 |
+
attention_mask,
|
| 945 |
+
head_mask[i],
|
| 946 |
+
encoder_hidden_states,
|
| 947 |
+
encoder_attention_mask,
|
| 948 |
+
)
|
| 949 |
+
else:
|
| 950 |
+
outputs = block(
|
| 951 |
+
hidden_states,
|
| 952 |
+
layer_past=layer_past,
|
| 953 |
+
rotary_pos_emb_list=rotary_pos_emb_list,
|
| 954 |
+
registered_causal_mask=self.registered_causal_mask,
|
| 955 |
+
attention_mask=attention_mask,
|
| 956 |
+
head_mask=head_mask[i],
|
| 957 |
+
encoder_hidden_states=encoder_hidden_states,
|
| 958 |
+
encoder_attention_mask=encoder_attention_mask,
|
| 959 |
+
use_cache=use_cache,
|
| 960 |
+
output_attentions=output_attentions,
|
| 961 |
+
)
|
| 962 |
+
|
| 963 |
+
hidden_states = outputs[0]
|
| 964 |
+
if use_cache is True:
|
| 965 |
+
presents = presents + (outputs[1],)
|
| 966 |
+
|
| 967 |
+
if output_attentions:
|
| 968 |
+
all_self_attentions = all_self_attentions + (outputs[2 if use_cache else 1],)
|
| 969 |
+
|
| 970 |
+
hidden_states = self.ln_f(hidden_states)
|
| 971 |
+
hidden_states = hidden_states.view(output_shape)
|
| 972 |
+
# Add last hidden state
|
| 973 |
+
if output_hidden_states:
|
| 974 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
| 975 |
+
|
| 976 |
+
if not return_dict:
|
| 977 |
+
return tuple(
|
| 978 |
+
v for v in [hidden_states, presents, all_hidden_states] if v is not None
|
| 979 |
+
)
|
| 980 |
+
|
| 981 |
+
return BaseModelOutputWithPast(
|
| 982 |
+
last_hidden_state=hidden_states,
|
| 983 |
+
past_key_values=presents,
|
| 984 |
+
hidden_states=all_hidden_states,
|
| 985 |
+
attentions=all_self_attentions,
|
| 986 |
+
)
|
| 987 |
+
|
| 988 |
+
|
| 989 |
+
class QWenLMHeadModel(QWenPreTrainedModel):
|
| 990 |
+
_keys_to_ignore_on_load_missing = [r"h\.\d+\.attn\.rotary_emb\.inv_freq"]
|
| 991 |
+
_keys_to_ignore_on_load_unexpected = [r"h\.\d+\.attn\.masked_bias"]
|
| 992 |
+
|
| 993 |
+
def __init__(self, config):
|
| 994 |
+
super().__init__(config)
|
| 995 |
+
assert (
|
| 996 |
+
config.bf16 + config.fp16 + config.fp32 <= 1
|
| 997 |
+
), "Only one of \"bf16\", \"fp16\", \"fp32\" can be true"
|
| 998 |
+
logger.warn(
|
| 999 |
+
"Warning: please make sure that you are using the latest codes and checkpoints, "
|
| 1000 |
+
"especially if you used Qwen-7B before 09.25.2023."
|
| 1001 |
+
"请使用最新模型和代码,尤其如果你在9月25日前已经开始使用Qwen-7B,千万注意不要使用错误代码和模型。"
|
| 1002 |
+
)
|
| 1003 |
+
|
| 1004 |
+
autoset_precision = config.bf16 + config.fp16 + config.fp32 == 0
|
| 1005 |
+
|
| 1006 |
+
if autoset_precision:
|
| 1007 |
+
if SUPPORT_BF16:
|
| 1008 |
+
logger.warn(
|
| 1009 |
+
"The model is automatically converting to bf16 for faster inference. "
|
| 1010 |
+
"If you want to disable the automatic precision, please manually add bf16/fp16/fp32=True to \"AutoModelForCausalLM.from_pretrained\"."
|
| 1011 |
+
)
|
| 1012 |
+
config.bf16 = True
|
| 1013 |
+
elif SUPPORT_FP16:
|
| 1014 |
+
logger.warn(
|
| 1015 |
+
"The model is automatically converting to fp16 for faster inference. "
|
| 1016 |
+
"If you want to disable the automatic precision, please manually add bf16/fp16/fp32=True to \"AutoModelForCausalLM.from_pretrained\"."
|
| 1017 |
+
)
|
| 1018 |
+
config.fp16 = True
|
| 1019 |
+
else:
|
| 1020 |
+
config.fp32 = True
|
| 1021 |
+
|
| 1022 |
+
if config.bf16 and SUPPORT_CUDA and not SUPPORT_BF16:
|
| 1023 |
+
logger.warn("Your device does NOT seem to support bf16, you can switch to fp16 or fp32 by by passing fp16/fp32=True in \"AutoModelForCausalLM.from_pretrained\".")
|
| 1024 |
+
if config.fp16 and SUPPORT_CUDA and not SUPPORT_FP16:
|
| 1025 |
+
logger.warn("Your device does NOT support faster inference with fp16, please switch to fp32 which is likely to be faster")
|
| 1026 |
+
if config.fp32:
|
| 1027 |
+
if SUPPORT_BF16:
|
| 1028 |
+
logger.warn("Your device support faster inference by passing bf16=True in \"AutoModelForCausalLM.from_pretrained\".")
|
| 1029 |
+
elif SUPPORT_FP16:
|
| 1030 |
+
logger.warn("Your device support faster inference by passing fp16=True in \"AutoModelForCausalLM.from_pretrained\".")
|
| 1031 |
+
|
| 1032 |
+
if config.use_flash_attn == "auto":
|
| 1033 |
+
if config.bf16 or config.fp16:
|
| 1034 |
+
logger.warn("Try importing flash-attention for faster inference...")
|
| 1035 |
+
config.use_flash_attn = True
|
| 1036 |
+
else:
|
| 1037 |
+
config.use_flash_attn = False
|
| 1038 |
+
if config.use_flash_attn and config.fp32:
|
| 1039 |
+
logger.warn("Flash attention will be disabled because it does NOT support fp32.")
|
| 1040 |
+
|
| 1041 |
+
if config.use_flash_attn:
|
| 1042 |
+
_import_flash_attn()
|
| 1043 |
+
|
| 1044 |
+
self.transformer = QWenModel(config)
|
| 1045 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
| 1046 |
+
|
| 1047 |
+
if config.bf16:
|
| 1048 |
+
self.transformer.bfloat16()
|
| 1049 |
+
self.lm_head.bfloat16()
|
| 1050 |
+
if config.fp16:
|
| 1051 |
+
self.transformer.half()
|
| 1052 |
+
self.lm_head.half()
|
| 1053 |
+
self.post_init()
|
| 1054 |
+
|
| 1055 |
+
|
| 1056 |
+
def get_output_embeddings(self):
|
| 1057 |
+
return self.lm_head
|
| 1058 |
+
|
| 1059 |
+
def set_output_embeddings(self, new_embeddings):
|
| 1060 |
+
self.lm_head = new_embeddings
|
| 1061 |
+
|
| 1062 |
+
def prepare_inputs_for_generation(
|
| 1063 |
+
self, input_ids, past_key_values=None, inputs_embeds=None, **kwargs
|
| 1064 |
+
):
|
| 1065 |
+
token_type_ids = kwargs.get("token_type_ids", None)
|
| 1066 |
+
if past_key_values:
|
| 1067 |
+
input_ids = input_ids[:, -1].unsqueeze(-1)
|
| 1068 |
+
if token_type_ids is not None:
|
| 1069 |
+
token_type_ids = token_type_ids[:, -1].unsqueeze(-1)
|
| 1070 |
+
|
| 1071 |
+
attention_mask = kwargs.get("attention_mask", None)
|
| 1072 |
+
position_ids = kwargs.get("position_ids", None)
|
| 1073 |
+
|
| 1074 |
+
if attention_mask is not None and position_ids is None:
|
| 1075 |
+
position_ids = attention_mask.long().cumsum(-1) - 1
|
| 1076 |
+
position_ids.masked_fill_(attention_mask == 0, 1)
|
| 1077 |
+
if past_key_values:
|
| 1078 |
+
position_ids = position_ids[:, -1].unsqueeze(-1)
|
| 1079 |
+
else:
|
| 1080 |
+
position_ids = None
|
| 1081 |
+
|
| 1082 |
+
if inputs_embeds is not None and past_key_values is None:
|
| 1083 |
+
model_inputs = {"inputs_embeds": inputs_embeds}
|
| 1084 |
+
else:
|
| 1085 |
+
model_inputs = {"input_ids": input_ids}
|
| 1086 |
+
|
| 1087 |
+
model_inputs.update(
|
| 1088 |
+
{
|
| 1089 |
+
"past_key_values": past_key_values,
|
| 1090 |
+
"use_cache": kwargs.get("use_cache"),
|
| 1091 |
+
"position_ids": position_ids,
|
| 1092 |
+
"attention_mask": attention_mask,
|
| 1093 |
+
"token_type_ids": token_type_ids,
|
| 1094 |
+
}
|
| 1095 |
+
)
|
| 1096 |
+
return model_inputs
|
| 1097 |
+
|
| 1098 |
+
def forward(
|
| 1099 |
+
self,
|
| 1100 |
+
input_ids: Optional[torch.LongTensor] = None,
|
| 1101 |
+
past_key_values: Optional[Tuple[Tuple[torch.Tensor]]] = None,
|
| 1102 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
| 1103 |
+
token_type_ids: Optional[torch.LongTensor] = None,
|
| 1104 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 1105 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
| 1106 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
| 1107 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 1108 |
+
encoder_attention_mask: Optional[torch.FloatTensor] = None,
|
| 1109 |
+
labels: Optional[torch.LongTensor] = None,
|
| 1110 |
+
use_cache: Optional[bool] = None,
|
| 1111 |
+
output_attentions: Optional[bool] = None,
|
| 1112 |
+
output_hidden_states: Optional[bool] = None,
|
| 1113 |
+
return_dict: Optional[bool] = None,
|
| 1114 |
+
) -> Union[Tuple, CausalLMOutputWithPast]:
|
| 1115 |
+
|
| 1116 |
+
return_dict = (
|
| 1117 |
+
return_dict if return_dict is not None else self.config.use_return_dict
|
| 1118 |
+
)
|
| 1119 |
+
|
| 1120 |
+
transformer_outputs = self.transformer(
|
| 1121 |
+
input_ids,
|
| 1122 |
+
past_key_values=past_key_values,
|
| 1123 |
+
attention_mask=attention_mask,
|
| 1124 |
+
token_type_ids=token_type_ids,
|
| 1125 |
+
position_ids=position_ids,
|
| 1126 |
+
head_mask=head_mask,
|
| 1127 |
+
inputs_embeds=inputs_embeds,
|
| 1128 |
+
encoder_hidden_states=encoder_hidden_states,
|
| 1129 |
+
encoder_attention_mask=encoder_attention_mask,
|
| 1130 |
+
use_cache=use_cache,
|
| 1131 |
+
output_attentions=output_attentions,
|
| 1132 |
+
output_hidden_states=output_hidden_states,
|
| 1133 |
+
return_dict=return_dict,
|
| 1134 |
+
)
|
| 1135 |
+
hidden_states = transformer_outputs[0]
|
| 1136 |
+
|
| 1137 |
+
lm_logits = self.lm_head(hidden_states)
|
| 1138 |
+
|
| 1139 |
+
loss = None
|
| 1140 |
+
if labels is not None:
|
| 1141 |
+
labels = labels.to(lm_logits.device)
|
| 1142 |
+
shift_logits = lm_logits[..., :-1, :].contiguous()
|
| 1143 |
+
shift_labels = labels[..., 1:].contiguous()
|
| 1144 |
+
loss_fct = CrossEntropyLoss()
|
| 1145 |
+
loss = loss_fct(
|
| 1146 |
+
shift_logits.view(-1, shift_logits.size(-1)), shift_labels.view(-1)
|
| 1147 |
+
)
|
| 1148 |
+
|
| 1149 |
+
if not return_dict:
|
| 1150 |
+
output = (lm_logits,) + transformer_outputs[1:]
|
| 1151 |
+
return ((loss,) + output) if loss is not None else output
|
| 1152 |
+
|
| 1153 |
+
return CausalLMOutputWithPast(
|
| 1154 |
+
loss=loss,
|
| 1155 |
+
logits=lm_logits,
|
| 1156 |
+
past_key_values=transformer_outputs.past_key_values,
|
| 1157 |
+
hidden_states=transformer_outputs.hidden_states,
|
| 1158 |
+
attentions=transformer_outputs.attentions,
|
| 1159 |
+
)
|
| 1160 |
+
|
| 1161 |
+
@staticmethod
|
| 1162 |
+
def _reorder_cache(
|
| 1163 |
+
past_key_values: Tuple[Tuple[torch.Tensor]], beam_idx: torch.Tensor
|
| 1164 |
+
) -> Tuple[Tuple[torch.Tensor]]:
|
| 1165 |
+
|
| 1166 |
+
return tuple(
|
| 1167 |
+
tuple(
|
| 1168 |
+
past_state.index_select(0, beam_idx.to(past_state.device))
|
| 1169 |
+
for past_state in layer_past
|
| 1170 |
+
)
|
| 1171 |
+
for layer_past in past_key_values
|
| 1172 |
+
)
|
| 1173 |
+
|
| 1174 |
+
def chat(
|
| 1175 |
+
self,
|
| 1176 |
+
tokenizer: PreTrainedTokenizer,
|
| 1177 |
+
query: str,
|
| 1178 |
+
history: Optional[HistoryType],
|
| 1179 |
+
system: str = "You are a helpful assistant.",
|
| 1180 |
+
append_history: bool = True,
|
| 1181 |
+
stream: Optional[bool] = _SENTINEL,
|
| 1182 |
+
stop_words_ids: Optional[List[List[int]]] = None,
|
| 1183 |
+
generation_config: Optional[GenerationConfig] = None,
|
| 1184 |
+
**kwargs,
|
| 1185 |
+
) -> Tuple[str, HistoryType]:
|
| 1186 |
+
generation_config = generation_config if generation_config is not None else self.generation_config
|
| 1187 |
+
|
| 1188 |
+
assert stream is _SENTINEL, _ERROR_STREAM_IN_CHAT
|
| 1189 |
+
assert generation_config.chat_format == 'chatml', _ERROR_BAD_CHAT_FORMAT
|
| 1190 |
+
if history is None:
|
| 1191 |
+
history = []
|
| 1192 |
+
if stop_words_ids is None:
|
| 1193 |
+
stop_words_ids = []
|
| 1194 |
+
|
| 1195 |
+
max_window_size = kwargs.get('max_window_size', None)
|
| 1196 |
+
if max_window_size is None:
|
| 1197 |
+
max_window_size = generation_config.max_window_size
|
| 1198 |
+
raw_text, context_tokens = make_context(
|
| 1199 |
+
tokenizer,
|
| 1200 |
+
query,
|
| 1201 |
+
history=history,
|
| 1202 |
+
system=system,
|
| 1203 |
+
max_window_size=max_window_size,
|
| 1204 |
+
chat_format=generation_config.chat_format,
|
| 1205 |
+
)
|
| 1206 |
+
|
| 1207 |
+
stop_words_ids.extend(get_stop_words_ids(
|
| 1208 |
+
generation_config.chat_format, tokenizer
|
| 1209 |
+
))
|
| 1210 |
+
input_ids = torch.tensor([context_tokens]).to(self.device)
|
| 1211 |
+
outputs = self.generate(
|
| 1212 |
+
input_ids,
|
| 1213 |
+
stop_words_ids=stop_words_ids,
|
| 1214 |
+
return_dict_in_generate=False,
|
| 1215 |
+
generation_config=generation_config,
|
| 1216 |
+
**kwargs,
|
| 1217 |
+
)
|
| 1218 |
+
|
| 1219 |
+
response = decode_tokens(
|
| 1220 |
+
outputs[0],
|
| 1221 |
+
tokenizer,
|
| 1222 |
+
raw_text_len=len(raw_text),
|
| 1223 |
+
context_length=len(context_tokens),
|
| 1224 |
+
chat_format=generation_config.chat_format,
|
| 1225 |
+
verbose=False,
|
| 1226 |
+
errors='replace'
|
| 1227 |
+
)
|
| 1228 |
+
|
| 1229 |
+
if append_history:
|
| 1230 |
+
history.append((query, response))
|
| 1231 |
+
|
| 1232 |
+
return response, history
|
| 1233 |
+
|
| 1234 |
+
def chat_stream(
|
| 1235 |
+
self,
|
| 1236 |
+
tokenizer: PreTrainedTokenizer,
|
| 1237 |
+
query: str,
|
| 1238 |
+
history: Optional[HistoryType],
|
| 1239 |
+
system: str = "You are a helpful assistant.",
|
| 1240 |
+
stop_words_ids: Optional[List[List[int]]] = None,
|
| 1241 |
+
logits_processor: Optional[LogitsProcessorList] = None,
|
| 1242 |
+
generation_config: Optional[GenerationConfig] = None,
|
| 1243 |
+
**kwargs,
|
| 1244 |
+
) -> Generator[str, Any, None]:
|
| 1245 |
+
generation_config = generation_config if generation_config is not None else self.generation_config
|
| 1246 |
+
assert generation_config.chat_format == 'chatml', _ERROR_BAD_CHAT_FORMAT
|
| 1247 |
+
if history is None:
|
| 1248 |
+
history = []
|
| 1249 |
+
if stop_words_ids is None:
|
| 1250 |
+
stop_words_ids = []
|
| 1251 |
+
|
| 1252 |
+
max_window_size = kwargs.get('max_window_size', None)
|
| 1253 |
+
if max_window_size is None:
|
| 1254 |
+
max_window_size = generation_config.max_window_size
|
| 1255 |
+
raw_text, context_tokens = make_context(
|
| 1256 |
+
tokenizer,
|
| 1257 |
+
query,
|
| 1258 |
+
history=history,
|
| 1259 |
+
system=system,
|
| 1260 |
+
max_window_size=max_window_size,
|
| 1261 |
+
chat_format=generation_config.chat_format,
|
| 1262 |
+
)
|
| 1263 |
+
|
| 1264 |
+
stop_words_ids.extend(get_stop_words_ids(
|
| 1265 |
+
generation_config.chat_format, tokenizer
|
| 1266 |
+
))
|
| 1267 |
+
if stop_words_ids is not None:
|
| 1268 |
+
stop_words_logits_processor = StopWordsLogitsProcessor(
|
| 1269 |
+
stop_words_ids=stop_words_ids,
|
| 1270 |
+
eos_token_id=generation_config.eos_token_id,
|
| 1271 |
+
)
|
| 1272 |
+
if logits_processor is None:
|
| 1273 |
+
logits_processor = LogitsProcessorList([stop_words_logits_processor])
|
| 1274 |
+
else:
|
| 1275 |
+
logits_processor.append(stop_words_logits_processor)
|
| 1276 |
+
input_ids = torch.tensor([context_tokens]).to(self.device)
|
| 1277 |
+
|
| 1278 |
+
from transformers_stream_generator.main import NewGenerationMixin, StreamGenerationConfig
|
| 1279 |
+
self.__class__.generate_stream = NewGenerationMixin.generate
|
| 1280 |
+
self.__class__.sample_stream = NewGenerationMixin.sample_stream
|
| 1281 |
+
stream_config = StreamGenerationConfig(**generation_config.to_dict(), do_stream=True)
|
| 1282 |
+
|
| 1283 |
+
def stream_generator():
|
| 1284 |
+
outputs = []
|
| 1285 |
+
for token in self.generate_stream(
|
| 1286 |
+
input_ids,
|
| 1287 |
+
return_dict_in_generate=False,
|
| 1288 |
+
generation_config=stream_config,
|
| 1289 |
+
logits_processor=logits_processor,
|
| 1290 |
+
seed=-1,
|
| 1291 |
+
**kwargs):
|
| 1292 |
+
outputs.append(token.item())
|
| 1293 |
+
yield tokenizer.decode(outputs, skip_special_tokens=True, errors='ignore')
|
| 1294 |
+
|
| 1295 |
+
return stream_generator()
|
| 1296 |
+
|
| 1297 |
+
def generate(
|
| 1298 |
+
self,
|
| 1299 |
+
inputs: Optional[torch.Tensor] = None,
|
| 1300 |
+
generation_config: Optional[GenerationConfig] = None,
|
| 1301 |
+
logits_processor: Optional[LogitsProcessorList] = None,
|
| 1302 |
+
stopping_criteria: Optional[StoppingCriteriaList] = None,
|
| 1303 |
+
prefix_allowed_tokens_fn: Optional[
|
| 1304 |
+
Callable[[int, torch.Tensor], List[int]]
|
| 1305 |
+
] = None,
|
| 1306 |
+
synced_gpus: Optional[bool] = None,
|
| 1307 |
+
assistant_model: Optional["PreTrainedModel"] = None,
|
| 1308 |
+
streamer: Optional["BaseStreamer"] = None,
|
| 1309 |
+
**kwargs,
|
| 1310 |
+
) -> Union[GenerateOutput, torch.LongTensor]:
|
| 1311 |
+
generation_config = generation_config if generation_config is not None else self.generation_config
|
| 1312 |
+
|
| 1313 |
+
# Process stop_words_ids.
|
| 1314 |
+
stop_words_ids = kwargs.pop("stop_words_ids", None)
|
| 1315 |
+
if stop_words_ids is None and generation_config is not None:
|
| 1316 |
+
stop_words_ids = getattr(generation_config, "stop_words_ids", None)
|
| 1317 |
+
if stop_words_ids is None:
|
| 1318 |
+
stop_words_ids = getattr(generation_config, "stop_words_ids", None)
|
| 1319 |
+
|
| 1320 |
+
if stop_words_ids is not None:
|
| 1321 |
+
stop_words_logits_processor = StopWordsLogitsProcessor(
|
| 1322 |
+
stop_words_ids=stop_words_ids,
|
| 1323 |
+
eos_token_id=generation_config.eos_token_id,
|
| 1324 |
+
)
|
| 1325 |
+
if logits_processor is None:
|
| 1326 |
+
logits_processor = LogitsProcessorList([stop_words_logits_processor])
|
| 1327 |
+
else:
|
| 1328 |
+
logits_processor.append(stop_words_logits_processor)
|
| 1329 |
+
|
| 1330 |
+
return super().generate(
|
| 1331 |
+
inputs,
|
| 1332 |
+
generation_config=generation_config,
|
| 1333 |
+
logits_processor=logits_processor,
|
| 1334 |
+
stopping_criteria=stopping_criteria,
|
| 1335 |
+
prefix_allowed_tokens_fn=prefix_allowed_tokens_fn,
|
| 1336 |
+
synced_gpus=synced_gpus,
|
| 1337 |
+
assistant_model=assistant_model,
|
| 1338 |
+
streamer=streamer,
|
| 1339 |
+
**kwargs,
|
| 1340 |
+
)
|
| 1341 |
+
|
| 1342 |
+
|
| 1343 |
+
class RotaryEmbedding(torch.nn.Module):
|
| 1344 |
+
def __init__(self, dim, base=10000):
|
| 1345 |
+
super().__init__()
|
| 1346 |
+
self.dim = dim
|
| 1347 |
+
self.base = base
|
| 1348 |
+
inv_freq = 1.0 / (base ** (torch.arange(0, dim, 2).float() / dim))
|
| 1349 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
| 1350 |
+
if importlib.util.find_spec("einops") is None:
|
| 1351 |
+
raise RuntimeError("einops is required for Rotary Embedding")
|
| 1352 |
+
|
| 1353 |
+
self._rotary_pos_emb_cache = None
|
| 1354 |
+
self._seq_len_cached = 0
|
| 1355 |
+
self._ntk_alpha_cached = 1.0
|
| 1356 |
+
self._ntk_alpha_cached_list = [1.0]
|
| 1357 |
+
|
| 1358 |
+
def update_rotary_pos_emb_cache(self, max_seq_len, offset=0, ntk_alpha=1.0):
|
| 1359 |
+
seqlen = max_seq_len + offset
|
| 1360 |
+
if seqlen > self._seq_len_cached or ntk_alpha != self._ntk_alpha_cached:
|
| 1361 |
+
base = self.base * ntk_alpha ** (self.dim / (self.dim - 2))
|
| 1362 |
+
self.inv_freq = 1.0 / (
|
| 1363 |
+
base
|
| 1364 |
+
** (
|
| 1365 |
+
torch.arange(0, self.dim, 2, device=self.inv_freq.device).float()
|
| 1366 |
+
/ self.dim
|
| 1367 |
+
)
|
| 1368 |
+
)
|
| 1369 |
+
self._seq_len_cached = max(2 * seqlen, 16)
|
| 1370 |
+
self._ntk_alpha_cached = ntk_alpha
|
| 1371 |
+
seq = torch.arange(self._seq_len_cached, device=self.inv_freq.device)
|
| 1372 |
+
freqs = torch.outer(seq.type_as(self.inv_freq), self.inv_freq)
|
| 1373 |
+
|
| 1374 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 1375 |
+
from einops import rearrange
|
| 1376 |
+
|
| 1377 |
+
emb = rearrange(emb, "n d -> 1 n 1 d")
|
| 1378 |
+
|
| 1379 |
+
cos, sin = emb.cos(), emb.sin()
|
| 1380 |
+
self._rotary_pos_emb_cache = [cos, sin]
|
| 1381 |
+
|
| 1382 |
+
def forward(self, max_seq_len, offset=0, ntk_alpha=1.0):
|
| 1383 |
+
self.update_rotary_pos_emb_cache(max_seq_len, offset, ntk_alpha)
|
| 1384 |
+
cos, sin = self._rotary_pos_emb_cache
|
| 1385 |
+
return [cos[:, offset : offset + max_seq_len], sin[:, offset : offset + max_seq_len]]
|
| 1386 |
+
|
| 1387 |
+
|
| 1388 |
+
def _rotate_half(x):
|
| 1389 |
+
from einops import rearrange
|
| 1390 |
+
|
| 1391 |
+
x = rearrange(x, "... (j d) -> ... j d", j=2)
|
| 1392 |
+
x1, x2 = x.unbind(dim=-2)
|
| 1393 |
+
return torch.cat((-x2, x1), dim=-1)
|
| 1394 |
+
|
| 1395 |
+
|
| 1396 |
+
def apply_rotary_pos_emb(t, freqs):
|
| 1397 |
+
cos, sin = freqs
|
| 1398 |
+
if apply_rotary_emb_func is not None and t.is_cuda:
|
| 1399 |
+
t_ = t.float()
|
| 1400 |
+
cos = cos.squeeze(0).squeeze(1)[:, : cos.shape[-1] // 2]
|
| 1401 |
+
sin = sin.squeeze(0).squeeze(1)[:, : sin.shape[-1] // 2]
|
| 1402 |
+
output = apply_rotary_emb_func(t_, cos, sin).type_as(t)
|
| 1403 |
+
return output
|
| 1404 |
+
else:
|
| 1405 |
+
rot_dim = freqs[0].shape[-1]
|
| 1406 |
+
cos, sin = freqs
|
| 1407 |
+
t_, t_pass_ = t[..., :rot_dim], t[..., rot_dim:]
|
| 1408 |
+
t_ = t_.float()
|
| 1409 |
+
t_pass_ = t_pass_.float()
|
| 1410 |
+
t_ = (t_ * cos) + (_rotate_half(t_) * sin)
|
| 1411 |
+
return torch.cat((t_, t_pass_), dim=-1).type_as(t)
|
| 1412 |
+
|
| 1413 |
+
|
| 1414 |
+
class RMSNorm(torch.nn.Module):
|
| 1415 |
+
def __init__(self, dim: int, eps: float = 1e-6):
|
| 1416 |
+
super().__init__()
|
| 1417 |
+
self.eps = eps
|
| 1418 |
+
self.weight = nn.Parameter(torch.ones(dim))
|
| 1419 |
+
|
| 1420 |
+
def _norm(self, x):
|
| 1421 |
+
return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
|
| 1422 |
+
|
| 1423 |
+
def forward(self, x):
|
| 1424 |
+
if rms_norm is not None and x.is_cuda:
|
| 1425 |
+
return rms_norm(x, self.weight, self.eps)
|
| 1426 |
+
else:
|
| 1427 |
+
output = self._norm(x.float()).type_as(x)
|
| 1428 |
+
return output * self.weight
|
pytorch_model-00001-of-00002.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3d42dde5f24387cc72dd7320162aacbdde4376a2f01995d3c37e2f37c8ba8968
|
| 3 |
+
size 9952260427
|
pytorch_model-00002-of-00002.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9b21d77e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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"total_size": 16029460480
|
| 4 |
+
},
|
| 5 |
+
"weight_map": {
|
| 6 |
+
"lm_head.weight": "pytorch_model-00002-of-00002.bin",
|
| 7 |
+
"transformer.h.0.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 8 |
+
"transformer.h.0.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 9 |
+
"transformer.h.0.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 10 |
+
"transformer.h.0.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 11 |
+
"transformer.h.0.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 12 |
+
"transformer.h.0.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 13 |
+
"transformer.h.0.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 14 |
+
"transformer.h.0.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 15 |
+
"transformer.h.0.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 16 |
+
"transformer.h.0.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 17 |
+
"transformer.h.0.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 18 |
+
"transformer.h.0.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 19 |
+
"transformer.h.0.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 20 |
+
"transformer.h.0.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 21 |
+
"transformer.h.0.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 22 |
+
"transformer.h.0.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 23 |
+
"transformer.h.0.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 24 |
+
"transformer.h.0.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 25 |
+
"transformer.h.0.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 26 |
+
"transformer.h.0.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 27 |
+
"transformer.h.0.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 28 |
+
"transformer.h.0.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 29 |
+
"transformer.h.0.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 30 |
+
"transformer.h.0.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 31 |
+
"transformer.h.0.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 32 |
+
"transformer.h.0.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 33 |
+
"transformer.h.0.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 34 |
+
"transformer.h.1.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 35 |
+
"transformer.h.1.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 36 |
+
"transformer.h.1.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 37 |
+
"transformer.h.1.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 38 |
+
"transformer.h.1.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 39 |
+
"transformer.h.1.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 40 |
+
"transformer.h.1.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 41 |
+
"transformer.h.1.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 42 |
+
"transformer.h.1.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 43 |
+
"transformer.h.1.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 44 |
+
"transformer.h.1.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 45 |
+
"transformer.h.1.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 46 |
+
"transformer.h.1.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 47 |
+
"transformer.h.1.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 48 |
+
"transformer.h.1.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 49 |
+
"transformer.h.1.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 50 |
+
"transformer.h.1.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 51 |
+
"transformer.h.1.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 52 |
+
"transformer.h.1.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 53 |
+
"transformer.h.1.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 54 |
+
"transformer.h.1.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 55 |
+
"transformer.h.1.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 56 |
+
"transformer.h.1.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 57 |
+
"transformer.h.1.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 58 |
+
"transformer.h.1.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 59 |
+
"transformer.h.1.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 60 |
+
"transformer.h.1.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 61 |
+
"transformer.h.10.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 62 |
+
"transformer.h.10.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 63 |
+
"transformer.h.10.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 64 |
+
"transformer.h.10.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 65 |
+
"transformer.h.10.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 66 |
+
"transformer.h.10.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 67 |
+
"transformer.h.10.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 68 |
+
"transformer.h.10.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 69 |
+
"transformer.h.10.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 70 |
+
"transformer.h.10.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 71 |
+
"transformer.h.10.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 72 |
+
"transformer.h.10.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 73 |
+
"transformer.h.10.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 74 |
+
"transformer.h.10.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 75 |
+
"transformer.h.10.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 76 |
+
"transformer.h.10.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 77 |
+
"transformer.h.10.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 78 |
+
"transformer.h.10.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 79 |
+
"transformer.h.10.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 80 |
+
"transformer.h.10.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 81 |
+
"transformer.h.10.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 82 |
+
"transformer.h.10.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 83 |
+
"transformer.h.10.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 84 |
+
"transformer.h.10.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 85 |
+
"transformer.h.10.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 86 |
+
"transformer.h.10.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 87 |
+
"transformer.h.10.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 88 |
+
"transformer.h.11.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 89 |
+
"transformer.h.11.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 90 |
+
"transformer.h.11.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 91 |
+
"transformer.h.11.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 92 |
+
"transformer.h.11.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 93 |
+
"transformer.h.11.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 94 |
+
"transformer.h.11.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 95 |
+
"transformer.h.11.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 96 |
+
"transformer.h.11.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 97 |
+
"transformer.h.11.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 98 |
+
"transformer.h.11.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 99 |
+
"transformer.h.11.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 100 |
+
"transformer.h.11.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 101 |
+
"transformer.h.11.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 102 |
+
"transformer.h.11.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 103 |
+
"transformer.h.11.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 104 |
+
"transformer.h.11.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 105 |
+
"transformer.h.11.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 106 |
+
"transformer.h.11.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 107 |
+
"transformer.h.11.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 108 |
+
"transformer.h.11.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 109 |
+
"transformer.h.11.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 110 |
+
"transformer.h.11.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 111 |
+
"transformer.h.11.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 112 |
+
"transformer.h.11.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 113 |
+
"transformer.h.11.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 114 |
+
"transformer.h.11.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 115 |
+
"transformer.h.12.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 116 |
+
"transformer.h.12.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 117 |
+
"transformer.h.12.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 118 |
+
"transformer.h.12.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 119 |
+
"transformer.h.12.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 120 |
+
"transformer.h.12.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 121 |
+
"transformer.h.12.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 122 |
+
"transformer.h.12.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 123 |
+
"transformer.h.12.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 124 |
+
"transformer.h.12.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 125 |
+
"transformer.h.12.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 126 |
+
"transformer.h.12.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 127 |
+
"transformer.h.12.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 128 |
+
"transformer.h.12.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 129 |
+
"transformer.h.12.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 130 |
+
"transformer.h.12.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 131 |
+
"transformer.h.12.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 132 |
+
"transformer.h.12.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 133 |
+
"transformer.h.12.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 134 |
+
"transformer.h.12.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 135 |
+
"transformer.h.12.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 136 |
+
"transformer.h.12.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 137 |
+
"transformer.h.12.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 138 |
+
"transformer.h.12.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 139 |
+
"transformer.h.12.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 140 |
+
"transformer.h.12.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 141 |
+
"transformer.h.12.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 142 |
+
"transformer.h.13.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 143 |
+
"transformer.h.13.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 144 |
+
"transformer.h.13.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 145 |
+
"transformer.h.13.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 146 |
+
"transformer.h.13.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 147 |
+
"transformer.h.13.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 148 |
+
"transformer.h.13.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 149 |
+
"transformer.h.13.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 150 |
+
"transformer.h.13.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 151 |
+
"transformer.h.13.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 152 |
+
"transformer.h.13.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 153 |
+
"transformer.h.13.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 154 |
+
"transformer.h.13.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 155 |
+
"transformer.h.13.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 156 |
+
"transformer.h.13.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 157 |
+
"transformer.h.13.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 158 |
+
"transformer.h.13.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 159 |
+
"transformer.h.13.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 160 |
+
"transformer.h.13.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 161 |
+
"transformer.h.13.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 162 |
+
"transformer.h.13.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 163 |
+
"transformer.h.13.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 164 |
+
"transformer.h.13.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 165 |
+
"transformer.h.13.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 166 |
+
"transformer.h.13.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 167 |
+
"transformer.h.13.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 168 |
+
"transformer.h.13.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 169 |
+
"transformer.h.14.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 170 |
+
"transformer.h.14.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 171 |
+
"transformer.h.14.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 172 |
+
"transformer.h.14.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 173 |
+
"transformer.h.14.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 174 |
+
"transformer.h.14.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 175 |
+
"transformer.h.14.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 176 |
+
"transformer.h.14.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 177 |
+
"transformer.h.14.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 178 |
+
"transformer.h.14.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 179 |
+
"transformer.h.14.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 180 |
+
"transformer.h.14.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 181 |
+
"transformer.h.14.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 182 |
+
"transformer.h.14.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 183 |
+
"transformer.h.14.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 184 |
+
"transformer.h.14.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 185 |
+
"transformer.h.14.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 186 |
+
"transformer.h.14.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 187 |
+
"transformer.h.14.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 188 |
+
"transformer.h.14.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 189 |
+
"transformer.h.14.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 190 |
+
"transformer.h.14.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 191 |
+
"transformer.h.14.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 192 |
+
"transformer.h.14.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 193 |
+
"transformer.h.14.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 194 |
+
"transformer.h.14.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 195 |
+
"transformer.h.14.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 196 |
+
"transformer.h.15.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 197 |
+
"transformer.h.15.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 198 |
+
"transformer.h.15.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 199 |
+
"transformer.h.15.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 200 |
+
"transformer.h.15.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 201 |
+
"transformer.h.15.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 202 |
+
"transformer.h.15.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 203 |
+
"transformer.h.15.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 204 |
+
"transformer.h.15.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 205 |
+
"transformer.h.15.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 206 |
+
"transformer.h.15.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 207 |
+
"transformer.h.15.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 208 |
+
"transformer.h.15.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 209 |
+
"transformer.h.15.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 210 |
+
"transformer.h.15.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 211 |
+
"transformer.h.15.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 212 |
+
"transformer.h.15.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 213 |
+
"transformer.h.15.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 214 |
+
"transformer.h.15.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 215 |
+
"transformer.h.15.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 216 |
+
"transformer.h.15.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 217 |
+
"transformer.h.15.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 218 |
+
"transformer.h.15.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 219 |
+
"transformer.h.15.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 220 |
+
"transformer.h.15.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 221 |
+
"transformer.h.15.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 222 |
+
"transformer.h.15.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 223 |
+
"transformer.h.16.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 224 |
+
"transformer.h.16.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 225 |
+
"transformer.h.16.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 226 |
+
"transformer.h.16.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 227 |
+
"transformer.h.16.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 228 |
+
"transformer.h.16.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 229 |
+
"transformer.h.16.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 230 |
+
"transformer.h.16.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 231 |
+
"transformer.h.16.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 232 |
+
"transformer.h.16.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 233 |
+
"transformer.h.16.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 234 |
+
"transformer.h.16.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 235 |
+
"transformer.h.16.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 236 |
+
"transformer.h.16.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 237 |
+
"transformer.h.16.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 238 |
+
"transformer.h.16.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 239 |
+
"transformer.h.16.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 240 |
+
"transformer.h.16.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 241 |
+
"transformer.h.16.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 242 |
+
"transformer.h.16.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 243 |
+
"transformer.h.16.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 244 |
+
"transformer.h.16.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 245 |
+
"transformer.h.16.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 246 |
+
"transformer.h.16.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 247 |
+
"transformer.h.16.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 248 |
+
"transformer.h.16.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 249 |
+
"transformer.h.16.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 250 |
+
"transformer.h.17.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 251 |
+
"transformer.h.17.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 252 |
+
"transformer.h.17.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 253 |
+
"transformer.h.17.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 254 |
+
"transformer.h.17.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 255 |
+
"transformer.h.17.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 256 |
+
"transformer.h.17.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 257 |
+
"transformer.h.17.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 258 |
+
"transformer.h.17.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 259 |
+
"transformer.h.17.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 260 |
+
"transformer.h.17.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 261 |
+
"transformer.h.17.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 262 |
+
"transformer.h.17.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 263 |
+
"transformer.h.17.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 264 |
+
"transformer.h.17.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 265 |
+
"transformer.h.17.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 266 |
+
"transformer.h.17.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 267 |
+
"transformer.h.17.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 268 |
+
"transformer.h.17.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 269 |
+
"transformer.h.17.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 270 |
+
"transformer.h.17.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 271 |
+
"transformer.h.17.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 272 |
+
"transformer.h.17.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 273 |
+
"transformer.h.17.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 274 |
+
"transformer.h.17.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 275 |
+
"transformer.h.17.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 276 |
+
"transformer.h.17.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 277 |
+
"transformer.h.18.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 278 |
+
"transformer.h.18.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 279 |
+
"transformer.h.18.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 280 |
+
"transformer.h.18.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 281 |
+
"transformer.h.18.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 282 |
+
"transformer.h.18.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 283 |
+
"transformer.h.18.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 284 |
+
"transformer.h.18.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 285 |
+
"transformer.h.18.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 286 |
+
"transformer.h.18.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 287 |
+
"transformer.h.18.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 288 |
+
"transformer.h.18.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 289 |
+
"transformer.h.18.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 290 |
+
"transformer.h.18.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 291 |
+
"transformer.h.18.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 292 |
+
"transformer.h.18.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 293 |
+
"transformer.h.18.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 294 |
+
"transformer.h.18.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 295 |
+
"transformer.h.18.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 296 |
+
"transformer.h.18.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 297 |
+
"transformer.h.18.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 298 |
+
"transformer.h.18.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 299 |
+
"transformer.h.18.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 300 |
+
"transformer.h.18.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 301 |
+
"transformer.h.18.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 302 |
+
"transformer.h.18.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 303 |
+
"transformer.h.18.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 304 |
+
"transformer.h.19.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 305 |
+
"transformer.h.19.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 306 |
+
"transformer.h.19.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 307 |
+
"transformer.h.19.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 308 |
+
"transformer.h.19.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 309 |
+
"transformer.h.19.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 310 |
+
"transformer.h.19.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 311 |
+
"transformer.h.19.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 312 |
+
"transformer.h.19.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 313 |
+
"transformer.h.19.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 314 |
+
"transformer.h.19.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 315 |
+
"transformer.h.19.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 316 |
+
"transformer.h.19.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 317 |
+
"transformer.h.19.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 318 |
+
"transformer.h.19.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 319 |
+
"transformer.h.19.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 320 |
+
"transformer.h.19.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 321 |
+
"transformer.h.19.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 322 |
+
"transformer.h.19.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 323 |
+
"transformer.h.19.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 324 |
+
"transformer.h.19.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 325 |
+
"transformer.h.19.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 326 |
+
"transformer.h.19.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 327 |
+
"transformer.h.19.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 328 |
+
"transformer.h.19.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 329 |
+
"transformer.h.19.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 330 |
+
"transformer.h.19.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 331 |
+
"transformer.h.2.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 332 |
+
"transformer.h.2.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 333 |
+
"transformer.h.2.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 334 |
+
"transformer.h.2.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 335 |
+
"transformer.h.2.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 336 |
+
"transformer.h.2.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 337 |
+
"transformer.h.2.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 338 |
+
"transformer.h.2.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 339 |
+
"transformer.h.2.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 340 |
+
"transformer.h.2.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 341 |
+
"transformer.h.2.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 342 |
+
"transformer.h.2.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 343 |
+
"transformer.h.2.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 344 |
+
"transformer.h.2.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 345 |
+
"transformer.h.2.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 346 |
+
"transformer.h.2.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 347 |
+
"transformer.h.2.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 348 |
+
"transformer.h.2.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 349 |
+
"transformer.h.2.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 350 |
+
"transformer.h.2.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 351 |
+
"transformer.h.2.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 352 |
+
"transformer.h.2.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 353 |
+
"transformer.h.2.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 354 |
+
"transformer.h.2.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 355 |
+
"transformer.h.2.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 356 |
+
"transformer.h.2.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 357 |
+
"transformer.h.2.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 358 |
+
"transformer.h.20.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 359 |
+
"transformer.h.20.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 360 |
+
"transformer.h.20.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 361 |
+
"transformer.h.20.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 362 |
+
"transformer.h.20.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 363 |
+
"transformer.h.20.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 364 |
+
"transformer.h.20.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 365 |
+
"transformer.h.20.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 366 |
+
"transformer.h.20.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 367 |
+
"transformer.h.20.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 368 |
+
"transformer.h.20.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 369 |
+
"transformer.h.20.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 370 |
+
"transformer.h.20.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 371 |
+
"transformer.h.20.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 372 |
+
"transformer.h.20.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 373 |
+
"transformer.h.20.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 374 |
+
"transformer.h.20.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 375 |
+
"transformer.h.20.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 376 |
+
"transformer.h.20.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 377 |
+
"transformer.h.20.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 378 |
+
"transformer.h.20.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 379 |
+
"transformer.h.20.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 380 |
+
"transformer.h.20.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 381 |
+
"transformer.h.20.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 382 |
+
"transformer.h.20.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 383 |
+
"transformer.h.20.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 384 |
+
"transformer.h.20.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 385 |
+
"transformer.h.21.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 386 |
+
"transformer.h.21.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 387 |
+
"transformer.h.21.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 388 |
+
"transformer.h.21.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 389 |
+
"transformer.h.21.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 390 |
+
"transformer.h.21.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 391 |
+
"transformer.h.21.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 392 |
+
"transformer.h.21.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 393 |
+
"transformer.h.21.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 394 |
+
"transformer.h.21.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 395 |
+
"transformer.h.21.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 396 |
+
"transformer.h.21.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 397 |
+
"transformer.h.21.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 398 |
+
"transformer.h.21.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 399 |
+
"transformer.h.21.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 400 |
+
"transformer.h.21.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 401 |
+
"transformer.h.21.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 402 |
+
"transformer.h.21.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 403 |
+
"transformer.h.21.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 404 |
+
"transformer.h.21.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 405 |
+
"transformer.h.21.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 406 |
+
"transformer.h.21.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 407 |
+
"transformer.h.21.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 408 |
+
"transformer.h.21.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 409 |
+
"transformer.h.21.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 410 |
+
"transformer.h.21.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 411 |
+
"transformer.h.21.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 412 |
+
"transformer.h.22.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 413 |
+
"transformer.h.22.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 414 |
+
"transformer.h.22.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 415 |
+
"transformer.h.22.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 416 |
+
"transformer.h.22.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 417 |
+
"transformer.h.22.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 418 |
+
"transformer.h.22.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 419 |
+
"transformer.h.22.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 420 |
+
"transformer.h.22.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 421 |
+
"transformer.h.22.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 422 |
+
"transformer.h.22.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 423 |
+
"transformer.h.22.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 424 |
+
"transformer.h.22.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 425 |
+
"transformer.h.22.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 426 |
+
"transformer.h.22.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 427 |
+
"transformer.h.22.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 428 |
+
"transformer.h.22.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 429 |
+
"transformer.h.22.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 430 |
+
"transformer.h.22.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 431 |
+
"transformer.h.22.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 432 |
+
"transformer.h.22.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 433 |
+
"transformer.h.22.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 434 |
+
"transformer.h.22.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 435 |
+
"transformer.h.22.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 436 |
+
"transformer.h.22.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 437 |
+
"transformer.h.22.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 438 |
+
"transformer.h.22.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 439 |
+
"transformer.h.23.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 440 |
+
"transformer.h.23.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 441 |
+
"transformer.h.23.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 442 |
+
"transformer.h.23.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 443 |
+
"transformer.h.23.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 444 |
+
"transformer.h.23.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 445 |
+
"transformer.h.23.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 446 |
+
"transformer.h.23.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 447 |
+
"transformer.h.23.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 448 |
+
"transformer.h.23.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 449 |
+
"transformer.h.23.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 450 |
+
"transformer.h.23.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 451 |
+
"transformer.h.23.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 452 |
+
"transformer.h.23.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 453 |
+
"transformer.h.23.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 454 |
+
"transformer.h.23.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 455 |
+
"transformer.h.23.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 456 |
+
"transformer.h.23.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 457 |
+
"transformer.h.23.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 458 |
+
"transformer.h.23.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 459 |
+
"transformer.h.23.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 460 |
+
"transformer.h.23.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 461 |
+
"transformer.h.23.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 462 |
+
"transformer.h.23.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 463 |
+
"transformer.h.23.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 464 |
+
"transformer.h.23.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 465 |
+
"transformer.h.23.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 466 |
+
"transformer.h.24.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 467 |
+
"transformer.h.24.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 468 |
+
"transformer.h.24.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 469 |
+
"transformer.h.24.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 470 |
+
"transformer.h.24.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 471 |
+
"transformer.h.24.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 472 |
+
"transformer.h.24.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 473 |
+
"transformer.h.24.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 474 |
+
"transformer.h.24.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 475 |
+
"transformer.h.24.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 476 |
+
"transformer.h.24.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 477 |
+
"transformer.h.24.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 478 |
+
"transformer.h.24.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 479 |
+
"transformer.h.24.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 480 |
+
"transformer.h.24.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 481 |
+
"transformer.h.24.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 482 |
+
"transformer.h.24.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 483 |
+
"transformer.h.24.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 484 |
+
"transformer.h.24.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 485 |
+
"transformer.h.24.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 486 |
+
"transformer.h.24.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 487 |
+
"transformer.h.24.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 488 |
+
"transformer.h.24.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 489 |
+
"transformer.h.24.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 490 |
+
"transformer.h.24.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 491 |
+
"transformer.h.24.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 492 |
+
"transformer.h.24.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 493 |
+
"transformer.h.25.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 494 |
+
"transformer.h.25.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 495 |
+
"transformer.h.25.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 496 |
+
"transformer.h.25.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 497 |
+
"transformer.h.25.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 498 |
+
"transformer.h.25.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 499 |
+
"transformer.h.25.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 500 |
+
"transformer.h.25.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 501 |
+
"transformer.h.25.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 502 |
+
"transformer.h.25.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 503 |
+
"transformer.h.25.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 504 |
+
"transformer.h.25.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 505 |
+
"transformer.h.25.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 506 |
+
"transformer.h.25.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 507 |
+
"transformer.h.25.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 508 |
+
"transformer.h.25.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 509 |
+
"transformer.h.25.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 510 |
+
"transformer.h.25.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 511 |
+
"transformer.h.25.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 512 |
+
"transformer.h.25.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 513 |
+
"transformer.h.25.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 514 |
+
"transformer.h.25.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 515 |
+
"transformer.h.25.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 516 |
+
"transformer.h.25.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 517 |
+
"transformer.h.25.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 518 |
+
"transformer.h.25.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 519 |
+
"transformer.h.25.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 520 |
+
"transformer.h.26.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 521 |
+
"transformer.h.26.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 522 |
+
"transformer.h.26.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 523 |
+
"transformer.h.26.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 524 |
+
"transformer.h.26.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 525 |
+
"transformer.h.26.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 526 |
+
"transformer.h.26.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 527 |
+
"transformer.h.26.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 528 |
+
"transformer.h.26.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 529 |
+
"transformer.h.26.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 530 |
+
"transformer.h.26.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 531 |
+
"transformer.h.26.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 532 |
+
"transformer.h.26.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 533 |
+
"transformer.h.26.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 534 |
+
"transformer.h.26.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 535 |
+
"transformer.h.26.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 536 |
+
"transformer.h.26.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 537 |
+
"transformer.h.26.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 538 |
+
"transformer.h.26.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 539 |
+
"transformer.h.26.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 540 |
+
"transformer.h.26.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 541 |
+
"transformer.h.26.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 542 |
+
"transformer.h.26.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 543 |
+
"transformer.h.26.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 544 |
+
"transformer.h.26.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 545 |
+
"transformer.h.26.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 546 |
+
"transformer.h.26.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 547 |
+
"transformer.h.27.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 548 |
+
"transformer.h.27.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 549 |
+
"transformer.h.27.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 550 |
+
"transformer.h.27.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 551 |
+
"transformer.h.27.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 552 |
+
"transformer.h.27.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 553 |
+
"transformer.h.27.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 554 |
+
"transformer.h.27.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 555 |
+
"transformer.h.27.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 556 |
+
"transformer.h.27.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 557 |
+
"transformer.h.27.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 558 |
+
"transformer.h.27.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 559 |
+
"transformer.h.27.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 560 |
+
"transformer.h.27.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 561 |
+
"transformer.h.27.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 562 |
+
"transformer.h.27.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 563 |
+
"transformer.h.27.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 564 |
+
"transformer.h.27.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 565 |
+
"transformer.h.27.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 566 |
+
"transformer.h.27.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 567 |
+
"transformer.h.27.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 568 |
+
"transformer.h.27.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 569 |
+
"transformer.h.27.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 570 |
+
"transformer.h.27.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 571 |
+
"transformer.h.27.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 572 |
+
"transformer.h.27.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 573 |
+
"transformer.h.27.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 574 |
+
"transformer.h.28.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 575 |
+
"transformer.h.28.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 576 |
+
"transformer.h.28.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 577 |
+
"transformer.h.28.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 578 |
+
"transformer.h.28.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 579 |
+
"transformer.h.28.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 580 |
+
"transformer.h.28.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 581 |
+
"transformer.h.28.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 582 |
+
"transformer.h.28.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 583 |
+
"transformer.h.28.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 584 |
+
"transformer.h.28.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 585 |
+
"transformer.h.28.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 586 |
+
"transformer.h.28.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 587 |
+
"transformer.h.28.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 588 |
+
"transformer.h.28.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 589 |
+
"transformer.h.28.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 590 |
+
"transformer.h.28.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 591 |
+
"transformer.h.28.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 592 |
+
"transformer.h.28.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 593 |
+
"transformer.h.28.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 594 |
+
"transformer.h.28.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 595 |
+
"transformer.h.28.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 596 |
+
"transformer.h.28.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 597 |
+
"transformer.h.28.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 598 |
+
"transformer.h.28.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 599 |
+
"transformer.h.28.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 600 |
+
"transformer.h.28.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 601 |
+
"transformer.h.29.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 602 |
+
"transformer.h.29.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 603 |
+
"transformer.h.29.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 604 |
+
"transformer.h.29.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 605 |
+
"transformer.h.29.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 606 |
+
"transformer.h.29.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 607 |
+
"transformer.h.29.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 608 |
+
"transformer.h.29.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 609 |
+
"transformer.h.29.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 610 |
+
"transformer.h.29.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 611 |
+
"transformer.h.29.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 612 |
+
"transformer.h.29.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 613 |
+
"transformer.h.29.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 614 |
+
"transformer.h.29.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 615 |
+
"transformer.h.29.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 616 |
+
"transformer.h.29.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 617 |
+
"transformer.h.29.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 618 |
+
"transformer.h.29.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 619 |
+
"transformer.h.29.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 620 |
+
"transformer.h.29.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 621 |
+
"transformer.h.29.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 622 |
+
"transformer.h.29.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 623 |
+
"transformer.h.29.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 624 |
+
"transformer.h.29.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 625 |
+
"transformer.h.29.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 626 |
+
"transformer.h.29.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 627 |
+
"transformer.h.29.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 628 |
+
"transformer.h.3.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 629 |
+
"transformer.h.3.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 630 |
+
"transformer.h.3.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 631 |
+
"transformer.h.3.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 632 |
+
"transformer.h.3.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 633 |
+
"transformer.h.3.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 634 |
+
"transformer.h.3.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 635 |
+
"transformer.h.3.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 636 |
+
"transformer.h.3.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 637 |
+
"transformer.h.3.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 638 |
+
"transformer.h.3.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 639 |
+
"transformer.h.3.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 640 |
+
"transformer.h.3.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 641 |
+
"transformer.h.3.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 642 |
+
"transformer.h.3.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 643 |
+
"transformer.h.3.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 644 |
+
"transformer.h.3.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 645 |
+
"transformer.h.3.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 646 |
+
"transformer.h.3.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 647 |
+
"transformer.h.3.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 648 |
+
"transformer.h.3.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 649 |
+
"transformer.h.3.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 650 |
+
"transformer.h.3.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 651 |
+
"transformer.h.3.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 652 |
+
"transformer.h.3.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 653 |
+
"transformer.h.3.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 654 |
+
"transformer.h.3.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 655 |
+
"transformer.h.30.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 656 |
+
"transformer.h.30.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 657 |
+
"transformer.h.30.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 658 |
+
"transformer.h.30.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 659 |
+
"transformer.h.30.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 660 |
+
"transformer.h.30.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 661 |
+
"transformer.h.30.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 662 |
+
"transformer.h.30.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 663 |
+
"transformer.h.30.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 664 |
+
"transformer.h.30.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 665 |
+
"transformer.h.30.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 666 |
+
"transformer.h.30.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 667 |
+
"transformer.h.30.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 668 |
+
"transformer.h.30.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 669 |
+
"transformer.h.30.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 670 |
+
"transformer.h.30.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 671 |
+
"transformer.h.30.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 672 |
+
"transformer.h.30.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 673 |
+
"transformer.h.30.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 674 |
+
"transformer.h.30.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 675 |
+
"transformer.h.30.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 676 |
+
"transformer.h.30.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 677 |
+
"transformer.h.30.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 678 |
+
"transformer.h.30.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 679 |
+
"transformer.h.30.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 680 |
+
"transformer.h.30.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 681 |
+
"transformer.h.30.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 682 |
+
"transformer.h.31.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 683 |
+
"transformer.h.31.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 684 |
+
"transformer.h.31.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 685 |
+
"transformer.h.31.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 686 |
+
"transformer.h.31.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 687 |
+
"transformer.h.31.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 688 |
+
"transformer.h.31.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 689 |
+
"transformer.h.31.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 690 |
+
"transformer.h.31.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 691 |
+
"transformer.h.31.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 692 |
+
"transformer.h.31.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 693 |
+
"transformer.h.31.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 694 |
+
"transformer.h.31.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 695 |
+
"transformer.h.31.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 696 |
+
"transformer.h.31.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 697 |
+
"transformer.h.31.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 698 |
+
"transformer.h.31.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 699 |
+
"transformer.h.31.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 700 |
+
"transformer.h.31.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 701 |
+
"transformer.h.31.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 702 |
+
"transformer.h.31.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 703 |
+
"transformer.h.31.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 704 |
+
"transformer.h.31.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 705 |
+
"transformer.h.31.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 706 |
+
"transformer.h.31.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 707 |
+
"transformer.h.31.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 708 |
+
"transformer.h.31.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 709 |
+
"transformer.h.32.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 710 |
+
"transformer.h.32.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 711 |
+
"transformer.h.32.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 712 |
+
"transformer.h.32.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 713 |
+
"transformer.h.32.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 714 |
+
"transformer.h.32.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 715 |
+
"transformer.h.32.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 716 |
+
"transformer.h.32.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 717 |
+
"transformer.h.32.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 718 |
+
"transformer.h.32.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 719 |
+
"transformer.h.32.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 720 |
+
"transformer.h.32.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 721 |
+
"transformer.h.32.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 722 |
+
"transformer.h.32.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 723 |
+
"transformer.h.32.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 724 |
+
"transformer.h.32.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 725 |
+
"transformer.h.32.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 726 |
+
"transformer.h.32.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 727 |
+
"transformer.h.32.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 728 |
+
"transformer.h.32.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 729 |
+
"transformer.h.32.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 730 |
+
"transformer.h.32.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 731 |
+
"transformer.h.32.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 732 |
+
"transformer.h.32.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 733 |
+
"transformer.h.32.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 734 |
+
"transformer.h.32.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 735 |
+
"transformer.h.32.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 736 |
+
"transformer.h.33.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 737 |
+
"transformer.h.33.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 738 |
+
"transformer.h.33.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 739 |
+
"transformer.h.33.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 740 |
+
"transformer.h.33.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 741 |
+
"transformer.h.33.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 742 |
+
"transformer.h.33.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 743 |
+
"transformer.h.33.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 744 |
+
"transformer.h.33.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 745 |
+
"transformer.h.33.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 746 |
+
"transformer.h.33.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 747 |
+
"transformer.h.33.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 748 |
+
"transformer.h.33.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 749 |
+
"transformer.h.33.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 750 |
+
"transformer.h.33.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 751 |
+
"transformer.h.33.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 752 |
+
"transformer.h.33.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 753 |
+
"transformer.h.33.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 754 |
+
"transformer.h.33.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 755 |
+
"transformer.h.33.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 756 |
+
"transformer.h.33.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 757 |
+
"transformer.h.33.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 758 |
+
"transformer.h.33.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 759 |
+
"transformer.h.33.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 760 |
+
"transformer.h.33.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 761 |
+
"transformer.h.33.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 762 |
+
"transformer.h.33.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 763 |
+
"transformer.h.34.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 764 |
+
"transformer.h.34.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 765 |
+
"transformer.h.34.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 766 |
+
"transformer.h.34.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 767 |
+
"transformer.h.34.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 768 |
+
"transformer.h.34.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 769 |
+
"transformer.h.34.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 770 |
+
"transformer.h.34.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 771 |
+
"transformer.h.34.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 772 |
+
"transformer.h.34.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 773 |
+
"transformer.h.34.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 774 |
+
"transformer.h.34.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 775 |
+
"transformer.h.34.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 776 |
+
"transformer.h.34.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 777 |
+
"transformer.h.34.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 778 |
+
"transformer.h.34.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 779 |
+
"transformer.h.34.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 780 |
+
"transformer.h.34.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 781 |
+
"transformer.h.34.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 782 |
+
"transformer.h.34.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 783 |
+
"transformer.h.34.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 784 |
+
"transformer.h.34.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 785 |
+
"transformer.h.34.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 786 |
+
"transformer.h.34.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 787 |
+
"transformer.h.34.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 788 |
+
"transformer.h.34.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 789 |
+
"transformer.h.34.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 790 |
+
"transformer.h.35.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 791 |
+
"transformer.h.35.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 792 |
+
"transformer.h.35.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 793 |
+
"transformer.h.35.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 794 |
+
"transformer.h.35.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 795 |
+
"transformer.h.35.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 796 |
+
"transformer.h.35.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 797 |
+
"transformer.h.35.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 798 |
+
"transformer.h.35.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 799 |
+
"transformer.h.35.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 800 |
+
"transformer.h.35.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 801 |
+
"transformer.h.35.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 802 |
+
"transformer.h.35.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 803 |
+
"transformer.h.35.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 804 |
+
"transformer.h.35.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 805 |
+
"transformer.h.35.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 806 |
+
"transformer.h.35.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 807 |
+
"transformer.h.35.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 808 |
+
"transformer.h.35.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 809 |
+
"transformer.h.35.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 810 |
+
"transformer.h.35.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 811 |
+
"transformer.h.35.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 812 |
+
"transformer.h.35.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 813 |
+
"transformer.h.35.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 814 |
+
"transformer.h.35.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 815 |
+
"transformer.h.35.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 816 |
+
"transformer.h.35.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 817 |
+
"transformer.h.36.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 818 |
+
"transformer.h.36.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 819 |
+
"transformer.h.36.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 820 |
+
"transformer.h.36.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 821 |
+
"transformer.h.36.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 822 |
+
"transformer.h.36.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 823 |
+
"transformer.h.36.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 824 |
+
"transformer.h.36.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 825 |
+
"transformer.h.36.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 826 |
+
"transformer.h.36.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 827 |
+
"transformer.h.36.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 828 |
+
"transformer.h.36.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 829 |
+
"transformer.h.36.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 830 |
+
"transformer.h.36.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 831 |
+
"transformer.h.36.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 832 |
+
"transformer.h.36.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 833 |
+
"transformer.h.36.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 834 |
+
"transformer.h.36.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 835 |
+
"transformer.h.36.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 836 |
+
"transformer.h.36.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 837 |
+
"transformer.h.36.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 838 |
+
"transformer.h.36.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 839 |
+
"transformer.h.36.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 840 |
+
"transformer.h.36.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 841 |
+
"transformer.h.36.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 842 |
+
"transformer.h.36.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 843 |
+
"transformer.h.36.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 844 |
+
"transformer.h.37.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 845 |
+
"transformer.h.37.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 846 |
+
"transformer.h.37.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 847 |
+
"transformer.h.37.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 848 |
+
"transformer.h.37.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 849 |
+
"transformer.h.37.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 850 |
+
"transformer.h.37.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 851 |
+
"transformer.h.37.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 852 |
+
"transformer.h.37.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 853 |
+
"transformer.h.37.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 854 |
+
"transformer.h.37.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 855 |
+
"transformer.h.37.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 856 |
+
"transformer.h.37.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 857 |
+
"transformer.h.37.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 858 |
+
"transformer.h.37.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 859 |
+
"transformer.h.37.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 860 |
+
"transformer.h.37.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 861 |
+
"transformer.h.37.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 862 |
+
"transformer.h.37.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 863 |
+
"transformer.h.37.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 864 |
+
"transformer.h.37.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 865 |
+
"transformer.h.37.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 866 |
+
"transformer.h.37.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 867 |
+
"transformer.h.37.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 868 |
+
"transformer.h.37.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 869 |
+
"transformer.h.37.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 870 |
+
"transformer.h.37.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 871 |
+
"transformer.h.38.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 872 |
+
"transformer.h.38.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 873 |
+
"transformer.h.38.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 874 |
+
"transformer.h.38.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 875 |
+
"transformer.h.38.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 876 |
+
"transformer.h.38.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 877 |
+
"transformer.h.38.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 878 |
+
"transformer.h.38.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 879 |
+
"transformer.h.38.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 880 |
+
"transformer.h.38.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 881 |
+
"transformer.h.38.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 882 |
+
"transformer.h.38.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 883 |
+
"transformer.h.38.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 884 |
+
"transformer.h.38.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 885 |
+
"transformer.h.38.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 886 |
+
"transformer.h.38.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 887 |
+
"transformer.h.38.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 888 |
+
"transformer.h.38.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 889 |
+
"transformer.h.38.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 890 |
+
"transformer.h.38.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 891 |
+
"transformer.h.38.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 892 |
+
"transformer.h.38.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 893 |
+
"transformer.h.38.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 894 |
+
"transformer.h.38.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 895 |
+
"transformer.h.38.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 896 |
+
"transformer.h.38.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 897 |
+
"transformer.h.38.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 898 |
+
"transformer.h.39.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 899 |
+
"transformer.h.39.attn.c_attn.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 900 |
+
"transformer.h.39.attn.c_attn.qweight": "pytorch_model-00002-of-00002.bin",
|
| 901 |
+
"transformer.h.39.attn.c_attn.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 902 |
+
"transformer.h.39.attn.c_attn.scales": "pytorch_model-00002-of-00002.bin",
|
| 903 |
+
"transformer.h.39.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 904 |
+
"transformer.h.39.attn.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 905 |
+
"transformer.h.39.attn.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 906 |
+
"transformer.h.39.attn.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 907 |
+
"transformer.h.39.attn.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 908 |
+
"transformer.h.39.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 909 |
+
"transformer.h.39.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 910 |
+
"transformer.h.39.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 911 |
+
"transformer.h.39.mlp.c_proj.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 912 |
+
"transformer.h.39.mlp.c_proj.qweight": "pytorch_model-00002-of-00002.bin",
|
| 913 |
+
"transformer.h.39.mlp.c_proj.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 914 |
+
"transformer.h.39.mlp.c_proj.scales": "pytorch_model-00002-of-00002.bin",
|
| 915 |
+
"transformer.h.39.mlp.w1.bias": "pytorch_model-00002-of-00002.bin",
|
| 916 |
+
"transformer.h.39.mlp.w1.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 917 |
+
"transformer.h.39.mlp.w1.qweight": "pytorch_model-00002-of-00002.bin",
|
| 918 |
+
"transformer.h.39.mlp.w1.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 919 |
+
"transformer.h.39.mlp.w1.scales": "pytorch_model-00002-of-00002.bin",
|
| 920 |
+
"transformer.h.39.mlp.w2.bias": "pytorch_model-00002-of-00002.bin",
|
| 921 |
+
"transformer.h.39.mlp.w2.g_idx": "pytorch_model-00002-of-00002.bin",
|
| 922 |
+
"transformer.h.39.mlp.w2.qweight": "pytorch_model-00002-of-00002.bin",
|
| 923 |
+
"transformer.h.39.mlp.w2.qzeros": "pytorch_model-00002-of-00002.bin",
|
| 924 |
+
"transformer.h.39.mlp.w2.scales": "pytorch_model-00002-of-00002.bin",
|
| 925 |
+
"transformer.h.4.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 926 |
+
"transformer.h.4.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 927 |
+
"transformer.h.4.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 928 |
+
"transformer.h.4.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 929 |
+
"transformer.h.4.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 930 |
+
"transformer.h.4.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 931 |
+
"transformer.h.4.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 932 |
+
"transformer.h.4.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 933 |
+
"transformer.h.4.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 934 |
+
"transformer.h.4.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 935 |
+
"transformer.h.4.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 936 |
+
"transformer.h.4.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 937 |
+
"transformer.h.4.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 938 |
+
"transformer.h.4.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 939 |
+
"transformer.h.4.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 940 |
+
"transformer.h.4.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 941 |
+
"transformer.h.4.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 942 |
+
"transformer.h.4.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 943 |
+
"transformer.h.4.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 944 |
+
"transformer.h.4.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 945 |
+
"transformer.h.4.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 946 |
+
"transformer.h.4.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 947 |
+
"transformer.h.4.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 948 |
+
"transformer.h.4.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 949 |
+
"transformer.h.4.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 950 |
+
"transformer.h.4.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 951 |
+
"transformer.h.4.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 952 |
+
"transformer.h.5.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 953 |
+
"transformer.h.5.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 954 |
+
"transformer.h.5.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 955 |
+
"transformer.h.5.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 956 |
+
"transformer.h.5.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 957 |
+
"transformer.h.5.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 958 |
+
"transformer.h.5.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 959 |
+
"transformer.h.5.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 960 |
+
"transformer.h.5.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 961 |
+
"transformer.h.5.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 962 |
+
"transformer.h.5.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 963 |
+
"transformer.h.5.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 964 |
+
"transformer.h.5.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 965 |
+
"transformer.h.5.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 966 |
+
"transformer.h.5.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 967 |
+
"transformer.h.5.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 968 |
+
"transformer.h.5.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 969 |
+
"transformer.h.5.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 970 |
+
"transformer.h.5.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 971 |
+
"transformer.h.5.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 972 |
+
"transformer.h.5.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 973 |
+
"transformer.h.5.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 974 |
+
"transformer.h.5.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 975 |
+
"transformer.h.5.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 976 |
+
"transformer.h.5.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 977 |
+
"transformer.h.5.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 978 |
+
"transformer.h.5.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 979 |
+
"transformer.h.6.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 980 |
+
"transformer.h.6.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 981 |
+
"transformer.h.6.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 982 |
+
"transformer.h.6.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 983 |
+
"transformer.h.6.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 984 |
+
"transformer.h.6.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 985 |
+
"transformer.h.6.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 986 |
+
"transformer.h.6.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 987 |
+
"transformer.h.6.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 988 |
+
"transformer.h.6.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 989 |
+
"transformer.h.6.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 990 |
+
"transformer.h.6.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 991 |
+
"transformer.h.6.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 992 |
+
"transformer.h.6.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 993 |
+
"transformer.h.6.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 994 |
+
"transformer.h.6.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 995 |
+
"transformer.h.6.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 996 |
+
"transformer.h.6.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 997 |
+
"transformer.h.6.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 998 |
+
"transformer.h.6.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 999 |
+
"transformer.h.6.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1000 |
+
"transformer.h.6.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 1001 |
+
"transformer.h.6.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 1002 |
+
"transformer.h.6.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1003 |
+
"transformer.h.6.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1004 |
+
"transformer.h.6.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1005 |
+
"transformer.h.6.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 1006 |
+
"transformer.h.7.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 1007 |
+
"transformer.h.7.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1008 |
+
"transformer.h.7.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1009 |
+
"transformer.h.7.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1010 |
+
"transformer.h.7.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 1011 |
+
"transformer.h.7.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 1012 |
+
"transformer.h.7.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1013 |
+
"transformer.h.7.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1014 |
+
"transformer.h.7.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1015 |
+
"transformer.h.7.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 1016 |
+
"transformer.h.7.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 1017 |
+
"transformer.h.7.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 1018 |
+
"transformer.h.7.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 1019 |
+
"transformer.h.7.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1020 |
+
"transformer.h.7.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1021 |
+
"transformer.h.7.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1022 |
+
"transformer.h.7.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 1023 |
+
"transformer.h.7.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 1024 |
+
"transformer.h.7.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1025 |
+
"transformer.h.7.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1026 |
+
"transformer.h.7.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1027 |
+
"transformer.h.7.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 1028 |
+
"transformer.h.7.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 1029 |
+
"transformer.h.7.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1030 |
+
"transformer.h.7.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1031 |
+
"transformer.h.7.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1032 |
+
"transformer.h.7.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 1033 |
+
"transformer.h.8.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 1034 |
+
"transformer.h.8.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1035 |
+
"transformer.h.8.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1036 |
+
"transformer.h.8.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1037 |
+
"transformer.h.8.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 1038 |
+
"transformer.h.8.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 1039 |
+
"transformer.h.8.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1040 |
+
"transformer.h.8.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1041 |
+
"transformer.h.8.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1042 |
+
"transformer.h.8.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 1043 |
+
"transformer.h.8.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 1044 |
+
"transformer.h.8.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 1045 |
+
"transformer.h.8.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 1046 |
+
"transformer.h.8.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1047 |
+
"transformer.h.8.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1048 |
+
"transformer.h.8.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1049 |
+
"transformer.h.8.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 1050 |
+
"transformer.h.8.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 1051 |
+
"transformer.h.8.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1052 |
+
"transformer.h.8.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1053 |
+
"transformer.h.8.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1054 |
+
"transformer.h.8.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 1055 |
+
"transformer.h.8.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 1056 |
+
"transformer.h.8.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1057 |
+
"transformer.h.8.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1058 |
+
"transformer.h.8.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1059 |
+
"transformer.h.8.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 1060 |
+
"transformer.h.9.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 1061 |
+
"transformer.h.9.attn.c_attn.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1062 |
+
"transformer.h.9.attn.c_attn.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1063 |
+
"transformer.h.9.attn.c_attn.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1064 |
+
"transformer.h.9.attn.c_attn.scales": "pytorch_model-00001-of-00002.bin",
|
| 1065 |
+
"transformer.h.9.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 1066 |
+
"transformer.h.9.attn.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1067 |
+
"transformer.h.9.attn.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1068 |
+
"transformer.h.9.attn.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1069 |
+
"transformer.h.9.attn.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 1070 |
+
"transformer.h.9.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 1071 |
+
"transformer.h.9.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 1072 |
+
"transformer.h.9.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 1073 |
+
"transformer.h.9.mlp.c_proj.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1074 |
+
"transformer.h.9.mlp.c_proj.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1075 |
+
"transformer.h.9.mlp.c_proj.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1076 |
+
"transformer.h.9.mlp.c_proj.scales": "pytorch_model-00001-of-00002.bin",
|
| 1077 |
+
"transformer.h.9.mlp.w1.bias": "pytorch_model-00001-of-00002.bin",
|
| 1078 |
+
"transformer.h.9.mlp.w1.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1079 |
+
"transformer.h.9.mlp.w1.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1080 |
+
"transformer.h.9.mlp.w1.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1081 |
+
"transformer.h.9.mlp.w1.scales": "pytorch_model-00001-of-00002.bin",
|
| 1082 |
+
"transformer.h.9.mlp.w2.bias": "pytorch_model-00001-of-00002.bin",
|
| 1083 |
+
"transformer.h.9.mlp.w2.g_idx": "pytorch_model-00001-of-00002.bin",
|
| 1084 |
+
"transformer.h.9.mlp.w2.qweight": "pytorch_model-00001-of-00002.bin",
|
| 1085 |
+
"transformer.h.9.mlp.w2.qzeros": "pytorch_model-00001-of-00002.bin",
|
| 1086 |
+
"transformer.h.9.mlp.w2.scales": "pytorch_model-00001-of-00002.bin",
|
| 1087 |
+
"transformer.ln_f.weight": "pytorch_model-00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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) Alibaba Cloud.
|
| 2 |
+
#
|
| 3 |
+
# This source code is licensed under the license found in the
|
| 4 |
+
# LICENSE file in the root directory of this source tree.
|
| 5 |
+
|
| 6 |
+
"""Generation support."""
|
| 7 |
+
|
| 8 |
+
from typing import Tuple, List, Union, Iterable
|
| 9 |
+
|
| 10 |
+
import numpy as np
|
| 11 |
+
import torch
|
| 12 |
+
import torch.nn.functional as F
|
| 13 |
+
from transformers import PreTrainedTokenizer
|
| 14 |
+
from transformers import logging
|
| 15 |
+
from transformers.generation import LogitsProcessor
|
| 16 |
+
|
| 17 |
+
logger = logging.get_logger(__name__)
|
| 18 |
+
|
| 19 |
+
# Types.
|
| 20 |
+
HistoryType = List[Tuple[str, str]]
|
| 21 |
+
TokensType = List[int]
|
| 22 |
+
BatchTokensType = List[List[int]]
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def pad_batch(batch: BatchTokensType, pad_id: int, seq_length: int) -> BatchTokensType:
|
| 26 |
+
for tokens in batch:
|
| 27 |
+
context_length = len(tokens)
|
| 28 |
+
if context_length < seq_length:
|
| 29 |
+
tokens.extend([pad_id] * (seq_length - context_length))
|
| 30 |
+
return batch
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def get_ltor_masks_and_position_ids(
|
| 34 |
+
data,
|
| 35 |
+
eod_token,
|
| 36 |
+
reset_position_ids,
|
| 37 |
+
reset_attention_mask,
|
| 38 |
+
eod_mask_loss,
|
| 39 |
+
):
|
| 40 |
+
"""Build masks and position id for left to right model."""
|
| 41 |
+
|
| 42 |
+
# Extract batch size and sequence length.
|
| 43 |
+
micro_batch_size, seq_length = data.size()
|
| 44 |
+
|
| 45 |
+
# Attention mask (lower triangular).
|
| 46 |
+
if reset_attention_mask:
|
| 47 |
+
att_mask_batch = micro_batch_size
|
| 48 |
+
else:
|
| 49 |
+
att_mask_batch = 1
|
| 50 |
+
attention_mask = torch.tril(
|
| 51 |
+
torch.ones((att_mask_batch, seq_length, seq_length), device=data.device)
|
| 52 |
+
).view(att_mask_batch, 1, seq_length, seq_length)
|
| 53 |
+
|
| 54 |
+
# Loss mask.
|
| 55 |
+
loss_mask = torch.ones(data.size(), dtype=torch.float, device=data.device)
|
| 56 |
+
if eod_mask_loss:
|
| 57 |
+
loss_mask[data == eod_token] = 0.0
|
| 58 |
+
|
| 59 |
+
# Position ids.
|
| 60 |
+
position_ids = torch.arange(seq_length, dtype=torch.long, device=data.device)
|
| 61 |
+
position_ids = position_ids.unsqueeze(0).expand_as(data)
|
| 62 |
+
# We need to clone as the ids will be modifed based on batch index.
|
| 63 |
+
if reset_position_ids:
|
| 64 |
+
position_ids = position_ids.clone()
|
| 65 |
+
|
| 66 |
+
if reset_position_ids or reset_attention_mask:
|
| 67 |
+
# Loop through the batches:
|
| 68 |
+
for b in range(micro_batch_size):
|
| 69 |
+
|
| 70 |
+
# Find indecies where EOD token is.
|
| 71 |
+
eod_index = position_ids[b, data[b] == eod_token]
|
| 72 |
+
# Detach indecies from positions if going to modify positions.
|
| 73 |
+
if reset_position_ids:
|
| 74 |
+
eod_index = eod_index.clone()
|
| 75 |
+
|
| 76 |
+
# Loop through EOD indecies:
|
| 77 |
+
prev_index = 0
|
| 78 |
+
for j in range(eod_index.size()[0]):
|
| 79 |
+
i = eod_index[j]
|
| 80 |
+
# Mask attention loss.
|
| 81 |
+
if reset_attention_mask:
|
| 82 |
+
attention_mask[b, 0, (i + 1) :, : (i + 1)] = 0
|
| 83 |
+
# Reset positions.
|
| 84 |
+
if reset_position_ids:
|
| 85 |
+
position_ids[b, (i + 1) :] -= i + 1 - prev_index
|
| 86 |
+
prev_index = i + 1
|
| 87 |
+
|
| 88 |
+
# Convert attention mask to binary:
|
| 89 |
+
attention_mask = attention_mask < 0.5
|
| 90 |
+
|
| 91 |
+
return attention_mask, loss_mask, position_ids
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def get_batch(context_tokens: torch.LongTensor, eod_id: int):
|
| 95 |
+
"""Generate batch from context tokens."""
|
| 96 |
+
# Move to GPU.
|
| 97 |
+
tokens = context_tokens.contiguous().to(context_tokens.device)
|
| 98 |
+
# Get the attention mask and postition ids.
|
| 99 |
+
attention_mask, _, position_ids = get_ltor_masks_and_position_ids(
|
| 100 |
+
tokens,
|
| 101 |
+
eod_id,
|
| 102 |
+
reset_position_ids=False,
|
| 103 |
+
reset_attention_mask=False,
|
| 104 |
+
eod_mask_loss=False,
|
| 105 |
+
)
|
| 106 |
+
return tokens, attention_mask, position_ids
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def get_stop_words_ids(chat_format, tokenizer):
|
| 110 |
+
if chat_format == "raw":
|
| 111 |
+
stop_words_ids = [tokenizer.encode("Human:"), [tokenizer.eod_id]]
|
| 112 |
+
elif chat_format == "chatml":
|
| 113 |
+
stop_words_ids = [[tokenizer.im_end_id], [tokenizer.im_start_id]]
|
| 114 |
+
else:
|
| 115 |
+
raise NotImplementedError(f"Unknown chat format {chat_format!r}")
|
| 116 |
+
return stop_words_ids
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def make_context(
|
| 120 |
+
tokenizer: PreTrainedTokenizer,
|
| 121 |
+
query: str,
|
| 122 |
+
history: List[Tuple[str, str]] = None,
|
| 123 |
+
system: str = "",
|
| 124 |
+
max_window_size: int = 6144,
|
| 125 |
+
chat_format: str = "chatml",
|
| 126 |
+
):
|
| 127 |
+
if history is None:
|
| 128 |
+
history = []
|
| 129 |
+
|
| 130 |
+
if chat_format == "chatml":
|
| 131 |
+
im_start, im_end = "<|im_start|>", "<|im_end|>"
|
| 132 |
+
im_start_tokens = [tokenizer.im_start_id]
|
| 133 |
+
im_end_tokens = [tokenizer.im_end_id]
|
| 134 |
+
nl_tokens = tokenizer.encode("\n")
|
| 135 |
+
|
| 136 |
+
def _tokenize_str(role, content):
|
| 137 |
+
return f"{role}\n{content}", tokenizer.encode(
|
| 138 |
+
role, allowed_special=set()
|
| 139 |
+
) + nl_tokens + tokenizer.encode(content, allowed_special=set())
|
| 140 |
+
|
| 141 |
+
system_text, system_tokens_part = _tokenize_str("system", system)
|
| 142 |
+
system_tokens = im_start_tokens + system_tokens_part + im_end_tokens
|
| 143 |
+
|
| 144 |
+
raw_text = ""
|
| 145 |
+
context_tokens = []
|
| 146 |
+
|
| 147 |
+
for turn_query, turn_response in reversed(history):
|
| 148 |
+
query_text, query_tokens_part = _tokenize_str("user", turn_query)
|
| 149 |
+
query_tokens = im_start_tokens + query_tokens_part + im_end_tokens
|
| 150 |
+
response_text, response_tokens_part = _tokenize_str(
|
| 151 |
+
"assistant", turn_response
|
| 152 |
+
)
|
| 153 |
+
response_tokens = im_start_tokens + response_tokens_part + im_end_tokens
|
| 154 |
+
|
| 155 |
+
next_context_tokens = nl_tokens + query_tokens + nl_tokens + response_tokens
|
| 156 |
+
prev_chat = (
|
| 157 |
+
f"\n{im_start}{query_text}{im_end}\n{im_start}{response_text}{im_end}"
|
| 158 |
+
)
|
| 159 |
+
|
| 160 |
+
current_context_size = (
|
| 161 |
+
len(system_tokens) + len(next_context_tokens) + len(context_tokens)
|
| 162 |
+
)
|
| 163 |
+
if current_context_size < max_window_size:
|
| 164 |
+
context_tokens = next_context_tokens + context_tokens
|
| 165 |
+
raw_text = prev_chat + raw_text
|
| 166 |
+
else:
|
| 167 |
+
break
|
| 168 |
+
|
| 169 |
+
context_tokens = system_tokens + context_tokens
|
| 170 |
+
raw_text = f"{im_start}{system_text}{im_end}" + raw_text
|
| 171 |
+
context_tokens += (
|
| 172 |
+
nl_tokens
|
| 173 |
+
+ im_start_tokens
|
| 174 |
+
+ _tokenize_str("user", query)[1]
|
| 175 |
+
+ im_end_tokens
|
| 176 |
+
+ nl_tokens
|
| 177 |
+
+ im_start_tokens
|
| 178 |
+
+ tokenizer.encode("assistant")
|
| 179 |
+
+ nl_tokens
|
| 180 |
+
)
|
| 181 |
+
raw_text += f"\n{im_start}user\n{query}{im_end}\n{im_start}assistant\n"
|
| 182 |
+
|
| 183 |
+
elif chat_format == "raw":
|
| 184 |
+
raw_text = query
|
| 185 |
+
context_tokens = tokenizer.encode(raw_text)
|
| 186 |
+
else:
|
| 187 |
+
raise NotImplementedError(f"Unknown chat format {chat_format!r}")
|
| 188 |
+
|
| 189 |
+
return raw_text, context_tokens
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
def _decode_default(
|
| 193 |
+
tokens: List[int],
|
| 194 |
+
*,
|
| 195 |
+
stop_words: List[str],
|
| 196 |
+
eod_words: List[str],
|
| 197 |
+
tokenizer: PreTrainedTokenizer,
|
| 198 |
+
raw_text_len: int,
|
| 199 |
+
verbose: bool = False,
|
| 200 |
+
return_end_reason: bool = False,
|
| 201 |
+
errors: str='replace',
|
| 202 |
+
):
|
| 203 |
+
trim_decode_tokens = tokenizer.decode(tokens, errors=errors)[raw_text_len:]
|
| 204 |
+
if verbose:
|
| 205 |
+
print("\nRaw Generate: ", trim_decode_tokens)
|
| 206 |
+
|
| 207 |
+
end_reason = f"Gen length {len(tokens)}"
|
| 208 |
+
for stop_word in stop_words:
|
| 209 |
+
trim_decode_tokens = trim_decode_tokens.replace(stop_word, "").strip()
|
| 210 |
+
for eod_word in eod_words:
|
| 211 |
+
if eod_word in trim_decode_tokens:
|
| 212 |
+
end_reason = f"Gen {eod_word!r}"
|
| 213 |
+
trim_decode_tokens = trim_decode_tokens.split(eod_word)[0]
|
| 214 |
+
trim_decode_tokens = trim_decode_tokens.strip()
|
| 215 |
+
if verbose:
|
| 216 |
+
print("\nEnd Reason:", end_reason)
|
| 217 |
+
print("\nGenerate: ", trim_decode_tokens)
|
| 218 |
+
|
| 219 |
+
if return_end_reason:
|
| 220 |
+
return trim_decode_tokens, end_reason
|
| 221 |
+
else:
|
| 222 |
+
return trim_decode_tokens
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
def _decode_chatml(
|
| 226 |
+
tokens: List[int],
|
| 227 |
+
*,
|
| 228 |
+
stop_words: List[str],
|
| 229 |
+
eod_token_ids: List[int],
|
| 230 |
+
tokenizer: PreTrainedTokenizer,
|
| 231 |
+
raw_text_len: int,
|
| 232 |
+
context_length: int,
|
| 233 |
+
verbose: bool = False,
|
| 234 |
+
return_end_reason: bool = False,
|
| 235 |
+
errors: str='replace'
|
| 236 |
+
):
|
| 237 |
+
end_reason = f"Gen length {len(tokens)}"
|
| 238 |
+
eod_token_idx = context_length
|
| 239 |
+
for eod_token_idx in range(context_length, len(tokens)):
|
| 240 |
+
if tokens[eod_token_idx] in eod_token_ids:
|
| 241 |
+
end_reason = f"Gen {tokenizer.decode([tokens[eod_token_idx]])!r}"
|
| 242 |
+
break
|
| 243 |
+
|
| 244 |
+
trim_decode_tokens = tokenizer.decode(tokens[:eod_token_idx], errors=errors)[raw_text_len:]
|
| 245 |
+
if verbose:
|
| 246 |
+
print("\nRaw Generate w/o EOD:", tokenizer.decode(tokens, errors=errors)[raw_text_len:])
|
| 247 |
+
print("\nRaw Generate:", trim_decode_tokens)
|
| 248 |
+
print("\nEnd Reason:", end_reason)
|
| 249 |
+
for stop_word in stop_words:
|
| 250 |
+
trim_decode_tokens = trim_decode_tokens.replace(stop_word, "").strip()
|
| 251 |
+
trim_decode_tokens = trim_decode_tokens.strip()
|
| 252 |
+
if verbose:
|
| 253 |
+
print("\nGenerate:", trim_decode_tokens)
|
| 254 |
+
|
| 255 |
+
if return_end_reason:
|
| 256 |
+
return trim_decode_tokens, end_reason
|
| 257 |
+
else:
|
| 258 |
+
return trim_decode_tokens
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
def decode_tokens(
|
| 262 |
+
tokens: Union[torch.LongTensor, TokensType],
|
| 263 |
+
tokenizer: PreTrainedTokenizer,
|
| 264 |
+
raw_text_len: int,
|
| 265 |
+
context_length: int,
|
| 266 |
+
chat_format: str,
|
| 267 |
+
verbose: bool = False,
|
| 268 |
+
return_end_reason: bool = False,
|
| 269 |
+
errors: str="replace",
|
| 270 |
+
) -> str:
|
| 271 |
+
if torch.is_tensor(tokens):
|
| 272 |
+
tokens = tokens.cpu().numpy().tolist()
|
| 273 |
+
|
| 274 |
+
if chat_format == "chatml":
|
| 275 |
+
return _decode_chatml(
|
| 276 |
+
tokens,
|
| 277 |
+
stop_words=[],
|
| 278 |
+
eod_token_ids=[tokenizer.im_start_id, tokenizer.im_end_id],
|
| 279 |
+
tokenizer=tokenizer,
|
| 280 |
+
raw_text_len=raw_text_len,
|
| 281 |
+
context_length=context_length,
|
| 282 |
+
verbose=verbose,
|
| 283 |
+
return_end_reason=return_end_reason,
|
| 284 |
+
errors=errors,
|
| 285 |
+
)
|
| 286 |
+
elif chat_format == "raw":
|
| 287 |
+
return _decode_default(
|
| 288 |
+
tokens,
|
| 289 |
+
stop_words=["<|endoftext|>"],
|
| 290 |
+
eod_words=["<|endoftext|>"],
|
| 291 |
+
tokenizer=tokenizer,
|
| 292 |
+
raw_text_len=raw_text_len,
|
| 293 |
+
verbose=verbose,
|
| 294 |
+
return_end_reason=return_end_reason,
|
| 295 |
+
errors=errors,
|
| 296 |
+
)
|
| 297 |
+
else:
|
| 298 |
+
raise NotImplementedError(f"Unknown chat format {chat_format!r}")
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
class StopWordsLogitsProcessor(LogitsProcessor):
|
| 302 |
+
"""
|
| 303 |
+
:class:`transformers.LogitsProcessor` that enforces that when specified sequences appear, stop geration.
|
| 304 |
+
|
| 305 |
+
Args:
|
| 306 |
+
stop_words_ids (:obj:`List[List[int]]`):
|
| 307 |
+
List of list of token ids of stop ids. In order to get the tokens of the words
|
| 308 |
+
that should not appear in the generated text, use :obj:`tokenizer(bad_word,
|
| 309 |
+
add_prefix_space=True).input_ids`.
|
| 310 |
+
eos_token_id (:obj:`int`):
|
| 311 |
+
The id of the `end-of-sequence` token.
|
| 312 |
+
"""
|
| 313 |
+
|
| 314 |
+
def __init__(self, stop_words_ids: Iterable[Iterable[int]], eos_token_id: int):
|
| 315 |
+
|
| 316 |
+
if not isinstance(stop_words_ids, List) or len(stop_words_ids) == 0:
|
| 317 |
+
raise ValueError(
|
| 318 |
+
f"`stop_words_ids` has to be a non-emtpy list, but is {stop_words_ids}."
|
| 319 |
+
)
|
| 320 |
+
if any(not isinstance(bad_word_ids, list) for bad_word_ids in stop_words_ids):
|
| 321 |
+
raise ValueError(
|
| 322 |
+
f"`stop_words_ids` has to be a list of lists, but is {stop_words_ids}."
|
| 323 |
+
)
|
| 324 |
+
if any(
|
| 325 |
+
any(
|
| 326 |
+
(not isinstance(token_id, (int, np.integer)) or token_id < 0)
|
| 327 |
+
for token_id in stop_word_ids
|
| 328 |
+
)
|
| 329 |
+
for stop_word_ids in stop_words_ids
|
| 330 |
+
):
|
| 331 |
+
raise ValueError(
|
| 332 |
+
f"Each list in `stop_words_ids` has to be a list of positive integers, but is {stop_words_ids}."
|
| 333 |
+
)
|
| 334 |
+
|
| 335 |
+
self.stop_words_ids = list(
|
| 336 |
+
filter(
|
| 337 |
+
lambda bad_token_seq: bad_token_seq != [eos_token_id], stop_words_ids
|
| 338 |
+
)
|
| 339 |
+
)
|
| 340 |
+
self.eos_token_id = eos_token_id
|
| 341 |
+
for stop_token_seq in self.stop_words_ids:
|
| 342 |
+
assert (
|
| 343 |
+
len(stop_token_seq) > 0
|
| 344 |
+
), "Stop words token sequences {} cannot have an empty list".format(
|
| 345 |
+
stop_words_ids
|
| 346 |
+
)
|
| 347 |
+
|
| 348 |
+
def __call__(
|
| 349 |
+
self, input_ids: torch.LongTensor, scores: torch.FloatTensor
|
| 350 |
+
) -> torch.FloatTensor:
|
| 351 |
+
stopped_samples = self._calc_stopped_samples(input_ids)
|
| 352 |
+
for i, should_stop in enumerate(stopped_samples):
|
| 353 |
+
if should_stop:
|
| 354 |
+
scores[i, self.eos_token_id] = float(2**15)
|
| 355 |
+
return scores
|
| 356 |
+
|
| 357 |
+
def _tokens_match(self, prev_tokens: torch.LongTensor, tokens: List[int]) -> bool:
|
| 358 |
+
if len(tokens) == 0:
|
| 359 |
+
# if bad word tokens is just one token always ban it
|
| 360 |
+
return True
|
| 361 |
+
elif len(tokens) > len(prev_tokens):
|
| 362 |
+
# if bad word tokens are longer then prev input_ids they can't be equal
|
| 363 |
+
return False
|
| 364 |
+
elif prev_tokens[-len(tokens) :].tolist() == tokens:
|
| 365 |
+
# if tokens match
|
| 366 |
+
return True
|
| 367 |
+
else:
|
| 368 |
+
return False
|
| 369 |
+
|
| 370 |
+
def _calc_stopped_samples(self, prev_input_ids: Iterable[int]) -> Iterable[int]:
|
| 371 |
+
stopped_samples = []
|
| 372 |
+
for prev_input_ids_slice in prev_input_ids:
|
| 373 |
+
match = False
|
| 374 |
+
for stop_token_seq in self.stop_words_ids:
|
| 375 |
+
if self._tokens_match(prev_input_ids_slice, stop_token_seq):
|
| 376 |
+
# if tokens do not match continue
|
| 377 |
+
match = True
|
| 378 |
+
break
|
| 379 |
+
stopped_samples.append(match)
|
| 380 |
+
|
| 381 |
+
return stopped_samples
|
| 382 |
+
|
| 383 |
+
|
| 384 |
+
def top_k_logits(logits, top_k=0, top_p=0.0, filter_value=-float("Inf")):
|
| 385 |
+
"""This function has been mostly taken from huggingface conversational
|
| 386 |
+
ai code at
|
| 387 |
+
https://medium.com/huggingface/how-to-build-a-state-of-the-art-
|
| 388 |
+
conversational-ai-with-transfer-learning-2d818ac26313"""
|
| 389 |
+
|
| 390 |
+
if top_k > 0:
|
| 391 |
+
# Remove all tokens with a probability less than the
|
| 392 |
+
# last token of the top-k
|
| 393 |
+
indices_to_remove = logits < torch.topk(logits, top_k)[0][..., -1, None]
|
| 394 |
+
logits[indices_to_remove] = filter_value
|
| 395 |
+
|
| 396 |
+
if top_p > 0.0:
|
| 397 |
+
# Cconvert to 1D
|
| 398 |
+
sorted_logits, sorted_indices = torch.sort(logits, descending=True, dim=-1)
|
| 399 |
+
cumulative_probs = torch.cumsum(F.softmax(sorted_logits, dim=-1), dim=-1)
|
| 400 |
+
|
| 401 |
+
# Remove tokens with cumulative probability above the threshold
|
| 402 |
+
sorted_indices_to_remove = cumulative_probs > top_p
|
| 403 |
+
# Shift the indices to the right to keep also the first token
|
| 404 |
+
# above the threshold
|
| 405 |
+
sorted_indices_to_remove[..., 1:] = sorted_indices_to_remove[..., :-1].clone()
|
| 406 |
+
sorted_indices_to_remove[..., 0] = 0
|
| 407 |
+
for i in range(sorted_indices.size(0)):
|
| 408 |
+
indices_to_remove = sorted_indices[i][sorted_indices_to_remove[i]]
|
| 409 |
+
logits[i][indices_to_remove] = filter_value
|
| 410 |
+
|
| 411 |
+
return logits
|
| 412 |
+
|
| 413 |
+
|
| 414 |
+
def switch(val1, val2, boolean):
|
| 415 |
+
boolean = boolean.type_as(val1)
|
| 416 |
+
return (1 - boolean) * val1 + boolean * val2
|