Extsumm_local_global_context icon indicating copy to clipboard operation
Extsumm_local_global_context copied to clipboard

About ‘text.py’

Open superxaiole opened this issue 3 years ago • 1 comments

Hello, thanks for your help. Does running text.py require a java environment? I get the following error while running text.py, how can I solve it?

Load vocabulary from vocabulary_Pubmed-full.json Compute pos weight done! There are 4474321 sentences in total, with 203653 sentences as positive Start loading model. Start evaluating. Batch 1, Loss: 1.043701 Rouge-1 recall score: 0.503920, Rouge-1 f-score: 0.446150, Rouge-2 recall score:0.219530, Rouge-2 f-score:0.195170, Rouge-L recall score:0.356910, Rouge-L f-score:0.311760 Traceback (most recent call last): File "/home/dl/code/cyc/Extsumm_local_global_context-master/test.py", line 147, in r2, l = eval_seq2seq(test_dataloader,model,hyp_path,LENGTH_LIMIT,pos_weight,device,USE_SECTION_INFO,remove_stopwords,stemmer,meteor=True,lcs=lcs,saveas=SAVE_RESULT_NAME) File "/home/dl/code/cyc/Extsumm_local_global_context-master/run.py", line 97, in eval_seq2seq get_meteor(summ_path, ref_path,model_type) File "/home/dl/code/cyc/Extsumm_local_global_context-master/utils.py", line 145, in get_meteor subprocess.call(['java','-Xmx2G','-jar','meteor-1.5/meteor-1.5.jar','all_hyp_inorder.txt','all_ref_inorder.txt','-norm','-f','system1'],stdout=of) File "/home/dl/anaconda3/envs/ext/lib/python3.7/subprocess.py", line 339, in call with Popen(*popenargs, **kwargs) as p: File "/home/dl/anaconda3/envs/ext/lib/python3.7/subprocess.py", line 800, in init restore_signals, start_new_session) File "/home/dl/anaconda3/envs/ext/lib/python3.7/subprocess.py", line 1551, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'java': 'java'

superxaiole avatar Dec 05 '21 02:12 superxaiole

Hi there,

Running the training/testing process does not require java, it is only needed in one evaluation metric, 'METEOR', if you don't want to set up the environments for java, simply comment out all the code related to 'get_meteor' function. Then java is not needed anymore.

Wendy-Xiao avatar Dec 06 '21 19:12 Wendy-Xiao