Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: zipfile.BadZipFile: File is not a zip file #1

Open
HamzaGbada opened this issue Mar 31, 2023 · 0 comments
Open

Error: zipfile.BadZipFile: File is not a zip file #1

HamzaGbada opened this issue Mar 31, 2023 · 0 comments

Comments

@HamzaGbada
Copy link

Issue Description:
While running the run.py, an error occurred where the file http://212.129.155.247/embedding/elmo_en_Original.zip was not found in the cache. The script attempted to download the file, but only downloaded a portion of it before encountering an error. When attempting to unzip the downloaded file, the script found that it was not a valid zip file and raised a BadZipFile exception.

Steps to reproduce:

  1. Run the run.py script.

  2. Wait until the script attempts to download the file http://212.129.155.247/embedding/elmo_en_Original.zip.

  3. The error occurs when attempting to unzip the downloaded file.

Error Message:

build dataset: 100% 9/9 [00:00<00:00, 53468.46it/s]
build dataset: 100% 9/9 [00:00<00:00, 69647.11it/s]
http://212.129.155.247/embedding/elmo_en_Original.zip not found in cache, downloading to /tmp/tmpdw911a4u
 47% 163M/347M [1:29:31<1:41:31, 30.3kB/s]
Finish download from http://212.129.155.247/embedding/elmo_en_Original.zip
File is not a zip file
Traceback (most recent call last):
  File "/content/SANER/train_bert_elmo_en.py", line 150, in <module>
    data_bundle, embed, train_feature_data, dev_feature_data, test_feature_data, feature2id, id2feature = load_data()
  File "/content/SANER/fastNLP/core/utils.py", line 155, in wrapper
    results = func(*args, **kwargs)
  File "/content/SANER/train_bert_elmo_en.py", line 139, in load_data
    embed = ElmoEmbedding(vocab=data.get_vocab('chars'), model_dir_or_name=elmo_model, layers='mix', requires_grad=False,
  File "/content/SANER/fastNLP/embeddings/elmo_embedding.py", line 70, in __init__
    model_dir = cached_path(model_url, name='embedding')
  File "/content/SANER/fastNLP/io/file_utils.py", line 171, in cached_path
    return get_from_cache(url_or_filename, Path(data_cache))
  File "/content/SANER/fastNLP/io/file_utils.py", line 425, in get_from_cache
    raise e
  File "/content/SANER/fastNLP/io/file_utils.py", line 396, in get_from_cache
    unzip_file(Path(temp_filename), Path(uncompress_temp_dir))
  File "/content/SANER/fastNLP/io/file_utils.py", line 448, in unzip_file
    with ZipFile(file, "r") as zipObj:
  File "/usr/lib/python3.9/zipfile.py", line 1266, in __init__
    self._RealGetContents()
  File "/usr/lib/python3.9/zipfile.py", line 1333, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file```

**Note:** the download of the file `elmo_en_Original.zip` from `http://212.129.155.247/embedding/elmo_en_Original.zip` takes too much time even with good internet speed, which may corrupted the file. (The averge download speed is `20KB/s`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant