DeepSpeed icon indicating copy to clipboard operation
DeepSpeed copied to clipboard

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

Open harborsarah opened this issue 9 months ago • 0 comments

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

harborsarah avatar May 14 '24 08:05 harborsarah