diff --git a/docs/source/en/index.md b/docs/source/en/index.md index 069ca33c62bc49..742d76b3ee2b0d 100644 --- a/docs/source/en/index.md +++ b/docs/source/en/index.md @@ -298,7 +298,8 @@ Flax), PyTorch, and/or TensorFlow. | [RoFormer](model_doc/roformer) | ✅ | ✅ | ✅ | | [RT-DETR](model_doc/rt_detr) | ✅ | ❌ | ❌ | | [RT-DETR-ResNet](model_doc/rt_detr_resnet) | ✅ | ❌ | ❌ | -| [RtDetrV2](model_doc/rt_detr_v2) | ✅ | ❌ | ❌ | +| [RT-DETR-V2-ResNet](model_doc/rt_detr_v2) | ✅ | ❌ | ❌ | +| [RtDetrV2ResNetConfig](model_doc/rt_detr_v2_resnet) | ❌ | ❌ | ❌ | | [RWKV](model_doc/rwkv) | ✅ | ❌ | ❌ | | [SAM](model_doc/sam) | ✅ | ✅ | ❌ | | [SeamlessM4T](model_doc/seamless_m4t) | ✅ | ❌ | ❌ | diff --git a/src/transformers/models/rt_detr_v2/__init__.py b/src/transformers/models/rt_detr_v2/__init__.py index 18d51ec296cea3..e86035fb31ddf6 100644 --- a/src/transformers/models/rt_detr_v2/__init__.py +++ b/src/transformers/models/rt_detr_v2/__init__.py @@ -17,5 +17,13 @@ from ...utils import _LazyModule from ...utils.import_utils import define_import_structure -from .configuration_rt_detr_v2 import * -from .modeling_rt_detr_v2 import * + + +if TYPE_CHECKING: + from .configuration_rt_detr_v2 import * + from .modeling_rt_detr_v2 import * +else: + import sys + + _file = globals()["__file__"] + sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__) diff --git a/src/transformers/models/rt_detr_v2/configuration_rt_detr_v2.py b/src/transformers/models/rt_detr_v2/configuration_rt_detr_v2.py index 1d7e71ae2f2971..4198160dab02a7 100644 --- a/src/transformers/models/rt_detr_v2/configuration_rt_detr_v2.py +++ b/src/transformers/models/rt_detr_v2/configuration_rt_detr_v2.py @@ -241,6 +241,8 @@ class RtDetrV2Config(PretrainedConfig): Relative weight of the generalized IoU loss in the object detection loss. eos_coefficient (`float`, *optional*, defaults to 0.0001): Relative classification weight of the 'no-object' class in the object detection loss. + decoder_n_levels (``, *optional*, defaults to 3): + decoder_offset_scale (``, *optional*, defaults to 0.5): Examples: @@ -448,3 +450,6 @@ def from_backbone_configs(cls, backbone_config: PretrainedConfig, **kwargs): backbone_config=backbone_config, **kwargs, ) + + +__all__ = ["RtDetrV2ResNetConfig", "RtDetrV2Config"] diff --git a/src/transformers/models/rt_detr_v2/modeling_rt_detr_v2.py b/src/transformers/models/rt_detr_v2/modeling_rt_detr_v2.py index d6604e6c2eaeec..e3afe700704d4c 100644 --- a/src/transformers/models/rt_detr_v2/modeling_rt_detr_v2.py +++ b/src/transformers/models/rt_detr_v2/modeling_rt_detr_v2.py @@ -2175,3 +2175,6 @@ def forward( enc_outputs_coord_logits=outputs.enc_outputs_coord_logits, denoising_meta_values=outputs.denoising_meta_values, ) + + +__all__ = ["RtDetrV2Model", "RtDetrV2PreTrainedModel", "RtDetrV2ForObjectDetection"] diff --git a/src/transformers/models/rt_detr_v2/modular_rt_detr_v2.py b/src/transformers/models/rt_detr_v2/modular_rt_detr_v2.py index a7dbabbf0e684c..e3f734a1c47f88 100644 --- a/src/transformers/models/rt_detr_v2/modular_rt_detr_v2.py +++ b/src/transformers/models/rt_detr_v2/modular_rt_detr_v2.py @@ -310,3 +310,12 @@ def __init__(self, config: RtDetrV2Config): # fix bug self.model.decoder.class_embed = self.class_embed self.model.decoder.bbox_embed = self.bbox_embed + + +__all__ = [ + "RtDetrV2ResNetConfig", + "RtDetrV2Config", + "RtDetrV2Model", + "RtDetrV2PreTrainedModel", + "RtDetrV2ForObjectDetection", +]