ryankiros / neural-storyteller

A recurrent neural network for generating little stories about images
2.96k stars 539 forks source link

Error in unzipping npz files #46

Closed KhushiGala closed 4 years ago

KhushiGala commented 4 years ago

Code : import generate z = generate.load_all() generate.story(z, './6736732223.jpg')

Output Error: BadZipFile: File is not a zip file


/content/drive/My Drive/ImgCap/romance.npz Loading skip-thoughts...

BadZipFile Traceback (most recent call last)

in () 1 import generate ----> 2 z = generate.load_all() 3 generate.story(z, './6736732223.jpg') 7 frames /content/drive/My Drive/ImgCap/generate.py in load_all() 84 print('Loading skip-thoughts...') 85 stv = skipthoughts.load_model(config.paths['skmodels'], ---> 86 config.paths['sktables']) 87 88 # Decoder /content/drive/My Drive/ImgCap/skipthoughts.py in load_model(path_to_models, path_to_tables) 34 # Load parameters 35 uparams = init_params(uoptions) ---> 36 uparams = load_params(path_to_umodel, uparams) 37 utparams = init_tparams(uparams) 38 bparams = init_params_bi(boptions) /content/drive/My Drive/ImgCap/skipthoughts.py in load_params(path, params) 172 load parameters 173 """ --> 174 pp = numpy.load(path) 175 for kk, vv in params.iteritems(): 176 if kk not in pp: /usr/local/lib/python3.6/dist-packages/numpy/lib/npyio.py in load(file, mmap_mode, allow_pickle, fix_imports, encoding) 442 # Transfer file ownership to NpzFile 443 ret = NpzFile(fid, own_fid=own_fid, allow_pickle=allow_pickle, --> 444 pickle_kwargs=pickle_kwargs) 445 own_fid = False 446 return ret /usr/local/lib/python3.6/dist-packages/numpy/lib/npyio.py in __init__(self, fid, own_fid, allow_pickle, pickle_kwargs) 191 # Import is postponed to here since zipfile depends on gzip, an 192 # optional component of the so-called standard library. --> 193 _zip = zipfile_factory(fid) 194 self._files = _zip.namelist() 195 self.files = [] /usr/local/lib/python3.6/dist-packages/numpy/lib/npyio.py in zipfile_factory(file, *args, **kwargs) 117 import zipfile 118 kwargs['allowZip64'] = True --> 119 return zipfile.ZipFile(file, *args, **kwargs) 120 121 /usr/lib/python3.6/zipfile.py in __init__(self, file, mode, compression, allowZip64) 1129 try: 1130 if mode == 'r': -> 1131 self._RealGetContents() 1132 elif mode in ('w', 'x'): 1133 # set the modified flag so central directory gets written /usr/lib/python3.6/zipfile.py in _RealGetContents(self) 1196 raise BadZipFile("File is not a zip file") 1197 if not endrec: -> 1198 raise BadZipFile("File is not a zip file") 1199 if self.debug > 1: 1200 print(endrec) BadZipFile: File is not a zip file How can we Solve this ?