I run python ./eval.py --generate runs/sgpt/lcquad2/ --dataset lcquad2 --generation_params_file config/gpt-2-base/generation_params.json --eval_dataset test --output_file outputs/predictions_gpt2-base.json on the root of project, and the output is:
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
11/02/2023 12:25:00 - INFO - eval.py:268 : Generation parameters Namespace(checkpoint='runs/sgpt/lcquad2/', generate=True, eval_partial=False, masked=False, decode='basic', dataset='lcquad2', knowledge=False, generation_params_file='config/gpt-2-base/generation_params.json', dataroot='data', eval_dataset='test', output_file='outputs/predictions_gpt2-base.json', eval_desc='', device=device(type='cuda', index=0), local_rank=-1, params_file='runs/sgpt/lcquad2/params.json', dataset_args={'input_max_tokens': 50, 'knowledge_max_tokens': 50, 'dataroot': 'data', 'negative_sample_method': 'all'}, task='generation', model_name_or_path='gpt2', per_gpu_train_batch_size=4, per_gpu_eval_batch_size=4, gradient_accumulation_steps=4, learning_rate=6.25e-05, adam_epsilon=1e-08, max_grad_norm=1, num_train_epochs=-1, warmup_steps=0, fp16='', seed=42, no_sample=False, min_length=1, max_length=120, temperature=0.5, top_k=5, top_p=0.9, params={'dataset_args': {'input_max_tokens': 50, 'knowledge_max_tokens': 50, 'dataroot': 'data', 'negative_sample_method': 'all'}, 'task': 'generation', 'model_name_or_path': 'gpt2', 'per_gpu_train_batch_size': 4, 'per_gpu_eval_batch_size': 4, 'gradient_accumulation_steps': 4, 'learning_rate': 6.25e-05, 'adam_epsilon': 1e-08, 'max_grad_norm': 1, 'num_train_epochs': -1, 'warmup_steps': 0, 'fp16': '', 'seed': 42}, distributed=False, n_gpu=1, output_dir='runs/sgpt/lcquad2/')
Creating examples
100%|██████████| 5969/5969 [00:02<00:00, 2066.70it/s]
Evaluating: 0%| | 0/5969 [00:00<?, ?it/s]11/02/2023 12:25:08 - WARNING - model.py:717 : Warning: model generating special token with probability 1! Breaking...
Evaluating: 0%| | 1/5969 [00:04<7:56:55, 4.79s/it]Truth: select distinct ?sbj where { ?sbj wdt:P35 wd:Q127998 . ?sbj wdt:P31 wd:Q6256 }
Predt:
The predicted query statement of the first sample is empty, and the second prediction will stuck on following codes in model.py at line 715:
while prev.item() in special_tokens_ids:
if probs.max().item() == 1:
logger.warning("Warning: model generating special token with probability 1! Breaking...")
break
prev = torch.multinomial(probs, num_samples=1)
Variable prev will always be tensor([50257], device='cuda:0'). How to fix it?
I run
python ./eval.py --generate runs/sgpt/lcquad2/ --dataset lcquad2 --generation_params_file config/gpt-2-base/generation_params.json --eval_dataset test --output_file outputs/predictions_gpt2-base.json
on the root of project, and the output is:The predicted query statement of the first sample is empty, and the second prediction will stuck on following codes in
model.py
at line 715:Variable
prev
will always betensor([50257], device='cuda:0')
. How to fix it?