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

Update evaluate.py #441

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update evaluate.py #441

wants to merge 1 commit into from

Conversation

JJJYmmm
Copy link

@JJJYmmm JJJYmmm commented Apr 24, 2024

Fix the conditional determination of whether the scores variable is empty.

problem

When running evaluate_refcoco.sh, encounter errors below.

scores:tensor([1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
       device='cuda:0')
Traceback (most recent call last):
  File "/home/xxx/projects/OFA/run_scripts/refcoco/../../evaluate.py", line 188, in main
    if scores and isinstance(scores[0], tuple):
RuntimeError: Boolean value of Tensor with more than one value is ambiguous

Solution

            # if scores and isinstance(scores[0], tuple):
            if scores is not None and isinstance(scores[0], tuple):
                score_sum += sum([s[0] for s in scores])
                score_cnt += sum([s[1] for s in scores])

Fix the conditional determination of whether the scores variable is empty.
@JJJYmmm JJJYmmm mentioned this pull request Apr 24, 2024
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

Successfully merging this pull request may close these issues.

None yet

1 participant