Transformers: Training BERT behind a proxy server

Created on 29 Jan 2019  路  6Comments  路  Source: huggingface/transformers

When I try to run BERT training, I get the following error during the vocabulary download:

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='s3.amazonaws.com', port=443): Max retries exceeded with url: /models.huggingface.co/bert/bert-large-uncased-vocab.txt (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 110] Connection timed out'))

I am running the script behind a proxy server which I suspect is the cause of this error. Is there any way to remedy this?

Most helpful comment

Hi tomwolf,

I am new to XLNet and have the same issue as above.

Could you direct me to the readme of the issue? I am not able to find it.

I modified my code to resolve the issue to

model_file_address = '/myfolder/XLNetWork/xlnet-base-cased-config.json'

But I get the below error on the line :
model = XLNetForSequenceClassification.from_pretrained(model_file_address,num_labels=len(tag2idx))

Error:
UnpicklingError: invalid load key, '{'.

I am pretty much stucked.

Your help will be appreciated.

Thanks,

Saul

All 6 comments

You can download the Tensorflow weights from Google's BERT repo and convert them as detailed in the readme of the present repo.

Hi tomwolf,

I am new to XLNet and have the same issue as above.

Could you direct me to the readme of the issue? I am not able to find it.

I modified my code to resolve the issue to

model_file_address = '/myfolder/XLNetWork/xlnet-base-cased-config.json'

But I get the below error on the line :
model = XLNetForSequenceClassification.from_pretrained(model_file_address,num_labels=len(tag2idx))

Error:
UnpicklingError: invalid load key, '{'.

I am pretty much stucked.

Your help will be appreciated.

Thanks,

Saul

@SaulML Did you solve it? I got the same error, i.e. UnpicklingError: invalid load key, '{'., when I tried to load pretrained bert using model = BertForSequenceClassification.from_pretrained("/PathToBert/uncased_L-12_H-768_A-12/bert_config.json", num_labels=2), thanks in advance!

You can now supply a proxies argument to from_pretrained when you are using proxies.
Check the doc and docstrings.

Got the same error as @SaulML and @iamxpy. Has anyone solved it?

Got the same unpickling error. Was it solved?

Was this page helpful?
0 / 5 - 0 ratings