This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| # from flash_attn_interface import flash_attn_func as flash_attn_func_v3 | |
| from sgl_kernel.flash_attn import flash_attn_with_kvcache as flash_attn_func_v3 | |
| # from flash_attn.utils.benchmark import benchmark_forward | |
| import torch.utils.benchmark as benchmark | |
| def benchmark_forward( | |
| fn, *inputs, repeats=10, desc="", verbose=True, amp=False, amp_dtype=torch.float16, **kwinputs |