[Bug] Download Model Error
Gaoustcer opened this issue · 3 comments
🐛 Description
When I call get_pretrained_i2v()
for the first time, the EduNLP will download model for me automatically.However, the model.zip file does not work when the program try to extract it.
Error Message
downloader, INFO http://base.ustc.edu.cn/data/model_zoo/EduNLP/d2v/general_all_256.zip is saved as /root/.EduNLP/model/general_all_256.zip
downloader, INFO /root/.EduNLP/model/general_all_256.zip already exists. Send resume request after 3.56KB
Downloading /root/.EduNLP/model/general_all_256.zip 100.00%: 5.15GB | 5.15GB
downloader, INFO /root/.EduNLP/model/general_all_256.zip is unzip to /root/.EduNLP/model/general_all_256
Traceback (most recent call last):
File "Annoy.py", line 70, in
Annoy_inst = Annoy('d2v_all_256',10)
File "Annoy.py", line 27, in init
self.i2v = get_pretrained_i2v(i2v)
File "/usr/local/lib/python3.6/dist-packages/EduNLP-0.0.5-py3.6.egg/EduNLP/I2V/i2v.py", line 122, in get_pretrained_i2v
return _class.from_pretrained(*params, model_dir=model_dir)
File "/usr/local/lib/python3.6/dist-packages/EduNLP-0.0.5-py3.6.egg/EduNLP/I2V/i2v.py", line 93, in from_pretrained
return cls("text", name, pretrained_t2v=True, model_dir=model_dir)
File "/usr/local/lib/python3.6/dist-packages/EduNLP-0.0.5-py3.6.egg/EduNLP/I2V/i2v.py", line 35, in init
self.t2v = get_t2v_pretrained_model(t2v, kwargs.get("model_dir", MODEL_DIR))
File "/usr/local/lib/python3.6/dist-packages/EduNLP-0.0.5-py3.6.egg/EduNLP/Vector/t2v.py", line 54, in get_pretrained_t2v
model_path = get_data(url, model_dir)
File "/usr/local/lib/python3.6/dist-packages/EduData/DataSet/download_data/download_data.py", line 223, in get_data
return download_data(url, data_dir, override)
File "/usr/local/lib/python3.6/dist-packages/EduData/DataSet/download_data/download_data.py", line 190, in download_data
_data_dir = download_file(url, save_path, override)
File "/usr/local/lib/python3.6/dist-packages/EduData/DataSet/download_data/download_data.py", line 161, in download_file
return decompress(save_path)
File "/usr/local/lib/python3.6/dist-packages/EduData/DataSet/download_data/utils.py", line 17, in decompress
return un_zip(file)
File "/usr/local/lib/python3.6/dist-packages/EduData/DataSet/download_data/utils.py", line 37, in un_zip
zip_file.extract(name, uz_path)
File "/usr/lib/python3.6/zipfile.py", line 1507, in extract
return self._extract_member(member, path, pwd)
File "/usr/lib/python3.6/zipfile.py", line 1577, in _extract_member
with self.open(member, pwd=pwd) as source,
File "/usr/lib/python3.6/zipfile.py", line 1396, in open
raise BadZipFile("Bad magic number for file header")
zipfile.BadZipFile: Bad magic number for file header
To Reproduce
Steps to reproduce
(Paste the commands you ran that produced the error.)
1.delete the model in ~/.EduNLP/model/
2.rerun get_pretrained_i2v()
What have you tried to solve it?
run following command in bash
1.wget http://base.ustc.edu.cn/data/model_zoo/EduNLP/d2v/general_all_256.zip
2.mv general_all_256.zip ~/.EduNLP/model
then extract the zip file,success
Environment
Environment Information
Operating System: Description: Ubuntu 18.04.5 LTS
Python Version: (e.g., python3.6, anaconda/python3.7, venv/python3.8) python3.6.9
Maybe @KenelmQLH can have a look?
@Gaoustcer Thanks for your issue, however, the models work well in my check. (my lcoal environment is Python3.6, EduNLP(0.0.5) and EduData(0.0.16) )
From the error log you provided, it seems that the zip file is damaged, please delete it and try again. Or you can test another model like english and literal etc.