Skip to content

[BUG]AttributeError: module 'torch.nn.functional' has no attribute 'scaled_dot_product_attention' #5534

@harborsarah

Description

@harborsarah

Dear authors,

I install Deepspeed through pip install deepspeed. And my torch version is 1.12.1 and cuda 11.3
However, when i try to use following code to count the flops, it gives me error: AttributeError: module 'torch.nn.functional' has no attribute 'scaled_dot_product_attention'

if step == profile_step: # if using multi nodes, check global_rank == 0 as well prof.stop_profile() flops = prof.get_total_flops() macs = prof.get_total_macs() params = prof.get_total_params() if print_profile: prof.print_model_profile(profile_step=profile_step) prof.end_profile()

I check the README file and it written that the package support torch>=1.9, so it should work with my version. Do you know how to solve this problem? Thanks a lot.

ds_report output
Please run ds_report to give us details about your setup.

Screenshots
image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions