remove expensive assertions in inference code

justheuristic-patch-1
justheuristic 2 years ago committed by GitHub
parent 0fd2caa4be
commit d3996a1ddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -81,8 +81,6 @@ class TransformerBackend(ModuleBackend):
assert new_k.shape[0] == past_k.shape[0] and new_v.shape[0] == past_v.shape[0]
assert new_k.shape[1] == new_length and new_v.shape[1] == new_length
assert new_k.shape[2:] == past_k.shape[2:] and new_v.shape[2:] == past_v.shape[2:]
assert torch.allclose(new_v[:, : past_v.shape[1]], past_v)
assert torch.allclose(new_k[:, : past_k.shape[1]], past_k)
cache[0, :, prefix_length:new_length, :] = new_k[:, prefix_length:new_length]
cache[1, :, prefix_length:new_length, :] = new_v[:, prefix_length:new_length]
return (hidden_states,)

Loading…
Cancel
Save