ruotianluo / self-critical.pytorch

Unofficial pytorch implementation for Self-critical Sequence Training for Image Captioning. and others.
MIT License
996 stars 279 forks source link

FileNotFoundError: [Errno 2] No such file or directory: 'java' #237

Closed im-smuze closed 3 years ago

im-smuze commented 3 years ago

Hello There, I was using your project for running image caption test. While there was a problem as follows when I using transformer model: the code makes evaluation on validation set after training _save_checkpointevery(=5000) times, but when finished validation, I got back an error: FileNotFoundError: [Errno 2] No such file or directory: 'java' I had already installed java1.8 and configured environment variables, with inputing $java -veision in terminal return java version "1.8.0_221" Java(TM) SE Runtime Environment (build 1.8.0_221-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode) . dataset: coco2014

image 451949: a woman and a woman walking down a street
image 203138: a man standing in a kitchen holding a wii controller
image 296759: a teddy bear and a teddy bear are sitting on a floor
evaluating validation preformance... 5000/5000 (2.440472)
loading annotations into memory...
0:00:00.215744
creating index...
index created!
using 5000/5000 predictions
Loading and preparing results...     
DONE (t=0.02s)
creating index...
index created!
tokenization...
Traceback (most recent call last):
  File "/home/***/self-critical.pytorch-master/tools/train.py", line 290, in <module>
    train(opt)

  File "/home/***/self-critical.pytorch-master/tools/train.py", line 243, in train
    val_loss, predictions, lang_stats = eval_utils.eval_split(

  File "/home/***/self-critical.pytorch-master/captioning/utils/eval_utils.py", line 226, in eval_split
    lang_stats = language_eval(dataset, predictions, n_predictions, eval_kwargs, split)

  File "/home/***/self-critical.pytorch-master/captioning/utils/eval_utils.py", line 90, in language_eval
    cocoEval.evaluate()

  File "/home/***/self-critical.pytorch-master/coco-caption/pycocoevalcap/eval.py", line 38, in evaluate
    gts  = tokenizer.tokenize(gts)

  File "/home/***/self-critical.pytorch-master/coco-caption/pycocoevalcap/tokenizer/ptbtokenizer.py", line 54, in tokenize
    p_tokenizer = subprocess.Popen(cmd, cwd=path_to_jar_dirname, \

  File "/home/**/anaconda3/envs/**/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,

  File "/home/**/anaconda3/envs/**/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)

FileNotFoundError: [Errno 2] No such file or directory: 'java'`

I guess this issue might due to the stanfordcorenlp, but I hasn't comeup with a solution. How can I deal with this issue? Or, can I give up using stanfordcorenlp? and how?

lalaha1 commented 2 years ago

Hi, I met the same question like you. Did you solve it? I had installed java1.8.