allenai / scibert

A BERT model for scientific text.
https://arxiv.org/abs/1903.10676
Apache License 2.0
1.47k stars 214 forks source link

How to use fine tuned model trained on a machine to predict on another #82

Closed raylite closed 4 years ago

raylite commented 4 years ago

I have a scibert model finetuned on my Linux machine..... Due to the lock down I sopied the model and wanted to use it for prediction on another Windows machine.

However, it keeps referring to paths on my Linux machine where it was initially used for prediction as shown:

2020-04-09 15:27:43,593 - INFO - allennlp.common.from_params - instantiating class <class 'allennlp.modules.token_embedders.bert_token_embedder.PretrainedBertEmbedder'> from params {'pretrained_model': '/home/xxxx/scibert/scibert_scivocab_uncased/weights.tar.gz'} and extras {'vocab'}

This now genarated the error:

ERROR - pytorch_pretrained_bert.modeling - Model name '/home/xxxx/scibert/scibert_scivocab_uncased/weights.tar.gz' was not found in model name list (bert-base-uncased, bert-large-uncased, bert-base-cased, bert-large-cased, bert-base-multilingual-uncased, bert-base-multilingual-cased, bert-base-chinese). We assumed '/home/xxxx/scibert/scibert_scivocab_uncased/weights.tar.gz' was a path or url but couldn't find any file associated to this path or url.

I have tried to set the new windows path for BERT_WEIGHTS and BERT_VOCABS using the Windows set command but the error still persists.

What do I need to do, to change where allennlp look for the weights and vocab files.

Thank you