Gemma inference fix

This commit is contained in:
Daniel Han-Chen 2024-04-05 03:51:53 +11:00
commit b5200a33f1
2 changed files with 7 additions and 2 deletions

View file

@ -36,7 +36,7 @@ huggingface = [
"tyro",
"transformers>=4.38.2",
"datasets>=2.16.0",
"sentencepiece",
"sentencepiece>=0.2.0",
"tqdm",
"psutil",
"wheel>=0.42.0",

View file

@ -145,7 +145,12 @@ def GemmaModel_fast_forward_inference(
bsz, q_len, hd = hidden_states.shape
seq_len = past_key_values[0][0].shape[-2]
if bsz != 1:
attention_mask = _prepare_4d_causal_attention_mask(attention_mask, (bsz, q_len), hidden_states, seq_len,)
attention_mask = _prepare_4d_causal_attention_mask_for_sdpa(
attention_mask,
(bsz, q_len),
hidden_states,
seq_len,
)
pass
next_decoder_cache = []