Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lesson 3 IMDB example : KeyError: 'unsup' #130

Closed
zhangjiekui opened this issue Dec 29, 2018 · 4 comments
Closed

Lesson 3 IMDB example : KeyError: 'unsup' #130

zhangjiekui opened this issue Dec 29, 2018 · 4 comments

Comments

@zhangjiekui
Copy link

data_clas = (TextList.from_folder(path, vocab=data_lm.vocab)
#grab all the text files in path
.split_by_folder(valid='test')
#split by train and valid folder (that only keeps 'train' and 'test' so no need to filter)
.label_from_folder(classes=['neg', 'pos'])
.filter_missing_y() #the error is the same even comments this line
#label them all with their folders
.databunch(bs=bs))

data_clas.save('tmp_clas')

KeyError Traceback (most recent call last)
/usr/anaconda/envs/pytorch10/lib/python3.7/site-packages/fastai/data_block.py in process_one(self, item)
277 def process_one(self,item):
--> 278 try: return self.c2i[item] if item is not None else None
279 except:

KeyError: 'unsup'

...
exception: Your validation data contains a label that isn't present in the training set, please fix your data.

@dinhju
Copy link

dinhju commented Dec 30, 2018

had the same issue and „fixed” it by moving the unsup out of the data folder.

@zhangjiekui
Copy link
Author

zhangjiekui commented Dec 30, 2018

yes , bug I think it's a bug. maybe some filters are needed!

i had tried"label_from_folder(classes=['neg', 'pos'])" ----> "label_from_folder()"
at least this line runs correctly

@agarnitin86
Copy link

My train and test set has proper distribution with number of samples in each class much greater than 5 still i am getting same error

@jph00
Copy link
Member

jph00 commented Feb 20, 2019

It sounds like you might have the wrong dataset. Please ask on the forum if you're still stuck.

@jph00 jph00 closed this as completed Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants