Package: dialogpt2
StatementI transformed thisnotebookinto a package.RequirementsInstallhuggingface:)Install this repopip install dialogpt2UsageThere are two scripts and a class.Train$dialogpt2-train--help
usage:dialogpt2-train[-h]--input_fileINPUT_FILE[--line_sepLINE_SEP][--qa_sepQA_SEP][--output_dirOUTPUT_DIR][--model_name_or_pathMODEL_NAME_OR_PATH][--config_nameCONFIG_NAME][--tokenizer_nameTOKENIZER_NAME][--cache_dirCACHE_DIR][--block_sizeBLOCK_SIZE][--do_train][--do_eval][--evaluate_during_training][--per_gpu_train_batch_sizePER_GPU_TRAIN_BATCH_SIZE][--per_gpu_eval_batch_sizePER_GPU_EVAL_BATCH_SIZE][--gradient_accumulation_stepsGRADIENT_ACCUMULATION_STEPS][--learning_rateLEARNING_RATE][--weight_decayWEIGHT_DECAY][--adam_epsilonADAM_EPSILON][--max_grad_normMAX_GRAD_NORM][--num_train_epochsNUM_TRAIN_EPOCHS][--max_stepsMAX_STEPS][--warmup_stepsWARMUP_STEPS][--logging_stepsLOGGING_STEPS][--save_stepsSAVE_STEPS][--save_total_limitSAVE_TOTAL_LIMIT][--eval_all_checkpoints][--no_cuda][--overwrite_output_dir][--overwrite_cache][--should_continue][--seedSEED][--local_rankLOCAL_RANK][--fp16][--fp16_opt_levelFP16_OPT_LEVEL]optionalarguments:-h,--helpshowthishelpmessageandexit--input_fileINPUT_FILE,-iINPUT_FILEInputfileisalistlinesthatcontainasinglequestionandasingleanswer.--line_sepLINE_SEPLineseparationtoken--qa_sepQA_SEPTokenthatseparatesquestionwithananswer--output_dirOUTPUT_DIROutput-dirofthemodel--model_name_or_pathMODEL_NAME_OR_PATH--config_nameCONFIG_NAME--tokenizer_nameTOKENIZER_NAME--cache_dirCACHE_DIR--block_sizeBLOCK_SIZE--do_train--do_eval--evaluate_during_training--per_gpu_train_batch_sizePER_GPU_TRAIN_BATCH_SIZE--per_gpu_eval_batch_sizePER_GPU_EVAL_BATCH_SIZE--gradient_accumulation_stepsGRADIENT_ACCUMULATION_STEPS--learning_rateLEARNING_RATE--weight_decayWEIGHT_DECAY--adam_epsilonADAM_EPSILON--max_grad_normMAX_GRAD_NORM--num_train_epochsNUM_TRAIN_EPOCHS--max_stepsMAX_STEPS--warmup_stepsWARMUP_STEPS--logging_stepsLOGGING_STEPS--save_stepsSAVE_STEPS--save_total_limitSAVE_TOTAL_LIMIT--eval_all_checkpoints--no_cuda--overwrite_output_dir--overwrite_cache--should_continue--seedSEED--local_rankLOCAL_RANK--fp16--fp16_opt_levelFP16_OPT_LEVELGen$dialogpt2-gen-i--help
usage:dialogpt2-gen[-h](--questionQUESTION|--questions-fileQUESTIONS_FILE|--interactive)[--num_outputsNUM_OUTPUTS][--cuda-deviceCUDA_DEVICE][--model_name_or_pathMODEL_NAME_OR_PATH][--use_context][--reset_context_on_iter]optionalarguments:-h,--helpshowthishelpmessageandexit--questionQUESTION,-qQUESTIONAsinglequestion.--questions-fileQUESTIONS_FILE,-qfQUESTIONS_FILEQuestionsseparatedbyalinebreakcharacter.--interactive,-iTalkwithit!--num_outputsNUM_OUTPUTS,-nNUM_OUTPUTS--cuda-deviceCUDA_DEVICE,-cCUDA_DEVICE--model_name_or_pathMODEL_NAME_OR_PATH,-mMODEL_NAME_OR_PATH--use_context,-uc--reset_context_on_iter,-rcoiWhnenum_outputsisbiggerthan1resetcontextoneachoutputbatchDialoGPTfromdialogpt2importDialoGPT2gpt=DialoGPT2(model_name_or_path='microsoft/DialoGPT-small',cuda_device=None,use_context=False)gpt.gen('Could you image someone building a repo about you?')Example$dialogpt2-gen-i
User>>Whomadeyou?
Bot>>I'm not sure I follow...User >> ShameBot >> You are a very sad person.User >> Don'tjudgesofastBot>>Thejudgesaidthat?
User>>ShutupBot>>Whatanicewaytogetaring.
User>>AAAAA
Bot>>AA
User>>A
Bot>>User>>AAAAAAAAAAAAAAA
Bot>>He'sagoodlookingguy.
User>>