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

Add OpReplaceAnyElements to ops_common #340

Merged
merged 9 commits into from
Jan 28, 2024
Merged

Add OpReplaceAnyElements to ops_common #340

merged 9 commits into from
Jan 28, 2024

Conversation

sivanravidos
Copy link
Collaborator

  • Added OpReplaceAnyElements to opps_common. This op allow replacing any set of tokens with a given token.
    This is useful for example when one wants to ingore a set of tokens, e.g. when applying a metric that should ignore all special tokens.
  • Added unit test for the new op and the former OpReplaceElements

@sivanravidos sivanravidos marked this pull request as ready for review January 22, 2024 21:22
mosheraboh
mosheraboh previously approved these changes Jan 28, 2024
Copy link
Collaborator

@mosheraboh mosheraboh left a comment

Choose a reason for hiding this comment

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

Looks good.
Minors inline.


class OpReplaceAnyElements(OpBase):
"""
Replace any element from a given list of elements with a requested value
Copy link
Collaborator

Choose a reason for hiding this comment

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

list./ numpy array or tensor

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

key_in: str,
find_any_val: List[Any],
replace_with_val: Any,
key_out: str = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Optional[str]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@sivanravidos sivanravidos merged commit 735f5cc into master Jan 28, 2024
5 checks passed
@sivanravidos sivanravidos deleted the op_replace_any branch January 28, 2024 14:56
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