nlp-uoregon / trankit

Trankit is a Light-Weight Transformer-based Python Toolkit for Multilingual Natural Language Processing
Apache License 2.0
724 stars 99 forks source link

Hebrew link is broken #54

Closed talbaumel closed 10 months ago

talbaumel commented 2 years ago

Hi, thanks for the great resource!

Link to Hebrew model seems to be broken


BadZipFile                                Traceback (most recent call last)
Input In [59], in <cell line: 3>()
      1 from trankit import Pipeline
----> 3 p = Pipeline(lang='hebrew', gpu=False, cache_dir='./cache')

File ~/opt/anaconda3/envs/ayalon/lib/python3.9/site-packages/trankit/pipeline.py:70, in Pipeline.__init__(self, lang, cache_dir, gpu, embedding)
     66     assert lang in lang2treebank, '{} has not been supported. Currently supported languages: {}'.format(lang,
     67                                                                                                         list(
     68                                                                                                             lang2treebank.keys()))
     69 # download saved model for initial language
---> 70 download(
     71     cache_dir=self._config._cache_dir,
     72     language=lang,
     73     saved_model_version=saved_model_version,  # manually set this to avoid duplicated storage
     74     embedding_name=master_config.embedding_name
     75 )
     77 # load ALL vocabs
     78 self._load_vocabs()

File ~/opt/anaconda3/envs/ayalon/lib/python3.9/site-packages/trankit/utils/base_utils.py:114, in download(cache_dir, language, saved_model_version, embedding_name)
    112         file.write(data)
    113 progress_bar.close()
--> 114 unzip(lang_dir, '{}.zip'.format(language))
    115 if total_size_in_bytes != 0 and progress_bar.n != total_size_in_bytes:
    116     print("Failed to download saved models for {}!".format(language))

File ~/opt/anaconda3/envs/ayalon/lib/python3.9/site-packages/trankit/utils/base_utils.py:89, in unzip(dir, filename)
     88 def unzip(dir, filename):
---> 89     with zipfile.ZipFile(os.path.join(dir, filename)) as f:
     90         f.extractall(dir)
     91     os.remove(os.path.join(dir, filename))

File ~/opt/anaconda3/envs/ayalon/lib/python3.9/zipfile.py:1266, in ZipFile.__init__(self, file, mode, compression, allowZip64, compresslevel, strict_timestamps)
   1264 try:
   1265     if mode == 'r':
-> 1266         self._RealGetContents()
   1267     elif mode in ('w', 'x'):
   1268         # set the modified flag so central directory gets written
   1269         # even if no files are added to the archive
   1270         self._didModify = True

File ~/opt/anaconda3/envs/ayalon/lib/python3.9/zipfile.py:1333, in ZipFile._RealGetContents(self)
   1331     raise BadZipFile("File is not a zip file")
   1332 if not endrec:
-> 1333     raise BadZipFile("File is not a zip file")
   1334 if self.debug > 1:
   1335     print(endrec)

BadZipFile: File is not a zip file```
minhhdvn commented 10 months ago

Hi @talbaumel , Thanks for reporting the issue. We checked the model package for Hebrew and there was no issue. It might be the case that the server for downloading the model package was down at the time.