line 69-70 :
index = randint(0, vocab_size - 1) # random index in vocabularyinput_ids[pos] = word_dict[number_dict[index]]
The length of number_dict is 25, but the length of vocab_size is 29, so number_dict[index] might be out of range.
May be we should change line 69 into index = randint(0, len(word_list) - 1)?
line 69-70 :
index = randint(0, vocab_size - 1) # random index in vocabulary
input_ids[pos] = word_dict[number_dict[index]]
The length of number_dict is 25, but the length of vocab_size is 29, so number_dict[index] might be out of range. May be we should change line 69 intoindex = randint(0, len(word_list) - 1)
?