From eb0089d2af00978e26016a00e911a9c3d35b30aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berker=20S=C3=B6nmez?= Date: Tue, 24 Oct 2017 21:03:50 +0300 Subject: [PATCH] Fixed training chunk size problem. --- train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train.py b/train.py index 9050e57..82c3a63 100755 --- a/train.py +++ b/train.py @@ -36,7 +36,7 @@ def random_training_set(chunk_len, batch_size): inp = torch.LongTensor(batch_size, chunk_len) target = torch.LongTensor(batch_size, chunk_len) for bi in range(batch_size): - start_index = random.randint(0, file_len - chunk_len) + start_index = random.randint(0, file_len - chunk_len - 1) end_index = start_index + chunk_len + 1 chunk = file[start_index:end_index] inp[bi] = char_tensor(chunk[:-1])