Skip to content

Commit

Permalink
disable autocast for ring_flash_attn_cuda
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Apr 6, 2024
1 parent 5b202e4 commit 5b3b22f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ring_attention_pytorch/ring_flash_attention_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from torch import nn, einsum, Tensor
import torch.nn.functional as F
from torch.autograd.function import Function
from torch.cuda.amp import autocast

from ring_attention_pytorch.ring import (
ring_pass,
Expand Down Expand Up @@ -481,6 +482,7 @@ class RingFlashAttentionCUDAFunction(Function):

@staticmethod
@torch.no_grad()
@autocast(enabled = False)
def forward(
ctx,
q: Tensor,
Expand Down Expand Up @@ -629,6 +631,7 @@ def forward(

@staticmethod
@torch.no_grad()
@autocast(enabled = False)
def backward(ctx, do):
""" Algorithm 2 in the v2 paper """

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'ring-attention-pytorch',
packages = find_packages(exclude=[]),
version = '0.3.0',
version = '0.3.1',
license='MIT',
description = 'Ring Attention - Pytorch',
author = 'Phil Wang',
Expand Down

0 comments on commit 5b3b22f

Please sign in to comment.