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

AttributeError: 'TransformerDecoderLayerOptimal' object has no attribute 'self_attn' #82

Open
agathebeucher opened this issue Jan 15, 2024 · 7 comments

Comments

@agathebeucher
Copy link

When i try to train the model on MSCOCO2014, i have this error that i can't fix : AttributeError: 'TransformerDecoderLayerOptimal' object has no attribute 'self_attn'... what should i do ?

@DatesYuen
Copy link

I have meet the same question.

@DatesYuen
Copy link

It has been resolved when I change Pytorch version from 2.1.1 to 1.13.1.

@agathebeucher
Copy link
Author

But when i do that i have the error : "ModuleNotFoundError : No module named 'torch._dynamo'...

@agathebeucher
Copy link
Author

Did you solve that ?

@DatesYuen
Copy link

DatesYuen commented Jan 18, 2024

But when i do that i have the error : "ModuleNotFoundError : No module named 'torch._dynamo'...

I don't have that problem. I can run this project after change Pytorch version.

@fnauman
Copy link

fnauman commented May 17, 2024

Found a fix. Use vanilla nn.TransformerDecoderLayer instead of the custom TransformerDecoderLayerOptimal in Line 124 of ml_decoder.py:

layer_decode = TransformerDecoderLayerOptimal(d_model=decoder_embedding,

layer_decode = nn.TransformerDecoderLayer(
    d_model=decoder_embedding, 
    nhead=8, 
    dim_feedforward=dim_feedforward, 
    dropout=decoder_dropout
)

Did you solve that ?

@Esmaeel-Hilal
Copy link

Install PyTorch 1.7 to solve the issue

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

No branches or pull requests

4 participants