diff --git a/tests/jax/utils.py b/tests/jax/utils.py index f0a6928f1b2..04e56fa1cd5 100644 --- a/tests/jax/utils.py +++ b/tests/jax/utils.py @@ -233,7 +233,6 @@ def __call__( bias: bias for the attention weights. This should be broadcastable to the shape `[batch, num_heads, q_length, kv_length]` This can be used for incorporating causal masks, padding masks, proximity bias, etc. - dropout_rng: JAX PRNGKey: to be used for dropout deterministic: bool, deterministic or not (to apply dropout) Returns: Output of shape `[batch, length, num_heads, v_depth_per_head]`. diff --git a/transformer_engine/jax/cpp_extensions/attention.py b/transformer_engine/jax/cpp_extensions/attention.py index 3a1de7bd677..172ff3ac622 100644 --- a/transformer_engine/jax/cpp_extensions/attention.py +++ b/transformer_engine/jax/cpp_extensions/attention.py @@ -3751,12 +3751,8 @@ def fused_attn_fwd( - `(query, key, value)`: For separate query, key, and value tensors. bias (Optional[jnp.ndarray]): An optional bias tensor to be added to the attention scores. softmax_offset (Optional[jnp.ndarray]): An optional softmax offset tensor. - q_seqlen (jnp.ndarray): Sequence lengths for the query, with shape [batch,]. - kv_seqlen (jnp.ndarray): Sequence lengths for the key and value, with shape [batch,]. - q_seq_offsets (jnp.ndarray): - The offsets in the sequence dim for the query, with shape [batch + 1,]. - kv_seq_offsets (jnp.ndarray): - The offsets in the sequence dim for the query, with shape [batch + 1,]. + sequence_descriptor (SequenceDescriptor): Sequence lengths and offsets for the query, + key and value, and optionally segment ids and positions. seed (Optional[jnp.ndarray]): Optional random seed for dropout. attn_bias_type (AttnBiasType): Type of attention bias. attn_mask_type (AttnMaskType): Type of attention mask. @@ -3920,12 +3916,9 @@ def fused_attn_bwd( rng_state (jnp.ndarray): Auxiliary tensors to save the random state in the forward pass. output (jnp.ndarray): The output tensor from the forward pass. doutput (jnp.ndarray): The gradient with respect to the output. - q_seqlen (jnp.ndarray): Sequence lengths for the query, with shape [batch,]. - kv_seqlen (jnp.ndarray): Sequence lengths for the key and value, with shape [batch,]. - q_seq_offsets (jnp.ndarray): - The offsets in the sequence dim for the query, with shape [batch + 1,]. - kv_seq_offsets (jnp.ndarray): - The offsets in the sequence dim for the query, with shape [batch + 1,]. + sequence_descriptor (SequenceDescriptor): Sequence lengths and offsets for the query, + key and value, and optionally segment ids and positions. Replaces the separate + q_seqlen / kv_seqlen / q_seq_offsets / kv_seq_offsets arguments. attn_bias_type (AttnBiasType): Type of attention bias. attn_mask_type (AttnMaskType): Type of attention mask. softmax_type (AttnSoftmaxType): Type of softmax. diff --git a/transformer_engine/jax/flax/module.py b/transformer_engine/jax/flax/module.py index 17c9a242f04..094717c32b7 100644 --- a/transformer_engine/jax/flax/module.py +++ b/transformer_engine/jax/flax/module.py @@ -335,7 +335,7 @@ def __call__(self, x: jnp.ndarray) -> jnp.ndarray: Parameters ---------- - inputs : jax.numpy.ndarray + x : jax.numpy.ndarray Input tensors. Returns diff --git a/transformer_engine/jax/quantize/dequantizer.py b/transformer_engine/jax/quantize/dequantizer.py index ca44c2e4af4..bab5aac7993 100644 --- a/transformer_engine/jax/quantize/dequantizer.py +++ b/transformer_engine/jax/quantize/dequantizer.py @@ -143,12 +143,10 @@ def dequantize(scaled_tensor): """Dequantize a tensor using block scaling. Args: - data: The quantized tensor data - scale_inv: The inverse scaling factors - dq_dtype: The data type for dequantized values - scaling_mode: The scaling mode used for quantization - is_colwise: Whether the scaling is column-wise - flatten_axis: The axis along which the tensor could be flattened to 2D + scaled_tensor: The block-scaled tensor to dequantize. Its fields supply the + quantized data, the inverse scaling factors, the output dtype, the scaling + mode, whether the scaling is column-wise, and the axis it can be flattened + to 2D along. Returns: The dequantized tensor diff --git a/transformer_engine/pytorch/ops/fused/userbuffers_backward_linear.py b/transformer_engine/pytorch/ops/fused/userbuffers_backward_linear.py index 3e2e24f37d9..6eb8d19f0e6 100644 --- a/transformer_engine/pytorch/ops/fused/userbuffers_backward_linear.py +++ b/transformer_engine/pytorch/ops/fused/userbuffers_backward_linear.py @@ -661,8 +661,6 @@ def fuse_backward_ops( ---------- ops : list of FusibleOperation Backward pass operations. - recipe : Recipe, optional - Quantization recipe. Returns ------- diff --git a/transformer_engine/pytorch/triton/mhc.py b/transformer_engine/pytorch/triton/mhc.py index 180c9be78e0..388734bc144 100644 --- a/transformer_engine/pytorch/triton/mhc.py +++ b/transformer_engine/pytorch/triton/mhc.py @@ -487,7 +487,6 @@ def forward( norm_weight (tensor or None): Optional, or tensor of shape (K,). RMSNorm's learnable per-element affine parameters use_tf32 (bool): Whether to use TF32 precision for matmul operations. If False, uses IEEE or TF32x3 for better precision. Due to a triton bug (https://github.com/triton-lang/triton/issues/10176), we will use TF32x3 if x is bf16 and phi is fp32, or use IEEE if otherwise. - n (int): Number of hyper connections, where only n=4 is supported in the current implementation. fused_grad_x_acc_buffer (torch.Tensor or None): A pre-allocated buffer for inplace gradient accumulation to avoid PyTorch autograd overhead. Returns: