
    j:b                    ~    d dl mZ d dlZd dlmZmZmZmZmZm	Z	 d dl
mZ d dlmZmZ  G d de          Zd Zd ZdS )	    )annotationsN)AnyCallableListOptionalTupleUnion)tree_flattentree_unflattenc                      e Zd ZU dZded<   d Zed             Zed             ZdHd	Z	d
 Z
dI fdZdJ fdZ fdZ	 dKdLdZdMdZed             Zed             Zed             Zed             Z	 	 dNdOd$Zd% Zd& Zd' Zd( ZdKdPd+Z	 dQdRd-ZdKdSd/ZdTd2Zd3 Zd4 Zd5 Z ddd6d7dUd;Z!ddd6d7dUd<Z"dVd?Z#dKdWd@Z$dXdAZ%dB fdYdGZ& xZ'S )ZModulea  Base class for building neural networks with MLX.

    All the layers provided in :mod:`mlx.nn.layers` subclass this class and
    your models should do the same.

    A ``Module`` can contain other ``Module`` instances or :class:`mlx.core.array`
    instances in arbitrary nesting of python lists or dicts. The ``Module``
    then allows recursively extracting all the :class:`mlx.core.array` instances
    using :meth:`mlx.nn.Module.parameters`.

    In addition, the ``Module`` has the concept of trainable and non trainable
    parameters (called "frozen"). When using :func:`mlx.nn.value_and_grad`
    the gradients are returned only with respect to the trainable parameters.
    All arrays in a module are trainable unless they are added in the "frozen"
    set by calling :meth:`freeze`.

    .. code-block:: python

        import mlx.core as mx
        import mlx.nn as nn

        class MyMLP(nn.Module):
            def __init__(self, in_dims: int, out_dims: int, hidden_dims: int = 16):
                super().__init__()

                self.in_proj = nn.Linear(in_dims, hidden_dims)
                self.out_proj = nn.Linear(hidden_dims, out_dims)

            def __call__(self, x):
                x = self.in_proj(x)
                x = mx.maximum(x, 0)
                return self.out_proj(x)

        model = MyMLP(2, 1)

        # All the model parameters are created but since MLX is lazy by
        # default, they are not evaluated yet. Calling `mx.eval` actually
        # allocates memory and initializes the parameters.
        mx.eval(model.parameters())

        # Setting a parameter to a new value is as simply as accessing that
        # parameter and assigning a new array to it.
        model.in_proj.weight = model.in_proj.weight * 2
        mx.eval(model.parameters())
    r   __call__c                :    t                      | _        d| _        dS )z1Should be called by the subclasses of ``Module``.TN)set_no_grad	_trainingselfs    \/lsinfo/ai/hellotax_ai/base_platform/venv/lib/python3.11/site-packages/mlx/nn/layers/base.py__init__zModule.__init__=   s        c                    | j         S )z4Boolean indicating if the model is in training mode.r   r   s    r   trainingzModule.trainingB   s     ~r   c                    | S )ak  The module's state dictionary

        The module's state dictionary contains any attribute set on the
        module including parameters in :meth:`Module.parameters`

        Unlike :meth:`Module.parameters`, the :attr:`Module.state` property is
        a reference to the module's state. Updates to it will be reflected in
        the original module.
         r   s    r   statezModule.stateG   s	     r   returnstrc                    dS )N r   r   s    r   _extra_reprzModule._extra_reprT   s    rr   c           
     6   t          |                                 | j                  }t          |           j         d|                                  }|D ]6\  }}|dz  }|t          j        d| dt          |           d          z  }7|r|dz  }|dz  }|S )N)is_leaf(
z): z  )prefix))	r
   children	is_moduletype__name__r"   textwrapindentrepr)r   r)   valuekvs        r   __repr__zModule.__repr__W   s    HHH::&==)9)9););== 	G 	GDAqTMEX_%8%8%8tAww%8%8FFFFEE 	TMEr   keyc                    |                      |d           x}|S t          t          |                               |           d S N)getsuperr   __getattribute__)r   r4   r0   	__class__s      r   __getattr__zModule.__getattr__c   sE    XXc4(((E5L&$0055555r   valr   c                6   t          |t          j        t          t          t
          f          r+t          | |          r|| vrt          | |           || |<   d S t          t          |           
                    ||           |                     |d            d S r6   )
isinstancemxarraydictlisttuplehasattrdelattrr8   r   __setattr__pop)r   r4   r<   r:   s      r   rF   zModule.__setattr__i   s    cBHdD%899 		  tS!! #cooc"""DIII&$++C555HHS$r   c                    |                      |d           x}| |= d S t                                          |           d S r6   )r7   r8   __delattr__)r   namer<   r:   s      r   rI   zModule.__delattr__u   sE    88D$'''C4T


GG%%%%%r   Tfile_or_weights&Union[str, List[Tuple[str, mx.array]]]strictboolc           	     Z   |}t          |t                    r3t          t          j        |                                                    }|rt          |          }t          |                                 i           }|	                                |	                                z
  x}rGt          |          }d                    t          |                    }t          d| d| d          |	                                |	                                z
  x}rGt          |          }	d                    t          |                    }t          d|	 d| d          |                                D ]{\  }
}||
         }t          |t          j                  s"t          dt          |           d	|
           |j        |j        k    r"t          d
|j         d|j         d	|
           |t          |          dk    r$|                     t%          |          d           | S )ay  
        Update the model's weights from a ``.npz``, a ``.safetensors`` file, or a list.

        Args:
            file_or_weights (str or list(tuple(str, mx.array))): The path to
                the weights ``.npz`` file (``.npz`` or ``.safetensors``) or a list
                of pairs of parameter names and arrays.
            strict (bool, optional): If ``True`` then checks that the provided
              weights exactly match the parameters of the model. Otherwise,
              only the weights actually contained in the model are loaded and
              shapes are not checked. Default: ``True``.

        Returns:
            The module instance after updating the weights.

        Example:

            .. code-block:: python

                import mlx.core as mx
                import mlx.nn as nn
                model = nn.Linear(10, 10)

                # Load from file
                model.load_weights("weights.npz")

                # Load from .safetensors file
                model.load_weights("weights.safetensors")

                # Load from list
                weights = [
                    ("weight", mx.random.uniform(shape=(10, 10))),
                    ("bias",  mx.zeros((10,))),
                ]
                model.load_weights(weights)

                # Missing weight
                weights = [
                    ("weight", mx.random.uniform(shape=(10, 10))),
                ]

                # Raises a ValueError exception
                model.load_weights(weights)

                # Ok, only updates the weight but not the bias
                model.load_weights(weights, strict=False)
        destinationz,
z	Received z parameters not in model: 
.zMissing z parameters: 
zExpected mx.array but received z for parameter zExpected shape z but received shape r   F)rM   )r>   r   rB   r?   loaditemsrA   r
   
parameterskeyslenjoinsorted
ValueErrorr@   r+   shapeupdater   )r   rK   rM   weightsnew_weightscurr_weightsextras	num_extramissingnum_missingr1   r2   v_news                r   load_weightszModule.load_weights{   sZ   h "gs## 	5277++113344G 	w--K'(9(9rJJJL%**,,|/@/@/B/BBCv KK	F6NN33 P	PPvPPP   (,,..1A1A1C1CCDw T!'ll**VG__55 !RK!R!R!R!R!RSSS$**,,  1#A!%22 $;;;; ;78; ;   ;!'))$A!' A A!&A A=>A A   * w<<1KKw//K>>>r   filec                   t          |                                 i           }|                    d          rt          j        |fi | dS |                    d          rt          j        ||           dS t          d| d          )z
        Save the model's weights to a file. The saving method is determined by the file extension:
        - ``.npz`` will use :func:`mx.savez`
        - ``.safetensors`` will use :func:`mx.save_safetensors`
        rP   z.npzz.safetensorszUnsupported file extension for z. Use '.npz' or '.safetensors'.N)r
   rU   endswithr?   savezsave_safetensorsrZ   )r   rf   params_dicts      r   save_weightszModule.save_weights   s     #4??#4#4"EEE==   	HT))[)))))]]>** 	k22222W$WWW  r   c                ,    t          | t                    S r6   r>   r   )r0   s    r   r*   zModule.is_module   s    %(((r   c                :    t          |t          t          f          S r6   )r>   rA   rB   moduler4   r0   s      r   valid_child_filterzModule.valid_child_filter   s    %$...r   c                |    t          |t          t          t          j        f          o|                    d           S )N_)r>   rA   rB   r?   r@   
startswithrp   s      r   valid_parameter_filterzModule.valid_parameter_filter   s0    %$bh!788TPSATAT=TTr   c                L    t                               | ||          o|| j        vS r6   )r   rv   r   rp   s      r   trainable_parameter_filterz!Module.trainable_parameter_filter   s-     ))&#u== +6?*	
r   N	filter_fn"Callable[[Module, str, Any], bool]map_fnOptional[Callable]
is_leaf_fn,Optional[Callable[[Module, str, Any], bool]]c                d     pd pd  fd                                  D             S )at  Recursively filter the contents of the module using ``filter_fn``,
        namely only select keys and values where ``filter_fn`` returns true.

        This is used to implement :meth:`parameters` and :meth:`trainable_parameters`
        but it can also be used to extract any subset of the module's parameters.

        Args:
            filter_fn (Callable): Given a value, the key in which it is found
                and the containing module, decide whether to keep the value or
                drop it.
            map_fn (Callable, optional): Optionally transform the value before
                returning it.
            is_leaf_fn (Callable, optional): Given a value, the key in which it
                is found and the containing module decide if it is a leaf.

        Returns:
            A dictionary containing the contents of the module recursively filtered
        c                    | S r6   r   xs    r   <lambda>z'Module.filter_and_map.<locals>.<lambda>  s    a r   c                H    t          |t          t          t          f           S r6   )r>   r   rA   rB   mr1   r2   s      r   r   z'Module.filter_and_map.<locals>.<lambda>  s    
1vtT.B C CC r   c                Z    i | ]'\  }} ||          |t          ||          (S r   _unwrap).0r1   r2   ry   r}   r{   r   s      r   
<dictcomp>z)Module.filter_and_map.<locals>.<dictcomp>  sU     
 
 
1yq!$$
wtQ9fjAA
 
 
r   )rT   )r   ry   r{   r}   s   ````r   filter_and_mapzModule.filter_and_map   si    2 (KK 
CC 	
 
 
 
 
 
 



 
 
 	
r   c                6    |                      | j                  S )zoRecursively return all the :class:`mlx.core.array` members of this Module
        as a dict of dicts and lists.)r   rv   r   s    r   rU   zModule.parameters  s     ""4#>???r   c                6    |                      | j                  S )zzRecursively return all the non frozen :class:`mlx.core.array` members of
        this Module as a dict of dicts and lists.)r   rx   r   s    r   trainable_parameterszModule.trainable_parameters  s     ""4#BCCCr   c                <    |                      | j        d           S )z6Return the direct descendants of this Module instance.c                ,    t          |t                    S r6   rn   r   s      r   r   z!Module.children.<locals>.<lambda>%  s    
1f@U@U r   r}   r   rr   r   s    r   r)   zModule.children"  s+    ""#0U0U # 
 
 	
r   c                @    d }|                      | j        |          S )z8Return the submodules that do not contain other modules.c                    t          |t                    o1t          t          |                                                    dk    S )Nr   )r>   r   rW   r
   r)   r   s      r   _is_leaf_modulez,Module.leaf_modules.<locals>._is_leaf_module+  s5    a((QSajjll1K1K-L-LPQ-QQr   r   r   )r   r   s     r   leaf_moduleszModule.leaf_modules(  s2    	R 	R 	R ""4#:"WWWr   rU   rA   c                .    fd | |           | S )aL  Replace the parameters of this Module with the provided ones in the
        dict of dicts and lists.

        Commonly used by the optimizer to change the model to the updated
        (optimized) parameters. Also used by the :meth:`mlx.nn.value_and_grad` to set the
        tracers in the model in order to compute gradients.

        The passed in parameters dictionary need not be a full dictionary
        similar to :meth:`parameters`. Only the provided locations will be
        updated.

        Args:
            parameters (dict): A complete or partial dictionary of the modules
                parameters.
            strict (bool): If ``True`` checks that ``parameters`` is a
                subset of the module's parameters. Default: ``True``.
        Returns:
            The module instance after updating the parameters.
        c           	        t          |t                    r|D ]}|| v r~| |         }||         }t          |t          j                  rGr?t          |t          j                  s%t	          dt          |          j         d          || |<   w ||           rt	          d| d          d S t          |t                    rt          t          |                    D ]}|t          |           k    r&r#t	          d| dt          |            d          ;| |         }||         }t          |t          j                  rGr?t          |t          j                  s%t	          dt          |          j         d          || |<    ||           d S r%t	          dt          |          j         d          d S )NReceived invalid type: rR   z&Module does not have parameter named "".zList index z, is out of bounds for destination of length )
r>   rA   r?   r@   rZ   r+   r,   rB   rangerW   )dstrU   r1   current_value	new_valueiapplyrM   s         r   r   zModule.update.<locals>.applyE  sS   *d++ #Y# Y YACxx(+A$.qM	%mRX>> <% "jBH.M.M "&0$Yd9oo>V$Y$Y$Y'" '" !" &/CFF!E-;;;; Y()WRS)W)W)WXXXYY Y J-- Ys:// 8 8ACHH}}! ",!Ea !E !E9<S!E !E !E# #  !$'FM *1I!-:: 8! *Y*I*I ", U$y//:R U U U# #  "+AmY7777#8 8$  Y !W4
;K;K;T!W!W!WXXXY Yr   r   )r   rU   rM   r   s     `@r   r\   zModule.update0  sB    *$	Y $	Y $	Y $	Y $	Y $	YL 	dJr   Callable[[mx.array], mx.array]c                t    |pt           j        }|                     |                     ||                     | S )a1  Map all the parameters using the provided ``map_fn`` and immediately
        update the module with the mapped parameters.

        For instance running ``model.apply(lambda x: x.astype(mx.float16))``
        casts all parameters to 16 bit floats.

        Args:
            map_fn (Callable): Maps an array to another array
            filter_fn (Callable, optional): Filter to select which arrays to
                map (default: :meth:`Module.valid_parameter_filter`).

        Returns:
            The module instance after updating the parameters.
        )r   rv   r\   r   )r   r{   ry   s      r   r   zModule.applyn  s8    & >!>	D''	6::;;;r   modulesc                (    t          | ||           | S )aJ  Replace the child modules of this :class:`Module` instance with the
        provided ones in the dict of dicts and lists.

        It is the equivalent of :meth:`Module.update` but for modules instead
        of parameters and allows us to flexibly edit complex architectures by
        programmatically swapping layers.

        The passed in parameters dictionary need not be a full dictionary
        similar to :meth:`modules`. Only the provided locations will be
        updated.

        Args:
            modules (dict): A complete or partial dictionary of the module's
                submodules.
            strict (bool): If ``True`` checks that ``modules`` is a
                subset of the child modules of this instance. Default: ``True``.
        Returns:
            The module instance after updating the submodules.
        )_update_modules)r   r   rM   s      r   update_moduleszModule.update_modules  s    ( 	gv...r   apply_fnCallable[[str, Module], Any]c                    d| fg}|rj|                                 \  }} |||           |rd|z   nd}|                    t          |                                || j                             |j| S )a  Apply a function to all the modules in this instance (including this
        instance).

        Args:
            apply_fn (Callable): The function to apply to the modules which
                takes two parameters. The first parameter is the string path of
                the module (e.g. ``"model.layers.0.linear"``). The second
                parameter is the module object.

        Returns:
            The module instance after updating submodules.
        r!   rR   )r'   r$   )rG   extendr
   r)   r*   )r   r   module_stackr'   mods        r   apply_to_moduleszModule.apply_to_modules  s     T
| 	&**,,KFCHVS!!!%+3S6\\FS\\^^FDNSSS  	  	 r   c                <    g |                      fd           S )zReturn a list with all the modules in this instance.

        Returns:
            A list of :class:`mlx.nn.Module` instances.
        c                .                         |          S r6   appendr1   r   
modulelists     r   r   z Module.modules.<locals>.<lambda>  s    :+<+<Q+?+? r   r   r   r   s    @r   r   zModule.modules  s.     
????@@@r   c                <    g |                      fd           S )zReturn a list with all the modules in this instance and their name
        with dot notation.

        Returns:
            A list of tuples (str, :class:`mlx.nn.Module`).
        c                2                         | |f          S r6   r   r   s     r   r   z&Module.named_modules.<locals>.<lambda>  s    :+<+<aV+D+D r   r   r   s    @r   named_moduleszModule.named_modules  s.     
DDDDEEEr   c                v    t          |t                    r|n|g}|r|D ]}|| vrt          d| d          |S )NzModule doesn't contain member rR   )r>   rB   KeyError)r   rV   rM   r1   s       r   _validate_keyszModule._validate_keys  sc    !$--9ttD6 	J J JD=="#HA#H#H#HIII !r   F)recurserV   rM   r   rV   Optional[Union[str, List[str]]]c               ^    fd}|r|                      |           n |d|            | S )at  Freeze the Module's parameters or some of them. Freezing a parameter means not
        computing gradients for it.

        This function is idempotent i.e. freezing a frozen model is a no-op.

        Example:
            For instance to only train the attention parameters from a Transformer:

            .. code-block:: python

                model = nn.Transformer()
                model.freeze()
                model.apply_to_modules(lambda k, v: v.unfreeze() if k.endswith("attention") else None)

        Args:
            recurse (bool, optional): If True then freeze the parameters of the
                submodules as well. Default: ``True``.
            keys (str or list[str], optional): If provided then only these
                parameters will be frozen otherwise all the parameters of a
                module. For instance freeze all biases by calling
                ``module.freeze(keys="bias")``.
            strict (bool, optional): If set to ``True`` validate that the passed keys exist.
                Default: ``False``.

        Returns:
            The module instance after freezing the parameters.
        c                    }|/t          |                    d                     }d |D             }|                    |          }|j                            |           d S )Nc                \    t          |t                     o|                     | ||          S r6   )r>   r   rv   r   s      r   r   z5Module.freeze.<locals>._freeze_impl.<locals>.<lambda>  s0    Z6-B-B)B )>44Q1== r   c                    g | ]\  }}|S r   r   )r   r1   r2   s      r   
<listcomp>z7Module.freeze.<locals>._freeze_impl.<locals>.<listcomp>  s    999FQa999r   )r
   r   r   r   r\   rt   r   
local_keysrV   rM   s      r   _freeze_implz#Module.freeze.<locals>._freeze_impl  s    J!)$$> >  
 :9j999
))*f==JJj)))))r   r!   r   )r   r   rV   rM   r   s     `` r   freezezModule.freeze  s[    F	* 	* 	* 	* 	* 	*  	#!!,////LT"""r   c               ^    fd}|r|                      |           n |d|            | S )a  Unfreeze the Module's parameters or some of them.

        This function is idempotent ie unfreezing a model that is not frozen is
        a noop.

        Example:

            For instance to only train the biases of a Transformer one can do:

            .. code-block:: python

                model = nn.Transformer()
                model.freeze()
                model.unfreeze(keys="bias")

        Args:
            recurse (bool, optional): If True then unfreeze the parameters of the
                submodules as well. Default: ``True``.
            keys (str or list[str], optional): If provided then only these
                parameters will be unfrozen otherwise all the parameters of a
                module. For instance unfreeze all biases by calling
                ``module.unfreeze(keys="bias")``.
            strict (bool, optional): If set to ``True`` validate that the passed keys exist.
                Default: ``False``.

        Returns:
            The module instance after unfreezing the parameters.
        c                    |j                                          d S |                              }|j                             |           d S r6   )r   clearr   difference_updater   s      r   _unfreeze_implz'Module.unfreeze.<locals>._unfreeze_impl+  sU    |
  """"" --dF;;

,,Z88888r   r!   r   )r   r   rV   rM   r   s     `` r   unfreezezModule.unfreeze  s[    H	9 	9 	9 	9 	9 	9  	%!!.1111N2t$$$r   modeNonec                    || _         d S r6   r   r   r   s     r   _set_training_modezModule._set_training_mode9  s    r   c                8    |                      fd           | S )a  Set the model in or out of training mode.

        Training mode only applies to certain layers. For example
        :obj:`Dropout` applies a random mask in training mode, but is the
        identity in evaluation mode.

        Args:
            mode (bool): Indicate if the model should be in training or
                evaluation mode. Default: ``True``.
        Returns:
            The module instance after updating the training mode.
        c                .    |                               S r6   )r   )rt   r   r   s     r   r   zModule.train.<locals>.<lambda>J  s    1+?+?+E+E r   r   r   s    `r   trainzModule.train<  s(     	EEEEFFFr   c                ,    |                      d          S )zFSet the model to evaluation mode.

        See :func:`train`.
        F)r   r   s    r   evalzModule.evalN  s    
 zz%   r   c                @    t          j        | t           j                  S r6   )r?   
issubdtypefloatingr   s    r   r   zModule.<lambda>X  s    BMr{E
 E
 r   dtypemx.Dtype	predicate$Optional[Callable[[mx.Dtype], bool]]c                F    d |                      fd           dS )am  Set the dtype of the module's parameters.

        Args:
            dtype (Dtype): The new dtype.
            predicate (typing.Callable, optional): A predicate to select
              parameters to cast. By default, only parameters of type
              :attr:`floating` will be updated to avoid casting integer
              parameters to the new dtype.
        Nc                    dS )NTr   )rt   s    r   r   z"Module.set_dtype.<locals>.<lambda>f  s    $ r   c                R     | j                   r|                               n| S r6   )r   astype)r   r   r   s    r   r   z"Module.set_dtype.<locals>.<lambda>h  s&    		!'0B0BIQXXe___ r   )r   )r   r   r   s    ``r   	set_dtypezModule.set_dtypeU  s8      &I

IIIIIJJJJJr   )r   r   )r4   r   )r4   r   r<   r   )T)rK   rL   rM   rN   r   r   )rf   r   )NN)ry   rz   r{   r|   r}   r~   )rU   rA   rM   rN   r   r   r6   )r{   r   ry   r~   r   r   )r   rA   rM   rN   r   r   )r   r   r   r   )r   rN   rV   r   rM   rN   r   r   )r   rN   r   r   )r   rN   r   r   )r   r   )r   r   r   r   )(r,   
__module____qualname____doc____annotations__r   propertyr   r   r"   r3   r;   rF   rI   re   rl   staticmethodr*   rr   rv   rx   r   rU   r   r)   r   r\   r   r   r   r   r   r   r   r   r   r   r   r   __classcell__)r:   s   @r   r   r      sZ        , ,\   
   X 
 
 X
   
 
 
6 6 6 6 6 6
  
  
  
  
  
 & & & & & T T T T Tl   " ) ) \) / / \/ U U \U 
 
 \
 &*CG	!
 !
 !
 !
 !
F@ @ @
D D D

 
 
X X X< < < < <B CG    .    .   .  	 	 	   045 5 5 5 5 5t 040 0 0 0 0 0d       $! ! ! !;
 ;
K K K K K K K K Kr   r   c                   t          |t                    r|D ]}|| v r| |         }||         }t                              |          r t                              |          r|| |<   Pt          |t          t          f          rt          |||           ~|r+|i k    r%t          dt          |          j         d          |rt          d| d          d S t          |t                    rt          t          |                    D ]}| |         }||         }t                              |          r t                              |          r|| |<   Lt          |t          t          f          rt          |||           z|r+|i k    r%t          dt          |          j         d          d S |r%t          dt          |          j         d          d S )Nr   rR   z'Module does not have sub-module named "r   )r>   rA   r   r*   rB   r   rZ   r+   r,   r   rW   )r   r   rM   r1   r   r   r   s          r   r   r   k  s8   '4   N 	R 	RACxx #A#AJ	##M22 v7G7G	7R7R &CFFd|<< #M9fEEEE 	R$M$y//2JMMM    R !P1!P!P!PQQQR	R 	R 
GT	"	" Ns7||$$ 	X 	XAFM
I.. X63C3CI3N3N X"AMD$<88 Xy&AAAA XIOO !V4	??;S!V!V!VWWW	X 	X 
 NL4==3ILLLMMMN Nr   c                ^    | |          r           S t          t                    r#fd                                D             S t          t                    rKi }                                D ]2\  }}| d| }	 | |	|          rt	          | |	|          ni ||<   3|S t          t
                    rVg }
t                    D ]B\  }}| d| }	|
                     | |	|          rt	          | |	|          ni            C|
S t          d          )Nc                Z    i | ]'\  }} ||          |t          ||          (S r   r   )r   r1   r2   ry   r}   r{   r0   s      r   r   z_unwrap.<locals>.<dictcomp>  sU     
 
 
1y1%%
wuaIvzBB
 
 
r   rR   z1Unexpected leaf found while traversing the module)	r>   r   rT   rA   r   rB   	enumerater   RuntimeError)model	value_keyr0   ry   r{   r}   ndr1   r2   tknlr   vis     ````       r   r   r     s   z%E** ve}}	E6	"	" 
 
 
 
 
 
 

 
 
 	
 
E4	 	  KKMM 	 	DAq####B 9UB**r1iDDD qEE
 		E4	 	  	u%% 	 	EAr####BII9UB++r2y&*EEE   
 	
J
K
KKr   )
__future__r   r-   typingr   r   r   r   r   r	   mlx.corecorer?   	mlx.utilsr
   r   rA   r   r   r   r   r   r   <module>r      s    # " " " " "  > > > > > > > > > > > > > > > >       2 2 2 2 2 2 2 2\	K \	K \	K \	K \	KT \	K \	K \	K~N N N<!L !L !L !L !Lr   