You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use calculate_flops to calculate flops of a local model (e.g. openai/clip-vit-large-patch14-336 downloaded locally), the result is smaller than the FLOPs calculated manually (use the flops calculation from mmcv and add the self-attention flops).
I found that the modeling_clip.py in the huggingface transformers package use torch.bmm to calculate attention weights, but the torch.mm and torch.bmm are commented in _patch_tensor_methods in pytorch_ops.py. When I uncomment these lines, the result is consistent with my manual calculation.
Are there any reasons why they are deleted? From commit 4bcf54c it seems to fix the bug for calculate_flops_hf, but I suspect this introduces bugs to calculate_flops.
When I use
calculate_flops
to calculate flops of a local model (e.g.openai/clip-vit-large-patch14-336
downloaded locally), the result is smaller than the FLOPs calculated manually (use the flops calculation from mmcv and add the self-attention flops).I found that the
modeling_clip.py
in the huggingface transformers package usetorch.bmm
to calculate attention weights, but thetorch.mm
andtorch.bmm
are commented in_patch_tensor_methods
inpytorch_ops.py
. When I uncomment these lines, the result is consistent with my manual calculation.Are there any reasons why they are deleted? From commit 4bcf54c it seems to fix the bug for
calculate_flops_hf
, but I suspect this introduces bugs tocalculate_flops
.Maybe related to #26
The text was updated successfully, but these errors were encountered: