o
�J�h4� � @ s� d dl Z d dlZd dlZd dlZd dlmZ d dlmZm Z m
Z
mZmZm
Z
d dlZd dlmZ ddlmZ ddlmZmZmZmZ ddlmZ e� rQd d lmZ e�e�ZG d
d� dej j!�Z"eG dd
� d
��Z#eG dd� de#��Z$eG dd� de#��Z%G dd� de"�Z&G dd� de&�Z'G dd� de&�Z(G dd� de(�Z)G dd� de(�Z*G dd� de"�Z+G dd� de"�Z,G d d!� d!e,�Z-G d"d#� d#e"�Z.G d$d%� d%e"�Z/G d&d'� d'�Z0G d(d)� d)e,�Z1dS )*� N)� dataclass)�Any�Dict�List�Optional�Tuple�Union��version� )�PretrainedConfig)�is_hqq_available�is_optimum_quanto_available�is_torchdynamo_compiling�logging)�deprecate_kwarg)� Quantizerc
s� e Zd ZdZ� fdd�Z ddejdejdedee e
ef d eejejf f
d
d�Z
ddee d efd
d�Zd ee fdd�Zd ee fdd�Zddedee d efdd�Zdejfdd�Zedd� �Z� ZS )�Cachezf
Base, abstract class for all caches. The actual data structure is specific to each subclass.
c s t � �� d S �N)�super�__init__��self�� __class__� �VC:\pinokio\api\whisper-webui.git\app\env\lib\site-packages\transformers\cache_utils.pyr s zCache.__init__N�
key_states�value_states� layer_idx�cache_kwargs�returnc C � t d��)a�
Updates the cache with the new `key_states` and `value_states` for the layer `layer_idx`.
Parameters:
key_states (`torch.Tensor`):
The new key states to cache.
value_states (`torch.Tensor`):
The new value states to cache.
layer_idx (`int`):
The index of the layer to cache the states for.
cache_kwargs (`Dict[str, Any]`, `optional`):
Additional arguments for the cache subclass. These are specific to each subclass and allow new types of
cache to be created.
Return:
A tuple containing the updated key and value states.
z.Make sure to implement `update` in a subclass.��NotImplementedError)r r r r r r r r �update# s zCache.updater c C r"