configuration_eomt.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
  2. # This file was automatically generated from src/transformers/models/eomt/modular_eomt.py.
  3. # Do NOT edit this file manually as any edits will be overwritten by the generation of
  4. # the file from the modular. If any change should be done, please apply the change to the
  5. # modular_eomt.py file directly. One of our CI enforces this.
  6. # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
  7. # Copyright 2025 Mobile Perception Systems Lab at TU/e and The HuggingFace Inc. team. All rights reserved.
  8. #
  9. # Licensed under the Apache License, Version 2.0 (the "License");
  10. # you may not use this file except in compliance with the License.
  11. # You may obtain a copy of the License at
  12. #
  13. # http://www.apache.org/licenses/LICENSE-2.0
  14. #
  15. # Unless required by applicable law or agreed to in writing, software
  16. # distributed under the License is distributed on an "AS IS" BASIS,
  17. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. # See the License for the specific language governing permissions and
  19. # limitations under the License.
  20. from huggingface_hub.dataclasses import strict
  21. from ...configuration_utils import PreTrainedConfig
  22. from ...utils import auto_docstring
  23. @auto_docstring(checkpoint="tue-mps/coco_panoptic_eomt_large_640")
  24. @strict
  25. class EomtConfig(PreTrainedConfig):
  26. r"""
  27. layerscale_value (`float`, *optional*, defaults to 1.0):
  28. Initial value for the LayerScale parameter.
  29. num_upscale_blocks (`int`, *optional*, defaults to 2):
  30. Number of upsampling blocks used in the decoder or segmentation head.
  31. use_swiglu_ffn (`bool`, *optional*, defaults to `False`):
  32. Whether to use the SwiGLU feedforward neural network.
  33. num_blocks (`int`, *optional*, defaults to 4):
  34. Number of feature blocks or stages in the architecture.
  35. no_object_weight (`float`, *optional*, defaults to 0.1):
  36. Loss weight for the 'no object' class in panoptic/instance segmentation.
  37. class_weight (`float`, *optional*, defaults to 2.0):
  38. Loss weight for classification targets.
  39. mask_weight (`float`, *optional*, defaults to 5.0):
  40. Loss weight for mask prediction.
  41. train_num_points (`int`, *optional*, defaults to 12544):
  42. Number of points to sample for mask loss computation during training.
  43. oversample_ratio (`float`, *optional*, defaults to 3.0):
  44. Oversampling ratio used in point sampling for mask training.
  45. importance_sample_ratio (`float`, *optional*, defaults to 0.75):
  46. Ratio of points to sample based on importance during training.
  47. num_queries (`int`, *optional*, defaults to 200):
  48. Number of object queries in the Transformer.
  49. num_register_tokens (`int`, *optional*, defaults to 4):
  50. Number of learnable register tokens added to the transformer input.
  51. Example:
  52. ```python
  53. >>> from transformers import EomtConfig, EomtForUniversalSegmentation
  54. >>> # Initialize configuration
  55. >>> config = EomtConfig()
  56. >>> # Initialize model
  57. >>> model = EomtForUniversalSegmentation(config)
  58. >>> # Access config
  59. >>> config = model.config
  60. ```"""
  61. model_type = "eomt"
  62. hidden_size: int = 1024
  63. num_hidden_layers: int = 24
  64. num_attention_heads: int = 16
  65. hidden_act: str = "gelu"
  66. hidden_dropout_prob: float | int = 0.0
  67. initializer_range: float = 0.02
  68. layer_norm_eps: float = 1e-6
  69. image_size: int | list[int] | tuple[int, int] = 640
  70. patch_size: int | list[int] | tuple[int, int] = 16
  71. num_channels: int = 3
  72. mlp_ratio: int = 4
  73. layerscale_value: float = 1.0
  74. drop_path_rate: float | int = 0.0
  75. num_upscale_blocks: int = 2
  76. attention_dropout: float | int = 0.0
  77. use_swiglu_ffn: bool = False
  78. num_blocks: int = 4
  79. no_object_weight: float = 0.1
  80. class_weight: float = 2.0
  81. mask_weight: float = 5.0
  82. dice_weight: float = 5.0
  83. train_num_points: int = 12544
  84. oversample_ratio: float = 3.0
  85. importance_sample_ratio: float = 0.75
  86. num_queries: int = 200
  87. num_register_tokens: int = 4
  88. __all__ = ["EomtConfig"]