prepro.py: TypeError: slice indices must be integers or None or have an __index__ method
ruizhaogit opened this issue · comments
Hi VisDial team,
Thank you for sharing the great work!
After I ran the command "python prepro.py -download 1", I have the following ouput:
Reading json...
train2014
Tokenizing captions...
Tokenizing questions...
Tokenizing answers...
val2014
Tokenizing captions...
Tokenizing questions...
Tokenizing answers...
Building vocabulary...
Words: 8845
Encoding based on vocabulary...
Creating data matrices...
Traceback (most recent call last):
File "prepro.py", line 161, in
captions_train, captions_train_len, questions_train, questions_train_len, answers_train, answers_train_len, options_train, options_train_list, options_train_len, answers_train_index, images_train_index, images_train_list = create_data_mats(data_train_toks, ques_train_inds, ans_train_inds, args)
File "prepro.py", line 94, in create_data_mats
captions[i][0:caption_len[i]] = data_toks[image_id]['caption_inds'][0:max_cap_len]
TypeError: slice indices must be integers or None or have an index method
Do you know how to fix this?
Thank you!
Best,
Rui
Thanks! Turns out I was getting a warning for this that I chose to ignore! :) 84e608e should fix it. Could you pull in the latest changes and give it a shot.
Great! It works now. Thank you!