Kaggle: cannot unpack non-iterable nonetype object

50 Views Asked by At

I have a problem when i try to indexing and masking my data

I know this question has been asked before but I can't seem to get mine to work.

train = pd.read_csv('/kaggle/input/twitter2/train.csv', lineterminator='\n')
test = pd.read_csv('/kaggle/input/twitter2/test.csv', lineterminator='\n')
train.head()

    tweet                                                   gender
0   i need this for when my wife and i live in our...   1
1   why we never saw alfredhitchcock s bond and th...   0
2   oh my gosh the excitement of coming back from ...   1
3   because its monday and im missing him a little...   1
4   so to cwnetwork for having the current episode...   1



test.head()


        tweet                                                   gender
0   the opposite of faith is not doubt its absolu...    1
1   wen yu really value somethingyu stay commited ...   1
2   today was such a bad day i wish i could text t...   1
3   so i took a nap amp had the weirdest dream lit...   0
4   savagejaspy i like the purple but you seem mor...   1

I've already check both dataframe and they are already filed with tweets and gender labels

But when i try to run this code below...

def xlnet_encode(data,maximum_length) :
    input_ids = []
    attention_masks = []

train_input_ids,train_attention_masks = xlnet_encode(train[:50000],60)
test_input_ids,test_attention_masks = xlnet_encode(test[:20000],60)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-27-8f651b283574> in <module>
----> 1 train_input_ids,train_attention_masks = xlnet_encode(tweet_train[:50000],60)
      2 test_input_ids,test_attention_masks = xlnet_encode(tweet_test[:20000],60)

TypeError: cannot unpack non-iterable NoneType object

The output of these code will be the index number of words from the dataset and the masking

Did I just missed something? How to solve this problem???

1

There are 1 best solutions below

1
Vito Rozaan On

Nevermind, I've already figured it out. I forgot put the XLNet Tokenizer