[DETA] fix backbone freeze/unfreeze function
Author: SangbumChoi
Pull request: yes

# What does this PR do?

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

Fixes # (issue)


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [X] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [X] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- text models: @ArthurZucker and @younesbelkada
- vision models: @amyeroberts
- speech models: @sanchit-gandhi
- graph models: @clefourrier

Library:

- flax: @sanchit-gandhi
- generate: @gante
- pipelines: @Narsil
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @muellerzr and @pacman100

Integrations:

- deepspeed: HF Trainer/Accelerate: @pacman100
- ray/raytune: @richardliaw, @amogkam
- Big Model Inference: @SunMarc
- quantization (bitsandbytes, autogpt): @SunMarc and @younesbelkada

Documentation: @stevhliu and @MKhalusova

HF projects:

- accelerate: [different repo](https://github.com/huggingface/accelerate)
- datasets: [different repo](https://github.com/huggingface/datasets)
- diffusers: [different repo](https://github.com/huggingface/diffusers)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Maintained examples (not research project or legacy):

- Flax: @sanchit-gandhi
- PyTorch: See Models above and tag the person corresponding to the modality of the example.
- TensorFlow: @Rocketknight1

 -->
Since deta model does not have vision
```
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[4], line 1
----> 1 model.model.freeze_backbone()

File /opt/conda/lib/python3.10/site-packages/transformers/models/deta/modeling_deta.py:1419, in DetaModel.freeze_backbone(self)
   1418 def freeze_backbone(self):
-> 1419     for name, param in self.backbone.conv_encoder.model.named_parameters():
   1420         param.requires_grad_(False)

File /opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py:1695, in Module.__getattr__(self, name)
   1693     if name in modules:
   1694         return modules[name]
-> 1695 raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")

AttributeError: 'DetaBackboneWithPositionalEncodings' object has no attribute 'conv_encoder'
```
test can be done by 
```
from transformers import DetaForObjectDetection

model = DetaForObjectDetection.from_pretrained("jozhang97/deta-swin-large")

model.model.freeze_backbone()
```
@amyeroberts Can you confirm this modification?

Comments:
@ArthurZucker Hi Arthur, can you review this test case modification for DETA? https://github.com/huggingface/transformers/pull/27843/commits/a583fa70fe6010fe7450aa049cc1a65950cb59c7
~~Because I do not fully understand CircleCI when this testing function will be called in transformers~~
Now I think I understand the CI piplines.

For the last CI you need to run `make style` with `ruff==0.1.5`

```
root@9603895c7c37:/mnt/nas2/users/sbchoi/transformers# make style
ruff check examples tests src utils setup.py conftest.py --fix
ruff format examples tests src utils setup.py conftest.py
2706 files left unchanged
make autogenerate_code
make[1]: Entering directory '/mnt/nas2/users/sbchoi/transformers'
running deps_table_update
updating src/transformers/dependency_versions_table.py
make[1]: Leaving directory '/mnt/nas2/users/sbchoi/transformers'
make extra_style_checks
make[1]: Entering directory '/mnt/nas2/users/sbchoi/transformers'
python utils/custom_init_isort.py
python utils/sort_auto_mappings.py
python utils/check_doc_toc.py --fix_and_overwrite
make[1]: Leaving directory '/mnt/nas2/users/sbchoi/transformers'
```
running make style doesn't change anything, and the last CI seems irrelevant to this PR.

```
Would reformat: src/transformers/models/bloom/modeling_bloom.py
Would reformat: src/transformers/models/fuyu/image_processing_fuyu.py
Would reformat: src/transformers/models/mpt/modeling_mpt.py
3 files would be reformatted, 2416 files left unchanged

Exited with code exit status 1
```
did I missed something?
@ArthurZucker 


It's alright just revert the changes and we'll be alright 

@ArthurZucker Done by just syncing the fork of my original repo!

Thanks for the contribution! 🤗