Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

call meteor #64

Closed
joseph12346 opened this issue May 8, 2019 · 7 comments
Closed

call meteor #64

joseph12346 opened this issue May 8, 2019 · 7 comments

Comments

@joseph12346
Copy link

joseph12346 commented May 8, 2019

Hi, I want to calculate meteor.

windows 10
java 1.8.0_17
python 3.6.4

code like this:

from __future__ import unicode_literals
import os
import nlgeval

root_dir = os.path.join(os.path.dirname(__file__))
hypothesis = os.path.join(root_dir, 'examples/hyp.txt')
references = os.path.join(root_dir, 'examples/ref1.txt'), os.path.join(root_dir, 'examples/ref2.txt')
scores = nlgeval.compute_metrics(hypothesis, references)

File "C:\Users\214A\Desktop\nlg-eval-master\nlgeval\pycocoevalcap\meteor\meteor.py", line 68, in compute_score
scores.append(float(dec(self.meteor_p.stdout.readline().strip())))
ValueError: could not convert string to float:

Thanks!

@juharris
Copy link
Member

juharris commented May 8, 2019

Thanks for reporting this. I can help you debug it.
Change that line from scores.append(float(dec(self.meteor_p.stdout.readline().strip()))) to these lines:

v = self.meteor_p.stdout.readline()
try:
    scores.append(float(dec(v.strip())))
except:
    print("Error handling value: {}".format(v))
    print("Decoded value: {}".format(dec(v.strip())))
    raise

and re-run the program. It should help us see what we're dealing with.

PS Is that your birthday in your GitHub username? If so you should consider changing it as many places irresponsibly use a birthday to authenticate people.

@joseph12346
Copy link
Author

Thanks your advice!

It print this
Error handling value: b''
Decoded value:

@juharris
Copy link
Member

juharris commented May 9, 2019

I can't find a nice way to work in a fix and I can't replicate the issues that people get with Meteor.
For now can you add do this:

v = self.meteor_p.stdout.readline()
try:
    scores.append(float(dec(v.strip())))
except:
    sys.stderr.write("Error handling value: {}\n".format(v))
    sys.stderr.write("Decoded value: {}\n".format(dec(v.strip())))
    sys.stderr.write("eval_line: {}\n".format(eval_line))
    raise

and if the eval_line isn't helpful then also add:

sys.stderr.write("Error from Meteor:\n{}".format(self.meteor_p.stderr.read()))

before raise. That line is dangerous because it will hang if there is no stderr from Meteor. So if you find that after adding that line your program never ends, then stop you program and remove it.

@joseph12346
Copy link
Author

joseph12346 commented May 10, 2019

Thanks for your help !!

Error handling value: b'Could not reserve enough space for 2097152KB object heap\n'
Decoded value: Could not reserve enough space for 2097152KB object heap
eval_line: EVAL ||| Error occurred during initialization of VM

@juharris
Copy link
Member

Ah that's very helpful. It seems like you don't have much memory on your machine?
You can changing that '-Xmx2G' to something lower like '-Xmx1G' in meteor.py.

@joseph12346
Copy link
Author

It works now !
Thank you!
You've been a lifesaver.

@juharris
Copy link
Member

Thanks for the feedback. I'll look into adding a warning to help others in the future.

juharris pushed a commit that referenced this issue May 10, 2019
juharris added a commit that referenced this issue May 13, 2019
* meteor: Add some warnings around Meteor usage to help troubleshoot
memory issues.
Helps with #64.
* numpy: Allow pickle.
* python 2: Lower scikit-learn version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants