Generate: delete unused TF _reorder_cache (#20964)

This commit is contained in:
Joao Gante
2023-01-03 10:54:56 +00:00
committed by GitHub
parent a3e8d3cb1c
commit 4fd89e4978
23 changed files with 0 additions and 207 deletions

View File

@@ -3028,13 +3028,6 @@ class TF{{cookiecutter.camelcase_modelname}}ForConditionalGeneration(TF{{cookiec
"use_cache": use_cache, # change this to avoid caching (presumably for debugging)
}
@staticmethod
def _reorder_cache(past, beam_idx):
reordered_past = ()
for layer_past in past:
reordered_past += (tuple(tf.gather(past_state, beam_idx, axis=0) for past_state in layer_past),)
return reordered_past
def hf_compute_loss(self, labels, logits):
"""CrossEntropyLoss that ignores pad tokens"""
loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(