
    9i                     .    S SK Jr  S SKrS SKJr  SS jrg)    )MappingN)ModelOutputBasec                   ^ [        U [        5      (       a-  [        [        U 5      5       H  n[	        X   T5      X'   M     U $ [        U [
        5      (       d  [        U [        5      (       ay  [        U S5      (       a)  U R                  5        H  u  pE[	        UT5      X'   M     U $ [        U 5      " U R                  5        VVs0 s H  u  pEU[	        UT5      _M     snn5      $ [        U [        [        45      (       a  [        U 5      " U4S jU  5       5      $ [        U [        R                  5      (       a  U R                  TUS9$ U $ s  snnf )zPut the data to the target cuda device just before the forward function.
Args:
    batch: The batch data out of the dataloader.
    device: (str | torch.device): The target device for the data.

Returns: The data to the target device.

__setitem__c              3   <   >#    U  H  n[        UT5      v   M     g 7f)N)	to_device).0vdevices     [/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/modelscope/utils/data_utils.py	<genexpr>to_device.<locals>.<genexpr>!   s     ?A9Q//s   )non_blocking)
isinstancer   rangelenr   dictr   hasattritemstypetuplelisttorchTensorto)batchr   r   idxkr
   s    `    r   r   r   	   s    %))U$C"5:v6EJ %	E4	 	 Jug$>$>5-(($Q/ &L;"[[],*TQ Ia((*,- - 
EE4=	)	)E{????	E5<<	(	(xx\x::,s   E
)F)collections.abcr   r   modelscope.outputsr   r        r   <module>r#      s    #  .r"   