User01110 commited on
Commit
b06e1be
·
verified ·
1 Parent(s): e2b622e

accept attention_mask in generate()

Browse files
Files changed (1) hide show
  1. modeling_swa.py +1 -1
modeling_swa.py CHANGED
@@ -174,7 +174,7 @@ class SWAForCausalLM(PreTrainedModel, GenerationMixin):
174
  def get_input_embeddings(s): return s.model.emb
175
  def set_input_embeddings(s, e): s.model.emb = e
176
 
177
- def prepare_inputs_for_generation(s, input_ids, past_key_values=None, **kw):
178
  """generate(): keep one SWACache per sequence and feed only the tokens it has not seen. The cache is found in
179
  past_key_values, or (if this transformers version keeps its own cache object there) in the last cache this
180
  model built, reused only when its tokens are exactly the prefix of input_ids. Batch rows must be unpadded."""
 
174
  def get_input_embeddings(s): return s.model.emb
175
  def set_input_embeddings(s, e): s.model.emb = e
176
 
177
+ def prepare_inputs_for_generation(s, input_ids, past_key_values=None, attention_mask=None, **kwargs):
178
  """generate(): keep one SWACache per sequence and feed only the tokens it has not seen. The cache is found in
179
  past_key_values, or (if this transformers version keeps its own cache object there) in the last cache this
180
  model built, reused only when its tokens are exactly the prefix of input_ids. Batch rows must be unpadded."""