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

force is_causal for ndc #382

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion sharktank/sharktank/evaluate/perplexity_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def load_model(self, dataset, tokenizer, tensor_parallelism_size, attention_kern
attention_dtype=self.attention_dtype,
tensor_parallelism_size=tensor_parallelism_size,
)

config.attention_kernel="torch"
if config.tensor_parallelism_size > 1:
dataset.root_theta = shard_theta(dataset.root_theta, config)

Expand Down
4 changes: 3 additions & 1 deletion sharktank/sharktank/layers/paged_llama_attention_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ def repeat_kv(x: torch.Tensor) -> torch.Tensor:
attn_weights, values
) # (bs, heads, slen, head_dim)
else:
is_causal = attention_mask is None and batch_seq_len == 1
# Use the builtin attention mask when not decomposed
is_causal = True
attention_mask = None
attn_output = ops.scaled_dot_product_attention(
q=xq, # [bs, ..., sl, dim]
k=keys, # [bs, ..., sl, dim]
Expand Down
Loading