Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Nbest reranking options using isometric translation criteria.#1048

Merged
fhieber merged 12 commits into
awslabs:mainfrom
surafelml:reranking_isometric_mt
Jun 14, 2022
Merged

Nbest reranking options using isometric translation criteria.#1048
fhieber merged 12 commits into
awslabs:mainfrom
surafelml:reranking_isometric_mt

Conversation

@surafelml

Copy link
Copy Markdown
Contributor

Added Nbest list reranking options using isometric translation criteria as proposed in an ICASSP 2021 paper https://arxiv.org/abs/2110.03847.

Pull Request Checklist

  • Changes are complete (if posting work-in-progress code, prefix your pull request title with '[WIP]'
    until you can check this box.
  • Unit tests pass (pytest)
  • Were system tests modified? If so did you run these at least 5 times to account for the variation across runs?
  • System tests pass (pytest test/system)
  • Passed code style checking (./style-check.sh)
  • You have considered writing a test
  • Updated major/minor version in sockeye/__init__.py. Major version bump if this is a backwards incompatible change.
  • Updated CHANGELOG.md

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Comment thread sockeye/rerank.py Outdated
Comment thread sockeye/rerank.py Outdated
Comment thread sockeye/rerank.py Outdated
Comment thread sockeye/rerank.py Outdated
Comment thread sockeye/rerank.py Outdated
Comment thread sockeye/rerank.py Outdated
Comment thread sockeye/utils.py Outdated
Comment thread sockeye/utils.py Outdated
Comment thread sockeye/utils.py Outdated
Comment thread sockeye/utils.py Outdated
Comment thread sockeye/rerank.py Outdated
Comment thread sockeye/rerank.py Outdated
Comment thread sockeye/utils.py Outdated
Comment thread sockeye/utils.py Outdated
Comment thread sockeye/utils.py Outdated
Comment thread sockeye/utils.py Outdated
Comment thread sockeye/utils.py

@fhieber fhieber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for iterating, just 2 remaining comments.

Comment thread sockeye/utils.py
return obj_list


def count_seq_len(sample: str, count_type: str = 'char', replace_tokens: Optional[List] = None) -> int:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think some unit tests would be useful for this.

Comment thread sockeye/utils.py
@surafelml

Copy link
Copy Markdown
Contributor Author

Thanks for iterating, just 2 remaining comments.

I have added the tests. Thanks for the reviews and comments!

@fhieber fhieber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good!
Only thing remaining is to resolve the conflict with main in CHANGELOG.md by bumping minor version to .16

@fhieber

fhieber commented Jun 6, 2022

Copy link
Copy Markdown
Contributor

@surafelml looks like there is still some linter error.

@surafelml

Copy link
Copy Markdown
Contributor Author

style-check seems to throw an error on the inference script, which is not related with reranking module
sockeye/inference.py:1215: error: "_assemble_translation" of "Translator" gets multiple values for keyword argument "unshift_target_factors" Found 1 error in 1 file (checked 31 source files)

@fhieber

fhieber commented Jun 7, 2022

Copy link
Copy Markdown
Contributor

Are you sure? Is this an error you get locally?
The pylinter in CI on Github shows:

************* Module sockeye.rerank
13
sockeye/rerank.py:86:22: E1124: Argument 'smooth_method' passed by position and keyword in function call (redundant-keyword-arg)

@surafelml

Copy link
Copy Markdown
Contributor Author

i have checked it several times, after downgrading pylint 2.13.9 to the gh CI version pylint 2.6.0 i keep getting the same error.

@fhieber

fhieber commented Jun 9, 2022

Copy link
Copy Markdown
Contributor

The failure in CI is not related to the issues you see locally. Sometimes it is difficult to replicate the environment of CI exactly locally.
The problem seems to be the linter mixing the argument structure of the case then scoring_function is chrf, and when it is your partial of compute_isometric_score, because they have different signatures. If you want just add an ignore to it.

@surafelml

Copy link
Copy Markdown
Contributor Author

Yes, this must be a case the linter is confusing the arg structure in the partial functions. Adding type ignore show no change for the CI issue. Passing the smooth_method as positional arg can be a workaround for now.

@fhieber

fhieber commented Jun 10, 2022

Copy link
Copy Markdown
Contributor

# type: ignore afaik only works for mypi. If you want to ignore a specific pytlint warning you should use # pylint: disable=<error/warning type>.
The last commit seems to introduce another error.

@surafelml

Copy link
Copy Markdown
Contributor Author

local tests didn't catch mypy (same version) error as in CI for Literal. first option was to use set kind: Literal['quicksort', 'mergesort', 'heapsort', 'stable'], this seems to require py3.8, instead i have set type ignore for argsort.

@fhieber fhieber merged commit 6962770 into awslabs:main Jun 14, 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