-
Notifications
You must be signed in to change notification settings - Fork 445
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
Load Biobert pre-trained weights into Bert model with Pytorch bert hugging face run_classifier.py code #26
Comments
Hi @sheetalsh456, I had the same issue until I placed the correct files under one folder. I wrote instructions for myself here, if you want to take a look and see if they solve your issue. |
Hi, we've updated our weights not to contain parameters of the optimizer. You can download them again, and please tell us what you get. |
Hi @JohnGiorgi , I followed your instructions here to convert the checkpoint and then placing the files (pytorch_model.bin, bert_config.json, and vocab.txt) in one folder to compress it. I copied the compressed folder to the home folder of 'pytorch-transformers'. Then I ran the following command from there itself to run the example code ('run_glue.py') that has been given Then, I am trying to run the example code given by running the following command,
But, I get the same error as mentioned in the main discussion:
at this location:
Can you please tell what to change. |
@nikhilsid Can you try unzipping it, and point Also, I believe that in If that fails, I have converted BioBERT V1.1 PubMed and placed the weights here. I was able to load this model with from pytorch_transformers import BertForTokenClassification
self.model = BertForTokenClassification.from_pretrained('path/to/biobert_v1.1/unzipped') |
@JohnGiorgi Thanks a lot for replying. I tried unzipping and pointing everything to that. But now I get the following error.
where, I have kept all the The other two files |
@nikhilsid Hmm. I am not sure. Did you try using the weights I referenced in my last comment? (here). I am able to use those across multiple machines without issue Otherwise, have you tried browsing the |
These are the steps I followed to get Biobert working with the existing Bert hugging face pytorch code.
I downloaded the pre-trained weights 'biobert_pubmed_pmc.tar.gz' from the Releases page.
I ran this command to convert the tf checkpoint to pytorch model
This created a file 'biobert.model' in the specified path.
As mentioned in this link , I compressed 'biobert.model' created above and 'biobert/pubmed_pmc_470k/bert_config.json' together into a biobert_model.tar.gz
I then ran the run_classifier.py of hugging face bert with the following command, using the tar.gz created above.
I get the error
in the line
Am I doing something wrong?
I just wanted to run run_classifier.py code provided by hugging face with biobert pretrained weights in the same way that we run bert with it. Is there a way to do this?
The text was updated successfully, but these errors were encountered: