
    ^j              	           d Z ddlZddlZddlmZ ddlmZmZ ddlm	Z	m
Z
 h dZh dZ eej                        ez
  Ze	fded	ed
e
dej                   fdZ eedd      ded	edej                   fd       Zy)a  Package-private helper: build a self-contained namespace from Pydantic configs.

Replaces the previous shim in ``_args.py`` that called the deprecated ``populate_args()`` function from ``main.py``.
This module has zero dependency on ``main.py`` and can survive its deletion.
    N)
deprecated)ModelConfigTrainConfig)MODEL_DEFAULTSModelDefaults>'   ampdeviceencoder	ca_nheads	sa_nheads	two_stage
dec_layers
group_detr
hidden_dim
layer_norm
num_select
patch_size
resolutionia_bce_lossnum_classesnum_queriesnum_windowsbbox_reparamdec_n_pointsnum_channelsbackbone_loradual_projectorfreeze_encoderprojector_scalepretrain_weightssegmentation_headkeypoint_cross_attnout_feature_indexeslite_refpoint_refinemask_downsample_rationum_decoder_registersdual_projector_kp_onlygradient_checkpointinginter_instance_kp_attnnum_keypoints_per_classpostprocess_trace_alphause_grouppose_keypointspositional_encoding_size grouppose_keypoint_dim_downscale>   runseedwandbmlflowresumeclearmldevicesprojectrun_teststrategy	num_nodesr   r   
pin_memoryacceleratorclass_namesr   tensorboardlr_schedulerprogress_barcls_loss_coeflr_min_factordont_save_weightsr!   persistent_workerscompute_train_metricsauto_batch_ema_headroomauto_batch_target_effective auto_batch_max_targets_per_imagemodel_configtrain_configdefaultsreturnc                    | }|}|}t        |dt                     }t        |dt                     }d|v sd|vr|j                  n|j                  }t        j                  di i t        j                  |      |j                  t        t                    |j                  t        t                    t        |dd      t        |dd      t        |dd      ||j                  xs d	|j                  |j                  nd
dS )a  Build a ``types.SimpleNamespace`` from configs and architectural defaults.

    This is the internal implementation behind :func:`build_namespace`. Extracting it allows config-native builder
    functions to construct a namespace without going through the public ``build_namespace()`` API while still accepting
    overridable defaults.

    This function is used by multiple modules as the transitional namespace
    bridge: :func:`rfdetr.models.build_model_from_config`, :func:`rfdetr.models.build_criterion_from_config`, and
    :func:`rfdetr.detr._build_model_context` all call it directly to avoid the public ``build_namespace()`` shim.

    Args:
        model_config: Architecture configuration.
        train_config: Training hyperparameter configuration.
        defaults: Hardcoded architectural constants.  Defaults to :data:`MODEL_DEFAULTS`.

    Returns:
        ``types.SimpleNamespace`` compatible with ``build_model``, ``build_criterion_and_postprocessors``, and
        ``build_dataset``.
    model_fields_setr@   )includemask_ce_loss_coefg      @mask_dice_loss_coefmask_point_sample_ratio    *   )rO   rP   rQ   r@   r3   r0    )getattrsetr@   typesSimpleNamespacedataclassesasdict
model_dump_TC_NAMESPACE_FIELDS_MC_NAMESPACE_FIELDSr3   r0   )	rH   rI   rJ   mctcdtrain_fields_setrM   r@   s	            \/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/rfdetr/_namespace.py_namespace_from_configsrd   s   s   0 
B	BAr#5su=r#5su=
 ../IY2Y 	     
  #
 mmC(<$=m>
 mmC(<$=m>
 ")-@#!F#*2/Dc#J'.r3Lb'Q*iio2!ww2BGG#
     z1.7.0z1.9.0)targetdeprecated_in	remove_inc                      y)u  Build a ``types.SimpleNamespace`` from Pydantic model and train configs.

    .. deprecated:: 1.7.0
        ``build_namespace`` is a backward-compatibility shim with no remaining internal callers.
        Deprecated since v1.7.0, will be removed in v1.9.0. Use the config-native builders instead:

        - :func:`rfdetr.models.build_model_from_config` — replaces
          ``build_model(build_namespace(mc, tc))``
        - :func:`rfdetr.models.build_criterion_from_config` — replaces
          ``build_criterion_and_postprocessors(build_namespace(mc, tc))``
        - :func:`rfdetr._namespace._namespace_from_configs` — for the rare
          case where a raw namespace is still required (e.g. ``build_dataset``)

    Args:
        model_config: Architecture configuration.
        train_config: Training hyperparameter configuration.

    Returns:
        ``types.SimpleNamespace`` compatible with ``build_model``, ``build_criterion_and_postprocessors``, and
        ``build_dataset``.
    NrU   )rH   rI   s     rc   build_namespacerj      s    . re   )__doc__rZ   rX   	deprecater   rfdetr.configr   r   rfdetr.models._defaultsr   r   r^   _TC_NON_NAMESPACE_FIELDSrW   model_fieldsr]   rY   rd   rj   rU   re   rc   <module>rq      s        2 A( d% P ;3347OO  -999 9 	9x *'WU+ [ UMbMb  Vre   