Ë
    ëÓ^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Ð#5´s³uÓ=ÐÜ˜rÐ#5´s³uÓ=Ðð
 Ð.Ñ.°/ÐIYÑ2Yð 	×Òà×Ñð ô × Ñ ñ ð
ä× Ñ  Ó#ð
ð �m‰m¤CÔ(<Ó$=ˆmÓ>ð
ð �m‰m¤CÔ(<Ó$=ˆmÓ>ð
ô ")¨Ð-@À#Ó!FÜ#*¨2Ð/DÀcÓ#JÜ'.¨rÐ3LÈbÓ'Qà*Ø—i‘i’o 2Ø!Ÿw™wÐ2�B—G’G¸ò#
ñð ó    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Ó4Ð7OÑOÐ ð -ñ9Øð9àð9ð ð9ð ×Ñó	9ñx Ð*¸'ÈWÔUð +ð ¸[ð ÈU×MbÑMbò ó Vñre   