o
    iP                     @   s8   G d d de ZG dd dedZG dd dedZdS )c                       s   e Zd Z fddZ  ZS )ErrorsWithCodesc                    s(   t  |}|dr|S dj||dS )N__z%(curated-transformers) [{code}] {msg})codemsg)super__getattribute__
startswithformat)selfr   r   	__class__ O/home/ubuntu/.local/lib/python3.10/site-packages/curated_transformers/errors.pyr      s   
z ErrorsWithCodes.__getattribute__)__name__
__module____qualname__r   __classcell__r   r   r
   r   r      s    r   c                   @   s   e Zd ZdZdS )WarningszSSkipping transfomer pipe with TorchScript model - Model is likely already quantizedN)r   r   r   W001r   r   r   r   r      s    r   )	metaclassc                   @   sl   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdS )ErrorszAttempting to quantize a transformer pipe with a non-PyTorch model ('{model_name}'). Quantization is only supported by PyTorch-specific curated transformer modelszThe number of hidden layers ({num_hidden_layers}) in the ALBERT encoder must be divisable by number of hidden groups ({num_hidden_groups})zzThe hidden width of the transformer ({hidden_width}) must be divisible by the number of self-attention heads ({num_heads})z{The point-wise feed-forward network in the transformer only supports the following activation functions: {activation_funcs}zAttempting to load the weights of an unsupported Hugging Face `transformers` model ({unsupported_model}). Currently supported models: {supported_models}a+  The number of layers in the scalar weighting listener model ({num_layers_scalar_weight})needs to be the same as the number of hidden layers in the transformer ({num_layers_transformer}). You can use the config's interpolation functionality to link the former's `num_layers` parameter with the latterzAt least one sequence in the transformer's input has a length of {seq_len}, which is larger than the model's maximum sequence length of {max_seq_len} tokenszBCurated transformers do not currently support listener replacementzP`{loader_name}` requires the Hugging Face `transformers` package to be installedz`{listener_name}` requires the upstream transformer pipe to output all hidden layer outputs. This can be enabled by setting the pipe's `all_layer_outputs` parameter to `True` in the pipeline configzThe target pipe names for gradual transformer unfreezing contain both the wild-card operator ('*') and individual names. Use either of the two but not bothzModel '{model_name}' received an unexpected input of type '{input_type}'. It can only wrap/be chained with models whose outputs are of type  `TransformerModelOutput` (in almost all cases, models of type `TorchTransformerModelT`)zrInput passed to the `ScalarWeight` model do not have the same number layers. Distinct layer counts: {layer_counts}zeInput passed to the `ScalarWeight` model do not have the same width. Distinct widths: {hidden_widths}ztSpan extractor stride ({stride}) must be within [window_size / 2, window_size] ([{half_window_size}, {window_size}])z3Span extractor batch size must be greater than zerozAByte-BPE piece encoder vocabulary doesn't contain '{piece}' piecez\Character piece encoder vocabulary is not available. Use a loader to initialize the encoder.zAttempting to use the `CharEncoderLoader` piece encoder loader with an incompatible model ('{model_name}'). It can only be used with the `CharEncoder` piece encoderzAttempting to load an unsupported Hugging Face tokenizer ({unsupported_tokenizer}). Currently supported tokenizers: {supported_tokenizers}zFJapanese BERT models currently only support character subword encodingzAttempting to initialize an incompatible piece encoder ('{model_name}') with the Hugging Face Japanese BERT tokenizer. It can only be used with the `CharEncoder` piece encoderzAttempting to perform gradual unfreezing of a non-transformer pipe ('{pipe_name}'}. Only transformer pipes support this featurezAttempting to load the weights of a Hugging Face `transformers` model into an unsupported curated encoder ({unsupported_encoder}). Currently supported encoders: {supported_encoders}N)r   r   r   E001E002E003E004E007E008E009E010E011E012E013E014E015E016E017E018E019E020E021E022E023E024E025E026r   r   r   r   r      s2    r   N)typer   r   r   r   r   r   r   <module>   s    