
    fTh                         S SK Jr  S rS rg)    )ceilc                 p   [        [        SU5      5      n[        U R                  5       5       VVs/ s H  o3  H  oDPM     M     nnn/ nU H2  nUR                  U5      S:  d  M  Xv;  d  M!  UR	                  U5        M4     U Vs/ s H  owU;  d  M
  UPM     nnU Vs/ s H  owU;  d  M
  UPM     n	n[        U5      S:w  a  [        S[        U5      -   5      e[        U5      S:w  a  [        S[        U5      -   5      e[        U	5      S:w  a  [        S[        U	5      -   5      eg s  snnf s  snf s  snf )Nr      zDuplicate attention blocks specified in device_map. Attention blocks must be specified to one device. These attention blocks were specified more than once: zThere are attention blocks for this model that are not specified in the device_map. Add these attention blocks to a device on the device_map: zdThe device_map contains more attention blocks than this model has. Remove these from the device_map:)listrangevaluescountappendlen
ValueErrorstr)

device_map
num_blocksblockssublistitemdevice_map_blocksduplicate_blocksimissing_blocksextra_blockss
             _/var/www/auris/envauris/lib/python3.13/site-packages/transformers/utils/model_parallel_utils.pyassert_device_mapr      sO   %:&'F-1*2C2C2E-F[-F'SZ4SZ-F[ ""1%)a.G##A&  "(FA4E+EaNF0D0!VOA0LD
!FHKL\H]^
 	
 >a57:>7JK
 	
 <Ar, 
 	
 + \ GDs   D(	D.D. 	D3-D3c                     [        [        U 5      5      n[        [        U [	        U5      -  5      5      n[        SX5       Vs/ s H	  oBXDU-    PM     nn[        [        X5      5      $ s  snf )zEReturns a dictionary of layers distributed evenly across all devices.r   )r   r   intr   r   dictzip)n_layersdeviceslayersn_blocksr   layers_lists         r   get_device_mapr#   1   sb    %/"F43w</01H5:1h5QR5Q!(l+5QKRG)** Ss   A)N)mathr   r   r#        r   <module>r'      s    
>+r&   