gidariss/FewShotWithoutForgetting

UnicodeDecodeError when training

Closed this issue · 8 comments

zjxi commented
UnicodeDecodeError when training

When I run the 1st training stage :

CUDA_VISIBLE_DEVICES=0 python train.py --config=miniImageNet_Conv128CosineClassifier

But it comes to an error like this :

Traceback (most recent call last):
  File "train.py", line 72, in <module>
    dataset_train = MiniImageNet(phase=train_split)
  File "C:\Users\lenovo\Desktop\FewShotWithoutForgetting\dataloader.py", line 122, in __init__
    data_train = load_data(file_train_categories_train_phase)
  File "C:\Users\lenovo\Desktop\FewShotWithoutForgetting\dataloader.py", line 90, in load_data
    data = pickle.load(fo)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x91 in position 1: ordinal not in range(128)

Environment Python 3.7, pytorch 0.4
Thanks.

Hello, have you fixed this problem?

Thanks a lot!
Maybe we can work on it together.

However, when using the ‘bytes’ encoding rule, I met another problem below:

Traceback (most recent call last):
  File "train.py", line 72, in <module>
    dataset_train = MiniImageNet(phase=train_split)
  File "/media/eternal-wang/D/Research/FSL/FewShotWithoutForgetting-master/dataloader.py", line 124, in __init__
    self.data = data_train['data']
KeyError: 'data'

But after changed into ‘iso-8859-1’,the problem disappeared.

Yes.
By the way, I finally make the code running after fixed several bugs.

I haven't met this error.
Maybe you should check the path of ./architectures/ConvNet.py

change

self.global_iter = self.curr_epoch * len(data_loader) + self.biter

to

self.global_iter = self.curr_epoch * len(data_loader()) + self.biter

change

nEvalExamplesPerClass = nTestNovel / nKnovel

to

nEvalExamplesPerClass = int(nTestNovel / nKnovel)

in dataloader.py at line 380

你已经是个成熟的程序员了,应该学会开动小脑瓜自己debug了。