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

loading pytorch_model.bin #22

Closed
sanjayb678 opened this issue Jul 17, 2020 · 2 comments
Closed

loading pytorch_model.bin #22

sanjayb678 opened this issue Jul 17, 2020 · 2 comments

Comments

@sanjayb678
Copy link

sanjayb678 commented Jul 17, 2020

I downloaded and placed the language model (pytorch_model.bin) and config.json in the same directory and when i run the piece of code: configuring training parameters, get below error:

INFO - pytorch_pretrained_bert.modeling - loading archive file /directory/pytorch_model.bin
INFO - pytorch_pretrained_bert.modeling - extracting archive file /directory/pytorch_model.bin to temp dir /tmp/tmppjpupb
Readerror: not a gzip file

Looking more granular:
/usr/lib/python3.6/tarfile.py in gzopen(cls, name, mode, fileobj, compresslevel, **kwargs)
1645 fileobj.close()
1646 if mode == 'r':
-> 1647 raise ReadError("not a gzip file")
1648 raise
1649 except:

@drk3931
Copy link

drk3931 commented Aug 5, 2020

zip the bin file and config.json into a .tar.gz file
or alternatively you can put them into a directory and turn cache_dir on
model = BertForSequenceClassification.from_pretrained('./location_of_bin/',num_labels=3,cache_dir=True)

@HartBlanc
Copy link

It could be useful to include this in README.md under ##models

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

4 participants