Skip to content
Draft
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
4 changes: 4 additions & 0 deletions src/paddlefleet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

# Re-export from Paddle for backward compatibility (PaddleFormers imports these from paddlefleet)

from .indexcache_pp_runtime_patch import apply_indexcache_pp_runtime_patch

apply_indexcache_pp_runtime_patch()

from . import (
parallel_state as parallel_state,
training as training,
Expand Down
2 changes: 2 additions & 0 deletions src/paddlefleet/fusions/csa_sparse_attn.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def forward(
ctx.query_shape = (b, sq, np_heads, hn)
ctx.softmax_scale = float(softmax_scale)
ctx.attn_sink_dtype = attn_sink.dtype
ctx.attn_sink_stop_gradient = bool(attn_sink.stop_gradient)
ctx.backend = backend

query, kv_full, attn_sink, topk_idxs = prepare_inputs(
Expand Down Expand Up @@ -195,6 +196,7 @@ def backward(ctx, grad_output):
ctx.attn_sink_dtype
)

d_attn_sink = None if ctx.attn_sink_stop_gradient else d_attn_sink
return (dq, dkv, d_attn_sink, None)


Expand Down
Loading