Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apex/contrib/fmha/fmha.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
class FMHAFun(torch.autograd.Function):
@staticmethod
def forward(ctx, qkv, cu_seqlens, p_dropout, max_s, is_training, zero_tensors):
from apex import deprecated_warning
deprecated_warning(
"`apex.contrib.fmha` is deprecated and will be removed in March 2026. "
"We encourage you to migrate to PyTorch native MultiheadAttention"
"The documentation is available in https://docs.pytorch.org/docs/main/generated/torch.nn.MultiheadAttention.html"
)
Comment on lines +36 to +41
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Aidyn-A shouldn't we propose F.scaled_dot_product_attention instead? as this is torch.autograd.Function

or, have this warning in custom nn.Module.__init__


batch_size = cu_seqlens.numel() - 1
if batch_size < 4:
max_s = 512
Expand Down
7 changes: 7 additions & 0 deletions apex/contrib/multihead_attn/encdec_multihead_attn_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ def forward(
mask,
dropout_prob,
):
from apex import deprecated_warning
deprecated_warning(
"`apex.contrib.multihead_attn` is deprecated and will be removed in March 2026. "
"We encourage you to migrate to PyTorch native MultiheadAttention"
"The documentation is available in https://docs.pytorch.org/docs/main/generated/torch.nn.MultiheadAttention.html"
)

use_biases_t = torch.tensor([input_biases_q is not None])
heads_t = torch.tensor([heads])
scale_t = torch.tensor([scale])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ def forward(
pad_mask,
dropout_prob,
):
from apex import deprecated_warning
deprecated_warning(
"`apex.contrib.multihead_attn` is deprecated and will be removed in March 2026. "
"We encourage you to migrate to PyTorch native MultiheadAttention"
"The documentation is available in https://docs.pytorch.org/docs/main/generated/torch.nn.MultiheadAttention.html"
)

heads_t = torch.tensor([heads])
dropout_prob_t = torch.tensor([dropout_prob])
null_tensor = torch.tensor([])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ def forward(
pad_mask,
dropout_prob,
):
from apex import deprecated_warning
deprecated_warning(
"`apex.contrib.multihead_attn` is deprecated and will be removed in March 2026. "
"We encourage you to migrate to PyTorch native MultiheadAttention"
"The documentation is available in https://docs.pytorch.org/docs/main/generated/torch.nn.MultiheadAttention.html"
)

heads_t = torch.tensor([heads])
dropout_prob_t = torch.tensor([dropout_prob])
null_tensor = torch.tensor([])
Expand Down
7 changes: 7 additions & 0 deletions apex/contrib/multihead_attn/fast_self_multihead_attn_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ def forward(
mask_additive,
dropout_prob,
):
from apex import deprecated_warning
deprecated_warning(
"`apex.contrib.multihead_attn` is deprecated and will be removed in March 2026. "
"We encourage you to migrate to PyTorch native MultiheadAttention"
"The documentation is available in https://docs.pytorch.org/docs/main/generated/torch.nn.MultiheadAttention.html"
)

use_biases_t = torch.tensor([input_biases is not None])
heads_t = torch.tensor([heads])
dropout_prob_t = torch.tensor([dropout_prob])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ def forward(
pad_mask,
dropout_prob,
):
from apex import deprecated_warning
deprecated_warning(
"`apex.contrib.multihead_attn` is deprecated and will be removed in March 2026. "
"We encourage you to migrate to PyTorch native MultiheadAttention"
"The documentation is available in https://docs.pytorch.org/docs/main/generated/torch.nn.MultiheadAttention.html"
)

heads_t = torch.tensor([heads])
dropout_prob_t = torch.tensor([dropout_prob])
null_tensor = torch.tensor([])
Expand Down
7 changes: 7 additions & 0 deletions apex/contrib/multihead_attn/mask_softmax_dropout_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
class MaskSoftmaxDropout(torch.autograd.Function):
@staticmethod
def forward(ctx, is_training, heads, inputs, pad_mask, mask_additive, dropout_prob):
from apex import deprecated_warning
deprecated_warning(
"`apex.contrib.multihead_attn` is deprecated and will be removed in March 2026. "
"We encourage you to migrate to PyTorch native MultiheadAttention"
"The documentation is available in https://docs.pytorch.org/docs/main/generated/torch.nn.MultiheadAttention.html"
)

heads_t = torch.tensor([heads])
dropout_prob_t = torch.tensor([dropout_prob])
null_tensor = torch.tensor([])
Expand Down
7 changes: 7 additions & 0 deletions apex/contrib/multihead_attn/self_multihead_attn_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ def forward(
is_additive_mask,
dropout_prob,
):
from apex import deprecated_warning
deprecated_warning(
"`apex.contrib.multihead_attn` is deprecated and will be removed in March 2026. "
"We encourage you to migrate to PyTorch native MultiheadAttention"
"The documentation is available in https://docs.pytorch.org/docs/main/generated/torch.nn.MultiheadAttention.html"
)

use_biases_t = torch.tensor([input_biases is not None])
heads_t = torch.tensor([heads])
scale_t = torch.tensor([scale])
Expand Down