Warning: file_put_contents(aCache/aDaily/post/dlinnlp/-1605-1606-): Failed to open stream: No space left on device in /var/www/tgoop/post.php on line 50
DL in NLP@dlinnlp P.1606
DLINNLP Telegram 1606
Flash attention in practice 🔥

PyTorch 2.0 has flash-attention built-in, here's how you can use it:

1. Replace your attention op with torch.nn.functional.scaled_dot_product_attention
1. Use 16-bit float (which you should always be using for training anyway)
1. Make sure that your head dim is a multiple of 8 and no more than 128

Lookup git diff above as an example.

Result:
1. 2010 examples/sec ⟼ 2790 examples/sec. 40% speedup (8x4090 setup)
1. RAM: 22Gb ⟼ 16 GB reduction at 256 sequence length
1. Absolutely the same model, no approximations

(In my case a big chunk of improvement also came at the cost of reducing softmax precision from fp32 to bf16, but to hell with that)

Flash attention should yield even higher improvements on larger sequence lengths.
🔥49👍9❤3🤯2



tgoop.com/dlinnlp/1606
Create:
Last Update:

Flash attention in practice 🔥

PyTorch 2.0 has flash-attention built-in, here's how you can use it:

1. Replace your attention op with torch.nn.functional.scaled_dot_product_attention
1. Use 16-bit float (which you should always be using for training anyway)
1. Make sure that your head dim is a multiple of 8 and no more than 128

Lookup git diff above as an example.

Result:
1. 2010 examples/sec ⟼ 2790 examples/sec. 40% speedup (8x4090 setup)
1. RAM: 22Gb ⟼ 16 GB reduction at 256 sequence length
1. Absolutely the same model, no approximations

(In my case a big chunk of improvement also came at the cost of reducing softmax precision from fp32 to bf16, but to hell with that)

Flash attention should yield even higher improvements on larger sequence lengths.

BY DL in NLP





Share with your friend now:
tgoop.com/dlinnlp/1606

View MORE
Open in Telegram


Telegram News

Date: |

Activate up to 20 bots A few years ago, you had to use a special bot to run a poll on Telegram. Now you can easily do that yourself in two clicks. Hit the Menu icon and select “Create Poll.” Write your question and add up to 10 options. Running polls is a powerful strategy for getting feedback from your audience. If you’re considering the possibility of modifying your channel in any way, be sure to ask your subscribers’ opinions first. It’s easy to create a Telegram channel via desktop app or mobile app (for Android and iOS): Earlier, crypto enthusiasts had created a self-described “meme app” dubbed “gm” app wherein users would greet each other with “gm” or “good morning” messages. However, in September 2021, the gm app was down after a hacker reportedly gained access to the user data. Telegram offers a powerful toolset that allows businesses to create and manage channels, groups, and bots to broadcast messages, engage in conversations, and offer reliable customer support via bots.
from us


Telegram DL in NLP
FROM American