keras dataset_(data) Error

Published by onesixx on

Error

> dataset_imdb(num_words=10000) 
 Error in py_call_impl(callable, dots$args, dots$keywords) : 
  ValueError: Object arrays cannot be loaded when allow_pickle=False 

새로운 conda 환경

numpy을 삭제후, 버전을 downgrade한 버전을 설치
원하는 Dataset을 저장해 둔다.

 $➜ conda-env list
 $➜ conda create --name sixxGetData python=3.6
 $➜ conda activate sixxGetData
 $➜ conda list
 $➜ conda uninstall numpy
 $➜ conda install --update-all numpy==1.16.1
library(reticulate)
library(keras)
Sys.setenv(RETICULATE_PYTHON_ENV='sixxGetData')
Sys.setenv(RETICULATE_PYTHON=file.path("~/Library/r-miniconda/envs","sixxGetData","bin/python"))
use_condaenv(condaenv='sixxGetData', required=T)

### ### imdb ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### 에러 없이 Dataset loading
imdb <- dataset_imdb(num_words=10000) 
### 해당 Dataset 저장해 두기
imdb %>% saveRDS("~/DATA/DL/imdb.RData")
### 다른 conda 환경에서 읽어오기 
imdb <- readRDS("~/DATA/DL/imdb.RData")


### gdrive에 넣어 두고 사용하기 
# dataURL = "https://drive.google.com/file/d/1EXaQ_OsIFBYbyE6HQA-vQUa7kEP5srqJ/view?usp=sharing"
# pacman::p_load(googledrive)
# tmp <- tempfile()
# dl <- drive_download(dataURL, path=tmp, overwrite=T)
# #dl <- drive_download(as_id("1EXaQ_OsIFBYbyE6HQA-vQUa7kEP5srqJ"), path=tmp, overwrite=T)
# imdb <- readRDS(tmp)
#rm(dataURL, tmp, dl)
library(reticulate)
library(keras)
Sys.setenv(RETICULATE_PYTHON_ENV='sixxGetData')
Sys.setenv(RETICULATE_PYTHON=file.path("~/Library/r-miniconda/envs","sixxGetData","bin/python"))
use_condaenv(condaenv='sixxGetData', required=T)

### ### imdb ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### 에러 없이 Dataset loading
reuters <- dataset_reuters(num_word=10000)
### 해당 Dataset 저장해 두기
reuters %>% saveRDS("~/DATA/DL/imdb.RData")
### 다른 conda 환경에서 읽어오기 
reuters <- readRDS("~/DATA/DL/imdb.RData")

Categories: Keras

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x