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

Attributed behavior for contrastive step functions #228

Merged
merged 4 commits into from
Oct 30, 2023
Merged

Conversation

gsarti
Copy link
Member

@gsarti gsarti commented Oct 30, 2023

Description

This PR:

  • Reorganizes logics related to contrastive step functions in the contrast_utils module.
  • Add the is_attributed_fn bool flag (default: False) to the StepFunctionBaseArgs class. This flag enables custom behavior during step function execution by checking whether the function is being called as a step function or as an attribution target.
  • Fix the problematic behavior of contrast_prob_diff as an attributed function (Bug about 'contrast_prob_diff' #188) by forcing original inputs at every step when
    performing contrastive feature attribution (matching Yin and Neubig (2022) implementation). The previous behavior allowing for measuring contrastive probability difference in presence of different input sources is preserved when the function is used as step function.

@gsarti gsarti added the enhancement New feature or request label Oct 30, 2023
@gsarti gsarti added this to the v0.5 milestone Oct 30, 2023
@gsarti gsarti linked an issue Oct 30, 2023 that may be closed by this pull request
* origin/main:
  Remove `max_input_length` from `model.encode` (#227)
* origin/main:
  Fix command for installing pre-commit hooks. (#229)
@gsarti gsarti merged commit 6feda95 into main Oct 30, 2023
4 checks passed
@gsarti gsarti deleted the fix-contrast-attr branch October 30, 2023 10:26
gsarti added a commit that referenced this pull request Oct 30, 2023
* origin/main:
  Attributed behavior for contrastive step functions (#228)
  Fix command for installing pre-commit hooks. (#229)
  Remove `max_input_length` from `model.encode` (#227)
  Migrate to `ruff format` (#225)
  Remove contrast_target_prefixes from contrastive step functions (#224)
  Step functions fixes, add `in_context_pvi` (#223)
  Format fixes, add Attanasio et al. (2023) to readme
  Add Sequential IG method (#222)
  Fix LIME and Occlusion outputs (#220)
  Update citation information
  Bump dependencies
  Add end_pos for contrast_targets_alignments
  Fix dummy output viz in console
  Minor fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug about 'contrast_prob_diff'
1 participant