tricktreat / PromptNER

Code for the paper "PromptNER: Prompt Locating and Typing for Named Entity Recognition", accepted at ACL 2023.
85 stars 7 forks source link

求助,使用conf文件解析,GPU不能正常启用 #12

Closed Buffalo-q closed 2 weeks ago

Buffalo-q commented 7 months ago

python prompt4ner.py train --config "/hy-tmp/PromptNER-main/configs/bert/conll2003.conf"

Config: Namespace(boundary_threshold=0.0, cache_path=None, cls_threshold=0.0, config='/hy-tmp/PromptNER-main/configs/bert/conll2003.conf', cpu=False, debug=False, decoder_layers=3, deeply_weight='linear', device_id=0, epochs=50, eval_batch_size=16, eval_every_epochs=1, example_count=None, final_eval=False, freeze_transformer=False, init_eval=False, label='conll03_train', last_layer_for_loss=1, local_rank=-1, log_path='data/checkpoint', loss_boundary_weight=2.0, loss_class_weight=2.0, lowercase=False, lr=2e-05, lr_warmup=0.1, lstm_layers=3, match_boundary_weight=2.0, match_class_weight=2.0, match_solver='hungarian', match_warmup_epoch=0, max_grad_norm=1.0, model_path='bert-large-cased', model_type='prompt4ner', nil_weight=-1.0, no_duplicate=True, no_overlapping=True, no_partial_overlapping=True, pool_type='max', prompt_individual_attention=False, prompt_length=2, prompt_number=50, prompt_type='soft', prop_drop=0.5, repeat_gt_entities=45, sampling_processes=4, save_optimizer=False, save_path='data/checkpoint', save_path_include_iteration=False, seed=47, sentence_individual_attention=True, split_epoch=5, stage_one_lr_scale=1.5, store_examples=False, store_predictions=False, tokenizer_path='bert-large-cased', train_batch_size=8, train_log_iter=1, train_path='data/datasets/conll03/conll03_train_dev_context@2.json', type_loss='celoss', types_path='data/datasets/conll03/conll03_types.json', use_masked_lm=False, valid_path='data/datasets/conll03/conll03_dev_context@2.json', weight_decay=0.01, withimage=False, world_size=-1) Repeat 1 times

Iteration 0

{} Need 1 GPU for Normal Training, All are busy. Waiting for Free GPU ...... 报错,确定使用GPU且安装了torch1.10.1+cu111,仍然显示GPU在忙, 十分感谢

QianGuYiDi commented 2 weeks ago

python prompt4ner.py train --config "/hy-tmp/PromptNER-main/configs/bert/conll2003.conf"

Config:

Namespace(boundary_threshold=0.0, cache_path=None, cls_threshold=0.0, config='/hy-tmp/PromptNER-main/configs/bert/conll2003.conf', cpu=False, debug=False, decoder_layers=3, deeply_weight='linear', device_id=0, epochs=50, eval_batch_size=16, eval_every_epochs=1, example_count=None, final_eval=False, freeze_transformer=False, init_eval=False, label='conll03_train', last_layer_for_loss=1, local_rank=-1, log_path='data/checkpoint', loss_boundary_weight=2.0, loss_class_weight=2.0, lowercase=False, lr=2e-05, lr_warmup=0.1, lstm_layers=3, match_boundary_weight=2.0, match_class_weight=2.0, match_solver='hungarian', match_warmup_epoch=0, max_grad_norm=1.0, model_path='bert-large-cased', model_type='prompt4ner', nil_weight=-1.0, no_duplicate=True, no_overlapping=True, no_partial_overlapping=True, pool_type='max', prompt_individual_attention=False, prompt_length=2, prompt_number=50, prompt_type='soft', prop_drop=0.5, repeat_gt_entities=45, sampling_processes=4, save_optimizer=False, save_path='data/checkpoint', save_path_include_iteration=False, seed=47, sentence_individual_attention=True, split_epoch=5, stage_one_lr_scale=1.5, store_examples=False, store_predictions=False, tokenizer_path='bert-large-cased', train_batch_size=8, train_log_iter=1, train_path='data/datasets/conll03/conll03_train_dev_context@2.json', type_loss='celoss', types_path='data/datasets/conll03/conll03_types.json', use_masked_lm=False, valid_path='data/datasets/conll03/conll03_dev_context@2.json', weight_decay=0.01, withimage=False, world_size=-1) Repeat 1 times

Iteration 0

{} Need 1 GPU for Normal Training, All are busy. Waiting for Free GPU ...... 报错,确定使用GPU且安装了torch1.10.1+cu111,仍然显示GPU在忙, 十分感谢

我也遇到了相同的问题,想问一下作者该怎样解决?

tricktreat commented 2 weeks ago

你好,这行代码对训练时最小显存做了限制,你可以调小一些。

https://github.com/tricktreat/PromptNER/blob/3857235fce0844a8441af9a6ef9b03ec619ce575/config_reader.py#L53

QianGuYiDi commented 2 weeks ago

你好,这行代码对训练时最小显存做了限制,你可以调小一些。

https://github.com/tricktreat/PromptNER/blob/3857235fce0844a8441af9a6ef9b03ec619ce575/config_reader.py#L53

非常感谢您的回复