Skip to content

fix detr device map#27089

Merged
SunMarc merged 2 commits into
huggingface:mainfrom
SunMarc:fix-detr-device_map
Oct 27, 2023
Merged

fix detr device map#27089
SunMarc merged 2 commits into
huggingface:mainfrom
SunMarc:fix-detr-device_map

Conversation

@SunMarc

@SunMarc SunMarc commented Oct 26, 2023

Copy link
Copy Markdown
Member

What does this PR do ?

This PR solves an issue that #26849 introduced. For DeformableDetrForObjectDetection and DetaForObjectDetection, we can't initialize the model on meta device as we modify the weights during the initialization.

@HuggingFaceDocBuilderDev

HuggingFaceDocBuilderDev commented Oct 26, 2023

Copy link
Copy Markdown

The documentation is not available anymore as the PR was closed or merged.

@ArthurZucker ArthurZucker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good for me but let's comment as to why we do this in the code. It's one of the only model that needs this no?

@SunMarc

SunMarc commented Oct 27, 2023

Copy link
Copy Markdown
Member Author

Yes, not every ForObjectDetection models needs this. For example, the TableTransformerForObjectDetection don't modify the weights at initialization. I will add a comment.

@SunMarc
SunMarc requested a review from ArthurZucker October 27, 2023 13:37
@SunMarc
SunMarc merged commit 29c74f5 into huggingface:main Oct 27, 2023
EduardoPach pushed a commit to EduardoPach/transformers that referenced this pull request Nov 19, 2023
* fix detr device map

* add comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants