You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One can also provide a vocab.txt/vocab.txt.gz file in the same directory: a one-word-per-line vocabulary of words to be cached (as character id representations) before inference. Even if it is not present at all, ELMo will still process all words normally. However, providing the vocabulary file can slightly increase inference speed when working with very large corpora (by reducing the amount of word to char ids conversions).
However, when I tried to load the model with the zip file it shows the following error:
File ~\anaconda3\envs\python_old\lib\zipfile.py:1475, in ZipFile.read(self, name, pwd)
1473 def read(self, name, pwd=None):
1474 """Return file bytes for name."""
-> 1475 with self.open(name, "r", pwd) as fp:
1476 return fp.read()
File ~\anaconda3\envs\python_old\lib\zipfile.py:1514, in ZipFile.open(self, name, mode, pwd, force_zip64)
1511 zinfo._compresslevel = self.compresslevel
1512 else:
1513 # Get info object for name
-> 1514 zinfo = self.getinfo(name)
1516 if mode == 'w':
1517 return self._open_to_write(zinfo, force_zip64=force_zip64)
File ~\anaconda3\envs\python_old\lib\zipfile.py:1441, in ZipFile.getinfo(self, name)
1439 info = self.NameToInfo.get(name)
1440 if info is None:
-> 1441 raise KeyError(
1442 'There is no item named %r in the archive' % name)
1444 return info
KeyError: "There is no item named 'vocab.txt' in the archive"
I used python version 3.8.16 in jupyter notebook. The function model.load() doesn't work when there is no 'vocab.txt' in the archive.
The text was updated successfully, but these errors were encountered:
In the README file, it says the following:
One can also provide a vocab.txt/vocab.txt.gz file in the same directory: a one-word-per-line vocabulary of words to be cached (as character id representations) before inference. Even if it is not present at all, ELMo will still process all words normally. However, providing the vocabulary file can slightly increase inference speed when working with very large corpora (by reducing the amount of word to char ids conversions).
However, when I tried to load the model with the zip file it shows the following error:
KeyError Traceback (most recent call last)
Cell In[57], line 1
----> 1 model.load('./elmo-english.zip')
File ~\anaconda3\envs\python_old\lib\site-packages\simple_elmo\elmo_helpers.py:84, in ElmoModel.load(self, directory, max_batch_size, limit, full)
80 raise SystemExit(
81 "Error: loading models from ZIP archives requires Python >= 3.7."
82 )
83 zf = zipfile.ZipFile(directory)
---> 84 vocab_file = zf.read("vocab.txt").decode("utf-8")
85 options_file = zf.read("options.json").decode("utf-8")
86 weight_file = zf.open("model.hdf5")
File ~\anaconda3\envs\python_old\lib\zipfile.py:1475, in ZipFile.read(self, name, pwd)
1473 def read(self, name, pwd=None):
1474 """Return file bytes for name."""
-> 1475 with self.open(name, "r", pwd) as fp:
1476 return fp.read()
File ~\anaconda3\envs\python_old\lib\zipfile.py:1514, in ZipFile.open(self, name, mode, pwd, force_zip64)
1511 zinfo._compresslevel = self.compresslevel
1512 else:
1513 # Get info object for name
-> 1514 zinfo = self.getinfo(name)
1516 if mode == 'w':
1517 return self._open_to_write(zinfo, force_zip64=force_zip64)
File ~\anaconda3\envs\python_old\lib\zipfile.py:1441, in ZipFile.getinfo(self, name)
1439 info = self.NameToInfo.get(name)
1440 if info is None:
-> 1441 raise KeyError(
1442 'There is no item named %r in the archive' % name)
1444 return info
KeyError: "There is no item named 'vocab.txt' in the archive"
I used python version 3.8.16 in jupyter notebook. The function
model.load()
doesn't work when there is no 'vocab.txt' in the archive.The text was updated successfully, but these errors were encountered: