Ë
    zûîjÊ  ã                   ó¨   — d Z ddlZddlZddlZddlZddlZ	 ej                  ej                  j                  «       rdnd«      Zi Zd„ Zd„ Zd„ Zd„ Zy)	aƒ  Shared ensemble members for m1_seed_ensemble.py and st_ensemble.py: the rate-aux Transformer and BMMS3.

Transformer: the four stage-2 seeds of nested_schedule_rate_aux (model_fusion_<outer>_s<i>.pt), trained without the
outer dataset ('ALL' = trained on all five, used for AASD / Carta). Input = the 16 evidence streams of ONE group of
four first-stage seeds in nested_stack_fusion.join order: 4 DirectNet logits, then 3 targets x 4 decoders. The
checkpoints were trained on seeds 0-3; applied to seeds 4-7 they see same-recipe models of other seeds (assumption).
BMMS3: mean of the requested seeds' logits, aligned on the fused frame times.
é    NÚcudaÚcpuc                 óÈ   — | t         vrMt         j                  «        t        d«      D �cg c]  }t        j                  | |t
        «      ‘Œ c}t         | <   t         |    S c c}w )Né   )Ú_CACHEÚclearÚrangeÚRAÚ	model_forÚ_DEV)ÚouterÚis     ú_/root/disk_3tb/EEG-sAAD-Grand-Challenge-Training-Dataset/experiments/decoder_lodo/tb_members.pyÚtransformersr      sL   € Ø”FÑÜ�‰ŒÜ?DÀQ¼xÓH¹x¸!œŸ™ e¨Q´Õ5¸xÑHŒˆu‰Ü�%‰=Ðùò Is   ª"Ac                 óÐ   — t        j                  | dd…t        |«      f   g|D �cg c]  }| dd…||dz   …f   ‘Œ c}z   d¬«      j                  t         j                  «      S c c}w )zeclf_cols: 4 column indices of DirectNet logits; dec_cols: 4 start columns of 3-target decoder blocks.Né   é   ©Úaxis)ÚnpÚconcatenateÚlistÚastypeÚfloat32)ÚxÚclf_colsÚdec_colsÚcs       r   Úx16r      s^   € ä�>‰>˜1šQ¤ X£Ð.Ñ/Ð0É8Ó3TÉ8Àa°A²a¸¸1¸q¹5¸°j³MÈ8Ñ3TÑTÐ[\Ô]×dÑdÔeg×eoÑeoÓpÐpùÒ3Ts   ¦A#
c                 ó¨   — t        j                  t        | «      D ��cg c]!  \  }}t        j                  |||t
        «      ‘Œ# c}}d¬«      S c c}}w )Nr   r   )r   Úmeanr   ÚTÚpredictr   )r   r   ÚmÚscs       r   Út_scorer&       s@   € Ü�7‰7¼<ÈÔ;NÔOÑ;N±%°!°R”A—I‘I˜a  B¬Õ-Ð;NÒOÐVWÔXÐXùÓOs   ž&A
c                 óv  — g }|D ]œ  }t        j                  | |   |«      \  }}t        j                  t        j                  |«      j                  t        «      t        j                  |«      j                  t        «      «      st        d«      ‚|j                  |«       Œž t        j                  |d¬«      S )NzBMMS label mismatchr   r   )
ÚB4Úbvecr   Úarray_equalÚasarrayr   ÚintÚ
ValueErrorÚappendr!   )ÚobjsÚt_endÚyÚidxÚvsr   ÚzÚatts           r   Úbm_meanr6   $   sˆ   € Ø	€BÛˆÜ—‘˜˜a™ %Ó(‰ˆˆ3Ü�~‰~œbŸj™j¨›o×4Ñ4´SÓ9¼2¿:¹:Àa»=×;OÑ;OÔPSÓ;TÔUÜÐ2Ó3Ð3Ø
�	‰	�!�ð	 ô
 �7‰7�2˜AÔÐó    )Ú__doc__Únumpyr   ÚtorchÚantisym_transformer_experimentr"   Úbmms3_enhanced_4seed_mix_scorer(   Úrate_aux_baseline_ensembler
   Údevicer   Úis_availabler   r   r   r   r&   r6   © r7   r   Ú<module>rA      sW   ðñó Û ã *Û +Û 'à€u‡|�|˜eŸj™j×5Ñ5Ô7‘F¸UÓC€Ø	€òòqò
Yór7   