Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flash v2 #137

Draft
wants to merge 92 commits into
base: main
Choose a base branch
from
Draft

Flash v2 #137

wants to merge 92 commits into from

Conversation

hypnopump
Copy link

Uses flash attention v2. Works for any sequence length.

  • Flash attn v2 from pytorch for masked attention.
  • Custom flash attn v2 kernel for bias (triton-based, currently block size decided by autotuner, might need improvements to avoid recompilation).
    • TF32 acceleration disabled by default, might need to check compute architecture and selectively enable it.

WARNING! Pls install the custom fork from trident provided below as a zip file. You might need to install triton-nightly afterwards (maybe also nvtx) to get it working (see triton repo for instructions). Check with ipython; import trident as td

trident.zip

ZiyaoLi and others added 30 commits August 1, 2022 14:35
* readme

* add contributing and dco
* rename scripts

* fix bug

* refine scripts

* fix renaming bug

* keep 10 ckps

* dump outputs

* readme

* hierachy

* title

* introduction

* rm converter readme

* intro

* log interval

* README

* intro
…rp#7)

* add the convert script and alphafold original configs

* add the convert script for alphafold and modify the README

* add the convert script for alphafold

* merge from main
* add script for benchmarking

* code clean

* add benchmark in memory cost

* remove use_lma

* add option for LMA
* add evaluation results

* par

* compress img

* figure layout

* white bg

* png -> jpg

* Revert "figure layout"

* revert to green
* Update README.md

* Update README.md
* optional msa col attn mask

* chunk attention

* fix chunk_size

* code clean

Co-authored-by: Guolin Ke <guolin.ke@outlook.com>
* add the colab version of Uni-Fold

* add the description of Uni-Fold Colab at README
BaozCWJ and others added 25 commits September 16, 2022 10:46
* refine notebook

* rephrase

* rephrase

* rephrase

* rephrase

* rm output

* rephrase

* rephrase

Co-authored-by: Guolin Ke <guolin.ke@outlook.com>
change default model name to avoid confusion
* fix uf-symmetry wget url

* fix url
* do not download af2 params

* do not download af params
* refactor the notebook

* change branch

* add init

* fix auto chunk size

* optim plot & fix pae

* fix ssave file bug

* merge cell

* finalize
* fix wrong version

* change from google drive to github release
* Update unifold.ipynb

* Update unifold.ipynb

* Update unifold.ipynb
* update get assembly from mmcif

* add comment
* add dataset download via Volcengine

* rephrase

---------

Co-authored-by: Ziyao Li <36321246+ZiyaoLi@users.noreply.github.com>
* add symmetry utils to process input structures

* fix import
…-corp#119)

* tolerate inconsistencies between pdb_assembly and multi_label

* Update dataset.py
@@ -2,15 +2,16 @@
[ -z "${n_gpu}" ] && n_gpu=$(nvidia-smi -L | wc -l)
export NCCL_ASYNC_ERROR_HANDLING=1
export OMP_NUM_THREADS=1
mkdir -p $1
mkdir -p temp
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once this proposal is validated, modifications to this file can be dropped; was just for easy testing of the code

k = k.view(*k.shape[:-1], self.num_heads, self.head_dim).transpose(-2, -3).contiguous()
v = v.view(*v.shape[:-1], self.num_heads, self.head_dim).transpose(-2, -3)
# (b, n, h, i, dim_head), (b, n, h, j, dim_head) -> (b, n, h, i, dim_head)
o = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=mask)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about its speed/memory compared with the one with softmax_dropout?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants