flash-attention/flash_attn
Volodymyr Kyrylov 70ab266a56 rotary: update cos/sin cache when switching from inference mode
This resolves RuntimeErrors after running evaluation in inference mode:

```
  File "/home/proger/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/proger/.local/lib/python3.10/site-packages/flash_attn/modules/mha.py", line 492, in forward
    qkv = self.rotary_emb(qkv)
  File "/home/proger/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/proger/.local/lib/python3.10/site-packages/flash_attn/layers/rotary.py", line 229, in forward
    return apply_rotary_emb_qkv_(
  File "/home/proger/.local/lib/python3.10/site-packages/torch/autograd/function.py", line 506, in apply
    return super().apply(*args, **kwargs)  # type: ignore[misc]
RuntimeError: Inference tensors cannot be saved for backward. To work around you can make a clone to get a normal tensor and use it in autograd.
```
2023-07-08 12:01:07 +02:00
..
layers rotary: update cos/sin cache when switching from inference mode 2023-07-08 12:01:07 +02:00
losses Tweak CrossEntropyLoss to take process_group in init 2022-12-27 10:47:43 -08:00
models [Gen] Add rotary base as an argument to FT attention kernel 2023-05-30 13:38:34 -07:00
modules [Rotary] Make sure frequency calculation is in fp32 2023-07-02 16:39:39 -07:00
ops [LayerNorm] Make sure memory addresses are aligned to 16 bytes 2023-07-04 14:53:12 -07:00
utils [Gen] Minor tweak to allocate_inference_cache 2023-04-21 11:56:47 -07:00
__init__.py Bump to v1.0.8 2023-07-02 17:04:54 -07:00
bert_padding.py remove numpy dependency 2022-10-06 19:17:15 +02:00
flash_attention.py Remove unused kwargs in flashattention 2023-03-15 10:36:19 -07:00
flash_attn_interface.py [Doc] Change total -> total_q 2023-07-02 17:23:52 -07:00
flash_attn_triton_og.py Implement FlashAttention in Triton 2022-10-30 18:09:11 -07:00
flash_attn_triton.py [Triton] Fix benchmark_causal, mention Triton version 2023-03-22 00:51:16 -07:00
flash_blocksparse_attention.py Rename src -> flash_attn 2022-06-01 18:50:26 -07:00
flash_blocksparse_attn_interface.py Rename src -> flash_attn 2022-06-01 18:50:26 -07:00
fused_softmax.py Add Megatron attention implementation for benchmarking 2022-10-23 23:04:16 -07:00