传递参数后最后显示的错误是main.py: error: unrecognized arguments: --visual_element_choice story。查了半天没有解决,大神知道这应该怎么改吗?
**-desktop:~/newspace2/znq/PR_VIST_main/story_plotting/script$ bash run_generation.sh
(--train | --test | --generation) [--emb_size EMB_SIZE]
[--path PATH] [--epoch_num EPOCH_NUM]
[--hidden_size HIDDEN_SIZE] [--num_filters NUM_FILTERS]
[--neg_sample NEG_SAMPLE] [--dropout_rate DROPOUT_RATE]
[--learning_rate LEARNING_RATE] [--optimizer OPTIMIZER]
[--l2_norm L2_NORM] [--earlystop_tolerance EARLYSTOP_TOLERANCE]
[--margin MARGIN] [--train_step_1_only TRAIN_STEP_1_ONLY]
[--train_rela_choose_only TRAIN_RELA_CHOOSE_ONLY]
[--show_result SHOW_RESULT] [--train_embedding TRAIN_EMBEDDING]
[--log_result LOG_RESULT] [--dataset DATASET]
[--saved_dir SAVED_DIR] [--hop_weight HOP_WEIGHT]
[--task_weight TASK_WEIGHT] [--acc_weight ACC_WEIGHT]
[--stop_when_err] [--step_every_step] [--dynamic DYNAMIC]
[--only_one_hop] [--reduce_method REDUCE_METHOD]
[--pretrained_bert PRETRAINED_BERT]
[--q_representation Q_REPRESENTATION] [--device DEVICE]
[--occurrence OCCURRENCE] [--path_search]
[--termset_sample_size TERMSET_SAMPLE_SIZE]
[--sample_size SAMPLE_SIZE] [--abs_position] [--ethan_position]
[--is_sampling] [--recurrent_UHop]
[--term_path {AAAI,new_obj,noun_only}] [--force_one_noun]
[--story_noun_query] [--is_image_abs_position]
[--is_seperate_structural] [--is_term_only]
[--file_type FILE_TYPE] [--is_story_noun_candidate]
[--constant_padding] [--rela_size RELA_SIZE]
[--rela_text_size RELA_TEXT_SIZE] [--prepend] [--small]
[--only_five_sentences] [--only_four2six_sentences]
[--repetitve_penalty REPETITVE_PENALTY] [--ten_obj]
[--is_KG_only] [--no_reverse] [--is_restrict_vocab]
[--empty_frame_penalty EMPTY_FRAME_PENALTY]
[--is_start_end_frame] [--relation_frequency {10,20,30}]
[--is_beam_search_graph] [--only_five2seven_sentences]
[--only_six2seven_sentences] [--over5]
[--graph_choice {multi-graph,vg-graph,vist-graph}]
main.py: error: unrecognized arguments: --visual_element_choice story【以下回答由 GPT 生成】
这个错误是由于main.py脚本中没有定义--visual_element_choice
参数导致的。要解决这个错误,你可以按照以下步骤进行操作:
import argparse
。argparse.ArgumentParser()
的实例化部分,通常是: python parser = argparse.ArgumentParser()
parser
对象下添加一个--visual_element_choice
参数的定义。 python parser.add_argument('--visual_element_choice', type=str, help='description of the visual element choice argument')
更换'description of the visual element choice argument'
为实际的参数描述。bash python3 ../src/main.py --model HR_BiLSTM_plus --dataset vist --framework UHop --earlystop_tolerance 20 --saved_dir saved_model --dynamic none --reduce_method dense --emb_size 300 --hidden_size 150 --dropout_rate 0.2 --optimizer rmsprop --neg_sample 1024 --l2_norm 0.0 --margin 0.5 --hop_weight 1 --task_weight 1 --acc_weight 1 --q_representation lstm --generation --path ../story_plotting/HR_BiLSTM_plus_36 --path_search --termset_sample_size 1000 --sample_size 40 --device 1 --term_path new_obj --file_type test --is_image_abs_position --repetitve_penalty 0.9 --empty_frame_penalty 1.0 --relation_frequency 10 --is_restrict_vocab --only_five2seven_sentences --graph_choice multi-graph --visual_element_choice story
这样,你的命令应该就能正常运行了。