Transformers: run_ner.py load checkpoint issue

Created on 21 Dec 2019  路  3Comments  路  Source: huggingface/transformers

Hi,
I just launched the transformers/examples/run_ner.py script with my custom model:
python3 transformers/examples/run_ner.py --data_dir $INPUT_DATA_DIR \ --tokenizer_name $TOKENIZER_FILE_PATH --output_dir $OUTPUT_DIR --model_type camembert --labels $LABELS_DIR --model_name_or_path $BERT_MODEL --max_seq_length $MAX_LENGTH --num_train_epochs $NUM_EPOCHS --gradient_accumulation_steps $ACCUMULATION_STEPS --per_gpu_train_batch_size $BATCH_SIZE --save_steps $SAVE_STEPS --do_lower_case --do_train --do_eval --do_predict

Once the data for the train has been loaded, an error appear:
Traceback (most recent call last): File "transformers/examples/run_ner.py", line 567, in <module> main() File "transformers/examples/run_ner.py", line 496, in main global_step, tr_loss = train(args, train_dataset, model, tokenizer, labels, pad_token_label_id) File "transformers/examples/run_ner.py", line 132, in train global_step = int(args.model_name_or_path.split('-')[-1].split('/')[0]) ValueError: invalid literal for int() with base 10: 'pytorch_dump_folder'

Launching the same script a few hours ago the error did not appear, is it something related to the last updates #2134 ?

Thanks in advance.

wontfix

Most helpful comment

Can confirm this issue -> a temporary workaround would be to change the line to:

if os.path.exists(args.model_name_or_path) and "checkpoint" in args.model_name_or_path:

All 3 comments

Can confirm this issue -> a temporary workaround would be to change the line to:

if os.path.exists(args.model_name_or_path) and "checkpoint" in args.model_name_or_path:

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lcswillems picture lcswillems  路  3Comments

rsanjaykamath picture rsanjaykamath  路  3Comments

zhezhaoa picture zhezhaoa  路  3Comments

lemonhu picture lemonhu  路  3Comments

HansBambel picture HansBambel  路  3Comments