Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
e7d52a10
Unverified
Commit
e7d52a10
authored
Apr 26, 2024
by
amyeroberts
Committed by
GitHub
Apr 26, 2024
Browse files
Fix GroundingDINO, DPR after BERT SDPA update (#30506)
Fix GroundingDINO, DPR after BET SDPA update
parent
38b53da3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
1 deletion
+6
-1
docs/source/en/perf_infer_gpu_one.md
docs/source/en/perf_infer_gpu_one.md
+1
-0
src/transformers/models/dpr/modeling_dpr.py
src/transformers/models/dpr/modeling_dpr.py
+2
-0
src/transformers/models/grounding_dino/modeling_grounding_dino.py
...sformers/models/grounding_dino/modeling_grounding_dino.py
+3
-1
No files found.
docs/source/en/perf_infer_gpu_one.md
View file @
e7d52a10
...
@@ -194,6 +194,7 @@ For now, Transformers supports SDPA inference and training for the following arc
...
@@ -194,6 +194,7 @@ For now, Transformers supports SDPA inference and training for the following arc
*
[
Bert
](
https://huggingface.co/docs/transformers/model_doc/bert#transformers.BertModel
)
*
[
Bert
](
https://huggingface.co/docs/transformers/model_doc/bert#transformers.BertModel
)
*
[
Cohere
](
https://huggingface.co/docs/transformers/model_doc/cohere#transformers.CohereModel
)
*
[
Cohere
](
https://huggingface.co/docs/transformers/model_doc/cohere#transformers.CohereModel
)
*
[
Dbrx
](
https://huggingface.co/docs/transformers/model_doc/dbrx#transformers.DbrxModel
)
*
[
Dbrx
](
https://huggingface.co/docs/transformers/model_doc/dbrx#transformers.DbrxModel
)
*
[
Dpr
](
https://huggingface.co/docs/transformers/model_doc/dpr#transformers.DprReader
)
*
[
Falcon
](
https://huggingface.co/docs/transformers/model_doc/falcon#transformers.FalconModel
)
*
[
Falcon
](
https://huggingface.co/docs/transformers/model_doc/falcon#transformers.FalconModel
)
*
[
Gemma
](
https://huggingface.co/docs/transformers/model_doc/gemma#transformers.GemmaModel
)
*
[
Gemma
](
https://huggingface.co/docs/transformers/model_doc/gemma#transformers.GemmaModel
)
*
[
GPTBigCode
](
https://huggingface.co/docs/transformers/model_doc/gpt_bigcode#transformers.GPTBigCodeModel
)
*
[
GPTBigCode
](
https://huggingface.co/docs/transformers/model_doc/gpt_bigcode#transformers.GPTBigCodeModel
)
...
...
src/transformers/models/dpr/modeling_dpr.py
View file @
e7d52a10
...
@@ -142,6 +142,8 @@ class DPRReaderOutput(ModelOutput):
...
@@ -142,6 +142,8 @@ class DPRReaderOutput(ModelOutput):
class
DPRPreTrainedModel
(
PreTrainedModel
):
class
DPRPreTrainedModel
(
PreTrainedModel
):
_supports_sdpa
=
True
def
_init_weights
(
self
,
module
):
def
_init_weights
(
self
,
module
):
"""Initialize the weights"""
"""Initialize the weights"""
if
isinstance
(
module
,
nn
.
Linear
):
if
isinstance
(
module
,
nn
.
Linear
):
...
...
src/transformers/models/grounding_dino/modeling_grounding_dino.py
View file @
e7d52a10
...
@@ -2113,7 +2113,9 @@ class GroundingDinoModel(GroundingDinoPreTrainedModel):
...
@@ -2113,7 +2113,9 @@ class GroundingDinoModel(GroundingDinoPreTrainedModel):
)
)
# Create text backbone
# Create text backbone
self
.
text_backbone
=
AutoModel
.
from_config
(
config
.
text_config
,
add_pooling_layer
=
False
)
self
.
text_backbone
=
AutoModel
.
from_config
(
config
.
text_config
,
add_pooling_layer
=
False
,
attn_implementation
=
config
.
_attn_implementation
)
self
.
text_projection
=
nn
.
Linear
(
config
.
text_config
.
hidden_size
,
config
.
d_model
)
self
.
text_projection
=
nn
.
Linear
(
config
.
text_config
.
hidden_size
,
config
.
d_model
)
if
config
.
embedding_init_target
or
not
config
.
two_stage
:
if
config
.
embedding_init_target
or
not
config
.
two_stage
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment