Unverified Commit ecd5a7ed authored by Gustaf Ahdritz's avatar Gustaf Ahdritz Committed by GitHub
Browse files

Fix config setting bug in inference script

parent 86613a95
...@@ -109,8 +109,9 @@ def round_up_seqlen(seqlen): ...@@ -109,8 +109,9 @@ def round_up_seqlen(seqlen):
def run_model(model, batch, tag, args): def run_model(model, batch, tag, args):
with torch.no_grad(): with torch.no_grad():
# Disable templates if there aren't any in the batch # Temporarily disable templates if there aren't any in the batch
model.config.template.enabled = model.config.template.enabled and any([ template_enabled = model.config.template.enabled
model.config.template.enabled = template_enabled and any([
"template_" in k for k in batch "template_" in k for k in batch
]) ])
...@@ -120,6 +121,8 @@ def run_model(model, batch, tag, args): ...@@ -120,6 +121,8 @@ def run_model(model, batch, tag, args):
inference_time = time.perf_counter() - t inference_time = time.perf_counter() - t
logger.info(f"Inference time: {inference_time}") logger.info(f"Inference time: {inference_time}")
model.config.template.enabled = template_enabled
return out return out
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment