Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PlainDETR #36437

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/transformers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@
"models.depth_anything": ["DepthAnythingConfig"],
"models.depth_pro": ["DepthProConfig"],
"models.detr": ["DetrConfig"],
"models.plaindetr": ["PlaindetrConfig"],
"models.dialogpt": [],
"models.diffllama": ["DiffLlamaConfig"],
"models.dinat": ["DinatConfig"],
Expand Down Expand Up @@ -2212,6 +2213,14 @@
"DetrPreTrainedModel",
]
)
_import_structure["models.plaindetr"].extend(
[
"PlaindetrForObjectDetection",
"PlaindetrForSegmentation",
"PlaindetrModel",
"PlaindetrPreTrainedModel",
]
)
_import_structure["models.diffllama"].extend(
[
"DiffLlamaForCausalLM",
Expand Down Expand Up @@ -5551,6 +5560,7 @@
from .models.depth_anything import DepthAnythingConfig
from .models.depth_pro import DepthProConfig
from .models.detr import DetrConfig
from .models.plaindetr import PlaindetrConfig
from .models.diffllama import DiffLlamaConfig
from .models.dinat import DinatConfig
from .models.dinov2 import Dinov2Config
Expand Down Expand Up @@ -7255,6 +7265,12 @@
DetrModel,
DetrPreTrainedModel,
)
from .models.plaindetr import (
PlaindetrForObjectDetection,
PlaindetrForSegmentation,
PlaindetrModel,
PlaindetrPreTrainedModel,
)
from .models.diffllama import (
DiffLlamaForCausalLM,
DiffLlamaForQuestionAnswering,
Expand Down
1 change: 1 addition & 0 deletions src/transformers/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
depth_anything,
depth_pro,
detr,
plaindetr,
dialogpt,
diffllama,
dinat,
Expand Down
2 changes: 2 additions & 0 deletions src/transformers/models/auto/configuration_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
("depth_pro", "DepthProConfig"),
("deta", "DetaConfig"),
("detr", "DetrConfig"),
("plaindetr", "PlaindetrConfig"),
("diffllama", "DiffLlamaConfig"),
("dinat", "DinatConfig"),
("dinov2", "Dinov2Config"),
Expand Down Expand Up @@ -423,6 +424,7 @@
("depth_pro", "DepthPro"),
("deta", "DETA"),
("detr", "DETR"),
("plaindetr", "plaindetr"),
("dialogpt", "DialoGPT"),
("diffllama", "DiffLlama"),
("dinat", "DiNAT"),
Expand Down
1 change: 1 addition & 0 deletions src/transformers/models/auto/feature_extraction_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
("deformable_detr", "DeformableDetrFeatureExtractor"),
("deit", "DeiTFeatureExtractor"),
("detr", "DetrFeatureExtractor"),
("plaindetr", "PlaindetrFeatureExtractor"),
("dinat", "ViTFeatureExtractor"),
("donut-swin", "DonutFeatureExtractor"),
("dpt", "DPTFeatureExtractor"),
Expand Down
5 changes: 5 additions & 0 deletions src/transformers/models/auto/modeling_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
("depth_pro", "DepthProModel"),
("deta", "DetaModel"),
("detr", "DetrModel"),
("plaindetr", "PlaindetrModel"),
("diffllama", "DiffLlamaModel"),
("dinat", "DinatModel"),
("dinov2", "Dinov2Model"),
Expand Down Expand Up @@ -607,6 +608,7 @@
("depth_pro", "DepthProModel"),
("deta", "DetaModel"),
("detr", "DetrModel"),
("plaindetr", "PlaindetrModel"),
("dinat", "DinatModel"),
("dinov2", "Dinov2Model"),
("dinov2_with_registers", "Dinov2WithRegistersModel"),
Expand Down Expand Up @@ -740,6 +742,7 @@
# Do not add new models here, this class will be deprecated in the future.
# Model for Image Segmentation mapping
("detr", "DetrForSegmentation"),
("plaindetr", "PlaindetrForSegmentation"),
]
)

Expand Down Expand Up @@ -769,6 +772,7 @@
[
# Model for Universal Segmentation mapping
("detr", "DetrForSegmentation"),
("plaindetr", "PlaindetrForSegmentation"),
("mask2former", "Mask2FormerForUniversalSegmentation"),
("maskformer", "MaskFormerForInstanceSegmentation"),
("oneformer", "OneFormerForUniversalSegmentation"),
Expand Down Expand Up @@ -906,6 +910,7 @@
("deformable_detr", "DeformableDetrForObjectDetection"),
("deta", "DetaForObjectDetection"),
("detr", "DetrForObjectDetection"),
("plaindetr", "PlaindetrForObjectDetection"),
("rt_detr", "RTDetrForObjectDetection"),
("rt_detr_v2", "RTDetrV2ForObjectDetection"),
("table-transformer", "TableTransformerForObjectDetection"),
Expand Down
28 changes: 28 additions & 0 deletions src/transformers/models/plaindetr/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2025 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import TYPE_CHECKING

from ...utils import _LazyModule
from ...utils.import_utils import define_import_structure


if TYPE_CHECKING:
from .configuration_plaindetr import *
from .modeling_plaindetr import *
else:
import sys

_file = globals()["__file__"]
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
Loading