Skip to content

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.

1 participant