본문으로 바로가기

imdb.load_data 실행시에 아래와 같은 에러가 난다면,

Object arrays cannot be loaded when allow_pickle=False

 

아래 세가지 중에 한가지로 개선됨.

 

1. Numpy 버전을 1.16.1이나 1.16.2로 다운그레이드

2. 또는 아래와 같이 데이터 로딩할때만 defualt parameter를 수정

 

##############################################################################

import numpy as np

#####   Fix Numpy Error
np_load_old = np.load    # save np.load
np.load = lambda *a,**k: np_load_old(*a, allow_pickle=True, **k)    # modify the default parameters of np.load
(input_train, y_train), (input_test, y_test) = imdb.load_data(num_words = max_features)
np.load = np_load_old    # restore np.load for future normal usage
del(np_load_old)
#####   Fix Numpy Error

##############################################################################

thanks to https://stackoverflow.com/questions/55890813/how-to-fix-object-arrays-cannot-be-loaded-when-allow-pickle-false-for-imdb-loa

 

How to fix 'Object arrays cannot be loaded when allow_pickle=False' for imdb.load_data() function?

I'm trying to implement the binary classification example using the IMDb dataset in Google Colab. I have implemented this model before. But when I tried to do it again after a few days, it returned a

stackoverflow.com

 

3. keras 2.2.5 버전에서는 개선 됨