Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
flash-attention
Commits
d431f167
Commit
d431f167
authored
Aug 19, 2023
by
Tri Dao
Browse files
Import torch before flash_attn_2_cuda
parent
0e8c46ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
flash_attn/flash_attn_interface.py
flash_attn/flash_attn_interface.py
+5
-1
No files found.
flash_attn/flash_attn_interface.py
View file @
d431f167
import
flash_attn_2_cuda
as
flash_attn_cuda
import
torch
import
torch
import
torch.nn
as
nn
import
torch.nn
as
nn
from
einops
import
rearrange
from
einops
import
rearrange
# isort: off
# We need to import the CUDA kernels after importing torch
import
flash_attn_2_cuda
as
flash_attn_cuda
# isort: on
def
_get_block_size
(
device
,
head_dim
,
is_dropout
,
is_causal
):
def
_get_block_size
(
device
,
head_dim
,
is_dropout
,
is_causal
):
# This should match the block sizes in the CUDA kernel
# This should match the block sizes in the CUDA kernel
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment