kefirski / pytorch_RVAE

Recurrent Variational Autoencoder that generates sequential data implemented with pytorch
MIT License
357 stars 87 forks source link

allow_pickle=False problem in train_word_embeddings.py #17

Closed davislf2 closed 5 years ago

davislf2 commented 5 years ago

Hi, I really like this code. When I try to train word embeddings, it shows this error. Does anyone have the same problem and have solved it? I changed CUDA default to False since I am running on MacOS (10.14). I run python 3.6.1 on conda and the following modules: certifi==2019.3.9 cffi==1.12.3 mkl-fft==1.0.10 mkl-random==1.0.2 numpy==1.16.3 olefile==0.46 Pillow==4.2.1 pycparser==2.19 six==1.12.0 torch==1.0.1.post2 torchvision==0.2.2

Traceback (most recent call last): File "train_word_embeddings.py", line 25, in batch_loader = BatchLoader('') File "/Users/davis/Downloads/Projects/side-projects/pytorch_RVAE/utils/batch_loader.py", line 104, in init self.tensor_files) File "/Users/davis/Downloads/Projects/side-projects/pytorch_RVAE/utils/batch_loader.py", line 224, in load_preprocessed for input_type in tensor_files] File "/Users/davis/Downloads/Projects/side-projects/pytorch_RVAE/utils/batch_loader.py", line 224, in for input_type in tensor_files] File "/Users/davis/Downloads/Projects/side-projects/pytorch_RVAE/utils/batch_loader.py", line 223, in [self.word_tensor, self.character_tensor] = [np.array([np.load(target) for target in input_type]) File "/Users/davis/miniconda3/envs/pytorchRVAE/lib/python3.6/site-packages/numpy/lib/npyio.py", line 447, in load pickle_kwargs=pickle_kwargs) File "/Users/davis/miniconda3/envs/pytorchRVAE/lib/python3.6/site-packages/numpy/lib/format.py", line 692, in read_array raise ValueError("Object arrays cannot be loaded when " ValueError: Object arrays cannot be loaded when allow_pickle=False

davislf2 commented 5 years ago

After a survey, I found that the issue comes from the latest version of numpy (1.16.3). The solution is reinstall numpy to 1.16.2: pip install numpy==1.16.2 Then you can use print(np.__version__) to check whether it's 1.16.2.