Skip to content

Conversation

@VijayKalmath
Copy link
Contributor

What does this PR do?

Summary

There is a corner-case when saliency_scores length is not equal to len_text ,
this happens when the query budget limits calculations of leave_one_results.

Additions

Changes

  • Moved search_over check to the start of the loop .
  • Changed delta_ps update when search_over = True.

Deletions

Fixes Issue raised by @pratyushmaini in #654

Checklist

  • The title of your pull request should be a summary of its contribution.
  • Please write detailed description of what parts have been newly added and what parts have been modified. Please also explain why certain changes were made.
  • If your pull request addresses an issue, please mention the issue number in the pull request description to make sure they are linked (and people consulting the issue know you are working on it)
  • To indicate a work in progress please mark it as a draft on Github.
  • [ ] Make sure existing tests pass.
  • [ ] Add relevant tests. No quality testing = no merge.
  • [ ] All public methods must have informative docstrings that work nicely with sphinx. For new modules/files, please add/modify the appropriate .rst file in TextAttack/docs/apidoc.'

There is a corner-case when `saliency_scores`  length is not equal to `len_text` , 
this happens when the query budget limits calculations of `leave_one_results`. 


Fixes Issue raised by @pratyushmaini in QData#654
@VijayKalmath VijayKalmath marked this pull request as ready for review June 27, 2022 18:16
Comment on lines +68 to +76

# Exit Loop when search_over is True - but we need to make sure delta_ps
# is the same size as softmax_saliency_scores
if search_over:
delta_ps = delta_ps + [0.0] * (
len(softmax_saliency_scores) - len(delta_ps)
)
break

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this bug.

@jxmorris12
Copy link
Collaborator

Closes #654

@jxmorris12 jxmorris12 merged commit 4560fae into QData:master Jun 29, 2022
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.

2 participants