
    ^jm                     8   d dl Z d dlmZ d dlmZ d dlZd dlmZ ddlmZ ddl	m
Z
mZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZmZmZ ddlmZmZ ddlmZ ddlmZmZm Z m!Z!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z*m+Z+  e!jX                  e-      Z.	 	 d6dej^                  dej`                  dej`                  dej`                  dej`                  dz  de1dz  de1fdZ2 G d dej^                        Z3 G d  d!e      Z4e G d" d#e             Z5e G d$ d%e             Z6 ed&'      e G d( d)e                    Z7 ed*'       G d+ d,e5             Z8 G d- d.ej^                        Z9 ed/'       G d0 d1e5             Z: ed2'       G d3 d4e5e             Z;g d5Z<y)7    N)Callable)	dataclass)nn   )ACT2FN)CacheEncoderDecoderCache)GenerationMixin)create_bidirectional_mask)FlashAttentionKwargs)GradientCheckpointingLayer)BaseModelOutputWithPastBaseModelOutputWithPoolingModelOutput)ALL_ATTENTION_FUNCTIONSPreTrainedModel)Unpack)TransformersKwargsauto_docstringcan_return_tupleloggingtorch_compilable_check)merge_with_config_defaults)capture_outputs   )	AutoModel   )AudioFlamingo3ConfigAudioFlamingo3EncoderConfigmodulequerykeyvalueattention_maskscalingdropoutc                    ||j                  d      dz  }t        j                  ||j                  dd            |z  }|||z   }t        j
                  j                  |d      }t        j
                  j                  ||| j                        }t        j                  ||      }	|	j                  dd      j                         }	|	|fS )N      r   r   )dimptrainingr   )
sizetorchmatmul	transposer   
functionalsoftmaxr&   r-   
contiguous)
r    r!   r"   r#   r$   r%   r&   kwargsattn_weightsattn_outputs
             /var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/transformers/models/audioflamingo3/modeling_audioflamingo3.pyeager_attention_forwardr9   0   s     **R.D(<<s}}Q':;gEL!#n4==((2(>L==((6??([L,,|U3K''1-88:K$$    c                   :    e Zd ZdZ	 	 	 	 	 	 ddedededededed	edz  d
edz  f fdZ	 	 	 	 dde	j                  de	j                  dz  dedz  de	j                  dz  dedee   dee	j                  e	j                  dz  ee	j                     dz  f   fdZ xZS )AudioFlamingo3Attentionz=Multi-headed attention from 'Attention Is All You Need' paperN	embed_dim	num_headsr&   
is_decoderbias	is_causal	layer_idxconfigc	                 z   t         	|           || _        || _        || _        ||z  | _        || _        | j
                  |z  | j                  k7  rt        d| j                   d| d      | j
                  dz  | _        || _	        || _
        |/|r-t        j                  d| j                  j                   d       || _        t!        j"                  ||d      | _        t!        j"                  |||      | _        t!        j"                  |||      | _        t!        j"                  |||      | _        y )	Nz;embed_dim must be divisible by num_heads (got `embed_dim`: z and `num_heads`: z).r)   zInstantiating a decoder z without passing `layer_idx` is not recommended and will to errors during the forward call, if caching is used. Please make sure to provide a `layer_idx` when creating this class.Fr@   )super__init__r=   r>   r&   head_dimrC   
ValueErrorr%   r?   rA   loggerwarning_once	__class____name__rB   r   Lineark_projv_projq_projout_proj)
selfr=   r>   r&   r?   r@   rA   rB   rC   rL   s
            r8   rG   z AudioFlamingo3Attention.__init__M   s     	""!Y.MMI%$..8MdnnM]$YKr3  }}d*$"*4>>+B+B*C D, ,
 #ii	95Aii	94@ii	94@		)YTBr:   hidden_stateskey_value_statespast_key_valuesr$   output_attentionsr5   returnc                    |du}|j                   dd }g |d| j                  }	| j                  |      | j                  z  j	                  |	      j                  dd      j                         }
|it        |t              rY|j                  j                  | j                        }|r&d|j                  | j                  <   |j                  }n|j                  }||n|}|rK|rIrG|j                  | j                     j                  }|j                  | j                     j                   }n|d   d| j"                  | j                  f}| j%                  |      j	                  |      j                  dd      j                         }| j'                  |      j	                  |      j                  dd      j                         }| |j)                  ||| j                        \  }}t+        j,                  | j.                  j0                  t2              } || |
|||f| j4                  sdn| j6                  d|d	|\  }} |j8                  g |d j                         }| j;                  |      }||fS )
z#Input shape: Batch x Time x ChannelNr(   r   r   Tr                 ?)r&   r%   rW   )shaperH   rQ   r%   viewr1   r4   
isinstancer	   
is_updatedgetrB   cross_attention_cacheself_attention_cachelayerskeysvaluesr>   rO   rP   updater   get_interfacerC   _attn_implementationr9   r-   r&   reshaperR   )rS   rT   rU   rV   r$   rW   r5   is_cross_attentioninput_shapehidden_shapequery_statesr_   current_states
key_statesvalue_stateskv_shapeattention_interfacer7   r6   s                      r8   forwardzAudioFlamingo3Attention.forwardu   s`    .T9#))#2.88b8$--8 M2T\\AGGU__`acdeppr &:oGZ+[(3377GJ!=A**4>>:"1"G"G"1"F"F .>-I)}/j(//?DDJ*11$..AHHL
 $ADNNDMMJH^499(CMMaQRS^^`J;;~6;;HEOOPQSTU``bL*+:+A+A*l\`\j\j+k(
L(?(M(MKK,,.E)
 %8
%
  $}}C$,,/
%
 
%
!\ *k));;;;FFHmmK0L((r:   )rZ   FTFNN)NNNF)rM   
__module____qualname____doc__intfloatboolr   rG   r/   Tensorr   r   r   tuplers   __classcell__rL   s   @r8   r<   r<   J   s&   G   $.2&C&C &C 	&C
 &C &C &C :&C %t+&CV 15(,.2"'H)||H)  ,,-H) 	H)
 t+H)  H) -.H) 
u||U\\D0%2E2LL	MH)r:   r<   c                   ~     e Zd Zdef fdZdej                  dej                  dee   dej                  fdZ	 xZ
S )AudioFlamingo3EncoderLayerrC   c                 h   t         |           |j                  | _        t	        | j                  |j
                  |j                  |      | _        t        j                  | j                        | _
        |j                  | _        t        |j                     | _        |j                  | _        t        j                   | j                  |j"                        | _        t        j                   |j"                  | j                        | _        t        j                  | j                        | _        y )N)r=   r>   r&   rC   )rF   rG   d_modelr=   r<   encoder_attention_headsattention_dropout	self_attnr   	LayerNormself_attn_layer_normr&   r   activation_functionactivation_fnactivation_dropoutrN   encoder_ffn_dimfc1fc2final_layer_normrS   rC   rL   s     r8   rG   z#AudioFlamingo3EncoderLayer.__init__   s    0nn44,,	
 %'LL$@!~~#F$>$>?"(";";99T^^V-C-CD99V33T^^D "T^^ <r:   rT   r$   r5   rX   c                     |}| j                  |      } | j                  d||d|\  }}t        j                  j	                  || j                  | j
                        }||z   }|}| j                  |      }| j                  | j                  |            }t        j                  j	                  || j                  | j
                        }| j                  |      }t        j                  j	                  || j                  | j
                        }||z   }|j                  t        j                  k(  rEt        j                  |j                        j                  dz
  }t        j                   || |      }|S )a>  
        Args:
            hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
            attention_mask (`torch.FloatTensor`): attention mask of size
                `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values.
        )rT   r$   r+   i  )minmax )r   r   r   r2   r&   r-   r   r   r   r   r   dtyper/   float16finfor   clamp)rS   rT   r$   r5   residual_clamp_values          r8   rs   z"AudioFlamingo3EncoderLayer.forward   sT    !11-@)4>> 
')
 
q
 --mt||VZVcVc-d =0 --m<**488M+BC--mt?V?Vaeanan-o/--mt||VZVcVc-d =0%--/++m&9&9:>>EK!KKK<[YMr:   )rM   rt   ru   r   rG   r/   rz   r   r   rs   r|   r}   s   @r8   r   r      sM    =3 =$"||" " +,	"
 
"r:   r   c                   <    e Zd ZU eed<   dZdZdZdgZdgZ	dZ
dZdZy)AudioFlamingo3PreTrainedModelrC   model)audiotextTr<   rV   N)rM   rt   ru   r   __annotations__base_model_prefixinput_modalitiessupports_gradient_checkpointing_no_split_modules_skip_keys_device_placement_supports_flash_attn_supports_sdpa_supports_attention_backendr   r:   r8   r   r      s=      (&*#23#4"5N"&r:   r   c                   :    e Zd ZU dZdZej                  dz  ed<   y)!AudioFlamingo3ModelOutputWithPastzg
    audio_hidden_states (`torch.FloatTensor`, *optional*):
        Projected audio hidden states.
    Naudio_hidden_states)rM   rt   ru   rv   r   r/   FloatTensorr   r   r:   r8   r   r     s    
 59**T18r:   r   zZ
    Base class for AudioFlamingo3 causal language model (or autoregressive) outputs.
    custom_introc                       e Zd ZU dZdZej                  dz  ed<   dZej                  dz  ed<   dZ	e
dz  ed<   dZeej                     dz  ed<   dZeej                     dz  ed<   dZej                  dz  ed<   y)	$AudioFlamingo3CausalLMOutputWithPastaV  
    loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
        Language modeling loss (for next-token prediction).
    logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`):
        Prediction scores of the language modeling head.
    past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`):
        It is a [`~cache_utils.Cache`] instance.
    audio_hidden_states (`torch.FloatTensor`, *optional*):
        Hidden states of the audio encoder after projection.
    NlosslogitsrV   rT   
attentionsr   )rM   rt   ru   rv   r   r/   r   r   r   rV   r   rT   r{   r   r   r   r:   r8   r   r     s    	 &*D%

d
")'+FE$+$(OUT\(59M5**+d2926Je''(4/648**T18r:   r   zT
    The audio model from AudioFlamingo3 without any head or projection on top.
    c            
           e Zd ZU dZeed<   dZdZdgZe	e
dZdef fdZd Zd	ej                  fd
Zdej                  fdZee	 ddej*                  dej*                  dz  d	eez  fd              Zdej2                  fdZ xZS )AudioFlamingo3EncoderzY
    AudioFlamingo3 encoder: Whisper encoder, average pool (time/2), then LayerNorm.
    rC   input_featuresr   r   )rT   r   c                 b   t         |   |       |j                  | _        |j                  | _        |j
                  }|j                  | _        |j                  | _        |j                  rt        j                  |      nd| _        t        j                  | j                  |dd      | _        t        j                  ||ddd      | _        t        j                   | j                  |      | _        | j"                  j%                  d       t        j&                  t)        |j*                        D cg c]  }t-        |       c}      | _        t        j0                  |j
                        | _        t        j4                  dd      | _        d| _        | j;                          y c c}w )	Nr[   r   r   )kernel_sizepaddingr   )r   strider   F)r   )rF   rG   r&   encoder_layerdrop	layerdropr   num_mel_binsmax_source_positionsscale_embeddingmathsqrtembed_scaler   Conv1dconv1conv2	Embeddingembed_positionsrequires_grad_
ModuleListrangeencoder_layersr   rc   r   
layer_norm	AvgPool1d
avg_poolergradient_checkpointing	post_init)rS   rC   r=   r   rL   s       r8   rG   zAudioFlamingo3Encoder.__init__>  s7    ~~11NN	"//$*$?$?!393I3I499Y/sYYt00)TUV
YYy)1VWX
!||D,E,EyQ++E2mmQVW]WlWlQm$nA%?%G$no,,v~~6,,q3&+# %os   6F,c                 J    | j                         D ]	  }d|_         d| _        y )NF)
parametersrequires_grad_requires_grad)rS   params     r8   _freeze_parametersz(AudioFlamingo3Encoder._freeze_parametersW  s(    __& 	(E"'E	(#r:   rX   c                     | j                   S Nr   )rS   s    r8   get_input_embeddingsz*AudioFlamingo3Encoder.get_input_embeddings\  s    zzr:   r#   c                     || _         y r   r   )rS   r#   s     r8   set_input_embeddingsz*AudioFlamingo3Encoder.set_input_embeddings_  s	    
r:   Ninput_features_maskc                    |j                   d   dz
  dz  dz   }|j                  d      }|dz
  dz  dz   }t        j                  ||j                        |dddf   k  }t
        j                  j                  | j                  |            }t
        j                  j                  | j                  |            }|j                  ddd      }|| j                  j                  z   }t
        j                  j                  || j                  | j                        }t        | j                   ||      }| j"                  D ]>  }	| j                  xr" t        j$                  g       | j&                  k  }
|
r6 |	||      }@ |j                  ddd      }| j)                  |      j                  ddd      }| j+                  |      }t-        |	      S )
ap  
        Args:
            input_features (`torch.FloatTensor` of shape `(batch_size, feature_size, sequence_length)`):
                Log-Mel features extracted from raw audio. Use the processor/feature extractor to compute and pad
                these features from waveform input.
            input_features_mask (`torch.FloatTensor` of shape `(batch_size, sequence_length)`, *optional*):
                Mask to avoid performing attention on padding feature indices. Mask values selected in `[0, 1]`:

                - 1 for tokens that are **not masked**,
                - 0 for tokens that are **masked**.
        r(   r   r   deviceNr   r+   )rC   inputs_embedsr$   )last_hidden_state)r\   sumr/   aranger   r   r2   gelur   r   permuter   weightr&   r-   r   rC   rc   randr   r   r   r   )rS   r   r   r5   seq_leninput_features_lengthsr   rT   r$   layerdrops              r8   rs   zAudioFlamingo3Encoder.forwardb  s   ( "''+a/A59!4!8!8!<"81"<!BQ!F#ll7>;P;PQTjklnrkrTss **4::n+EF**4::m+DE%--aA6 &(<(<(C(CC--mt||VZVcVc-d2;;'.
 [[ 	EE==DUZZ^dnn%DD %m^ D	E &--aA66>>q!QG6)+
 	
r:   input_lengthsc                 6    |dz
  dz  dz   }|dz
  dz  dz   }||fS )zs
        Computes the output length of the convolutional layers and the output length of the audio encoder
        r   r   r   )rS   r   output_lengthss      r8    _get_feat_extract_output_lengthsz6AudioFlamingo3Encoder._get_feat_extract_output_lengths  s7     '*q014'!+1A5n,,r:   r   )rM   rt   ru   rv   r   r   main_input_namer   r   r   r<   _can_record_outputsrG   r   r   Moduler   r   r   r   r/   rz   r{   r   rs   
LongTensorr   r|   r}   s   @r8   r   r   )  s    
 ('&O56 4-
: 2$
bii "))    483
3
 #\\D03

 
+	+3
   3
l-e>N>N -r:   r   c                   .     e Zd ZdZdef fdZd Z xZS )!AudioFlamingo3MultiModalProjectorz
    Audio adaptor (small MLP) that projects AudioFlamingo3Encoder features
    to the LLM embedding space so they can replace `<sound>` tokens.
    rC   c                    t         |           t        j                  |j                  j
                  |j                  j
                  |j                        | _        t        |j                     | _        t        j                  |j                  j
                  |j                  j
                  |j                        | _        y )NrE   )rF   rG   r   rN   audio_confighidden_sizetext_configprojector_biaslinear_1r   projector_hidden_actactlinear_2r   s     r8   rG   z*AudioFlamingo3MultiModalProjector.__init__  s    		++V-?-?-K-KRXRgRg
 &556		**F,>,>,J,JQWQfQf
r:   c                 l    | j                  |      }| j                  |      }| j                  |      }|S r   )r   r   r   )rS   audio_featuresrT   s      r8   rs   z)AudioFlamingo3MultiModalProjector.forward  s2    n5/m4r:   )rM   rt   ru   rv   r   rG   rs   r|   r}   s   @r8   r   r     s    

3 
r:   r   z
    The AudioFlamingo3 model (fine-tuned Whisper encoder, multi-modal projector, Qwen2 language model),
    without a language modeling head.
    c                       e Zd ZdZdZdZ fdZe ed      de	j                  de	j                  dee   deez  fd	              Zd
e	j"                  de	j                  de	j                  fdZee	 	 	 	 	 	 	 	 dd
e	j"                  dz  de	j                  dz  de	j                  dz  de	j                  dz  de	j"                  dz  dedz  de	j                  dz  dedz  dee   deez  fd              Z xZS )AudioFlamingo3ModelNc                     t         |   |       t        j                  |j                        | _        t        j                  |j                        | _        t        |      | _	        | j                          y r   )rF   rG   r   from_configr   audio_towerr   language_modelr   multi_modal_projectorr   r   s     r8   rG   zAudioFlamingo3Model.__init__  sY     $001D1DE'33F4F4FG%Fv%N"r:   zThis method is used to get the audio embeddings from input features (a log mel spectrogram), meaning inferring the audio encoder and the multi-modal projector.r   r   r   r5   rX   c                     | j                   |f|dd|}| j                  |j                        }|j                  d      j	                  t
        j                        }| j                   j                  |      \  }}t        j                  |j                  d   |j                        dddf   |dddf   k  }	||	j	                  |j                           |_        |S )a1  
        input_features (`torch.FloatTensor`):
            Float values of mel features extracted from the raw speech waveform.
        input_features_mask (`torch.Tensor` of shape `(batch_size, feature_sequence_length)`):
            Mask to avoid performing attention on padded feature indices.
        T)r   return_dictr(   r   r   N)r  r  r   r   tor/   longr   r   r\   r   pooler_output)
rS   r   r   r5   audio_outputaudio_embedsr   r   post_lengths
valid_masks
             r8   get_audio_featuresz&AudioFlamingo3Model.get_audio_features  s    " (t''
0CQU
Y_
 11,2P2PQ ,//366uzzB**KKMZ<\\,"4"4Q"7@S@STUY[\U\]`lmnptmt`uu
%1*--@S@S2T%U"r:   	input_idsr   r   c                 .   |m| | j                         t        j                  | j                  j                  t        j
                  |j                              k(  }|j                  d      }n|| j                  j                  k(  }|j                         }|j                  d   }|j                  d      j                  |      j                  |j                        }t        ||   j                         |j                         k(  d| d|        |S )z
        Obtains multimodal placeholder mask from `input_ids` or `inputs_embeds`, and checks that the placeholder token count is
        equal to the length of multimodal features. If the lengths are different, an error is raised.
        )r   r   r(   r   z6Audio features and audio tokens do not match, tokens: z, features: )r   r/   tensorrC   audio_token_idr  r   allr   r\   	unsqueeze	expand_asr
  r   numel)rS   r  r   r   special_audio_maskn_audio_tokensn_audio_featuress          r8   get_placeholder_maskz(AudioFlamingo3Model.get_placeholder_mask  s    !.2M$2K2K2MT[[77uzzR_RfRfg3 " "4!7!7!;!*dkk.H.H!H+//1)//2/99"=GGVYYZgZnZno,-3359M9M9OOD^DTT`aq`rs	
 "!r:   r$   position_idsrV   	use_cachec	           	         | | j                         |      }d}
|_|]| j                  ||d      j                  }
| j                  |||
      }|j	                  ||
j                  |j                              } | j                  d|||||d|	}t        |j                  |j                  |j                  |j                  |
      S )z
        input_features_mask (`torch.Tensor` of shape `(batch_size, feature_sequence_length)`):
            Mask to avoid performing attention on padding feature indices.
        NT)r	  )r   r   )r   r$   r  rV   r  )r   rV   rT   r   r   r   )r   r  r  r  masked_scatterr
  r   r  r   r   rV   rT   r   )rS   r  r   r   r$   r  rV   r   r  r5   r  r  outputss                r8   rs   zAudioFlamingo3Model.forward  s    $  7D557	BM%)*?22>CVdh2iwwL "&!:!:| "; " *889K\__]j]q]qMrsM%$%% 
')%+
 
 1%77#33!//)) ,
 	
r:   )NNNNNNNN)rM   rt   ru   _tp_plan_pp_plan_keep_in_fp32_modules_strictrG   r   r   r/   r   rz   r   r   r{   r   r  r   r  r   ry   r   rs   r|   r}   s   @r8   r  r    s    HH#'   w)) #\\ +,	
 
+	+ 4"))":?:K:K"]b]n]n"0  .23737.204(,26!%,
##d*,
 ))D0,
 #\\D0	,

 t+,
 &&-,
 ,
 ((4/,
 $;,
 +,,
 
2	2,
  ,
r:   r  z
    The AudioFlamingo3 model which consists of a fine-tuned Whisper encoder, a multi-modal projector and a Qwen2 language model.
    c                       e Zd ZdgZdZ fdZd Zee	 	 	 	 	 	 	 	 	 	 dde	j                  dz  de	j                  dz  de	j                  dz  de	j                  dz  d	e	j                  dz  d
edz  de	j                  dz  de	j                  dz  dedz  dee	j                  z  dee   deez  fd              Zdddef fdZ xZS )&AudioFlamingo3ForConditionalGenerationr   Nc                     t         |   |       t        |      | _        t	        j
                  |j                  j                  |j                  j                  d      | _	        | j                          y )NFrE   )rF   rG   r  r   r   rN   r   r   
vocab_sizelm_headr   r   s     r8   rG   z/AudioFlamingo3ForConditionalGeneration.__init__<  sS     (0
yy!3!3!?!?ASASA^A^ejkr:   c                 >     | j                   j                  ||fi |S r   )r   r  )rS   r   r   r5   s       r8   r  z9AudioFlamingo3ForConditionalGeneration.get_audio_featuresB  s"    ,tzz,,^=P[TZ[[r:   r  r   r   r$   r  rV   r   labelsr  logits_to_keepr5   rX   c                     | j                   d||||||||	d|}|j                  }t        |
t              rt	        |
 d      n|
}| j                  |dd|ddf         }d}|4 | j                  d||| j                  j                  j                  d|}t        |||j                  |j                  |j                  |j                        S )a  
        input_features_mask (`torch.Tensor` of shape `(batch_size, feature_sequence_length)`):
            Mask to avoid performing attention on padding feature indices.
        labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
            Labels for computing the masked language modeling loss.

        Example:

        ```python
        >>> from transformers import AudioFlamingo3ForConditionalGeneration, AutoProcessor

        >>> model_id = "nvidia/audio-flamingo-3-hf"
        >>> processor = AutoProcessor.from_pretrained(model_id)
        >>> model = AudioFlamingo3ForConditionalGeneration.from_pretrained(model_id, device_map="auto")
        ```)r  r   r   r$   r  rV   r   r  N)r   r,  r)  )r   r   rV   rT   r   r   r   )r   r   r^   rw   slicer*  loss_functionrC   r   r)  r   rV   rT   r   r   )rS   r  r   r   r$   r  rV   r   r,  r  r-  r5   r"  rT   slice_indicesr   r   s                    r8   rs   z.AudioFlamingo3ForConditionalGeneration.forwardE  s    > $** 

) 3)%+'

 

  118B>SV8W~ot4]kmA}a,?@A%4%% f9P9P9[9[_eD 4#33!//)) ' ; ;
 	
r:   F)is_first_iterationr2  c                    |j                  dd       }|j                  dd       }t        |   |i |}|s|j                  dd      s|||d<   |||d<   |S )Nr   r   r  F)poprF   prepare_inputs_for_generationr`   )rS   r2  argsr5   r   r   model_inputsrL   s          r8   r5  zDAudioFlamingo3ForConditionalGeneration.prepare_inputs_for_generation  st    $4d;$jj)>Ew<dMfM\%5%5k5%I)1?-.".6I23r:   )
NNNNNNNNNr   )rM   rt   ru   r%  _tied_weights_keysrG   r  r   r   r/   r   r   rz   r   ry   rw   r   r   r{   r   rs   r5  r|   r}   s   @r8   r'  r'  3  sP    %6#6 \  .23737.204(,26*.!%-.:
##d*:
 ))D0:
 #\\D0	:

 t+:
 &&-:
 :
 ((4/:
   4':
 $;:
 ell*:
 +,:
 
5	5:
  :
x OT t  r:   r'  )r'  r   r   r  )NrZ   )=r   collections.abcr   dataclassesr   r/   r   activationsr   cache_utilsr   r	   
generationr
   masking_utilsr   modeling_flash_attention_utilsr   modeling_layersr   modeling_outputsr   r   r   modeling_utilsr   r   processing_utilsr   utilsr   r   r   r   r   utils.genericr   utils.output_capturingr   autor   configuration_audioflamingo3r   r   
get_loggerrM   rJ   r   rz   rx   r9   r<   r   r   r   r   r   r   r  r'  __all__r   r:   r8   <module>rK     s  ,  $ !   ! 5 ) 6 B 9 ` ` F & j j 7 5  [ 
		H	% !%II%<<% 
% <<	%
 LL4'% T\% %4s)bii s)l5!; 5p 	'O 	' 	' 9(? 9 9 
 9; 9 9( 
r-9 r-
r-j		 . p
7 p
p
f 
W-JO W
Wtr:   