lonePatient / Bert-Multi-Label-Text-Classification

This repo contains a PyTorch implementation of a pretrained BERT model for multi-label text classification.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid file: training_args.bin

chmille3 opened this issue · comments

Hello,

Great project :)

I believe I have everything set-up but when I run: python3 run_bert.py --do_data
I get the following error:

Traceback (most recent call last):
File "run_bert.py", line 229, in
main()
File "run_bert.py", line 205, in main
torch.save(args, config['checkpoint_dir'] / 'training_args.bin')
File "/home/chmille3/.local/lib/python3.5/site-packages/torch/serialization.py", line 224, in save
return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol))
File "/home/chmille3/.local/lib/python3.5/site-packages/torch/serialization.py", line 147, in _with_file_like
f = open(f, mode)
TypeError: invalid file: PosixPath('pybert/output/checkpoints/bert/training_args.bin')

Shouldn't the training_args.bin file get created the first time it is run? If not, where does it come from? Thanks for your help and time!

@chmille3 my python version is 3.6 and torch version is 1.0.0,, it support pathlib.Path ,maybe you should use torch.save(args, str(config['checkpoint_dir'] / 'training_args.bin'))