s = 0
while s < n:
t = min(s + batch_size, n)
if t < s + batch_size:
break
batches.append(get_batch(x0[s:t] + x1[s:t],
[0] * (t-s) + [1]*(t-s),
word2id,
batch_size))
After Change
def get_batches(x0, x1, word2id, batch_size, sort=False):
// half as batch size
batch_size = batch_size // 2
n = max(len(x0), len(x1))
n = (n // batch_size + 1) * batch_size
if len(x0) < n:
x0 = makeup(x0, n)
if len(x1) < n: