Fix tools/infer_e2e_parallel.py crashing on startup with a TypeError - #220
Open
Anai-Guo wants to merge 1 commit into
Open
Fix tools/infer_e2e_parallel.py crashing on startup with a TypeError#220Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
…_parallel main()
`python tools/infer_e2e_parallel.py` fails immediately with
TypeError: main() missing 2 required positional arguments: 'cfg_det' and 'cfg_rec'
because the module's `if __name__ == '__main__':` block calls `main()` with no
arguments. Neither parameter is used inside `main()` -- the configs are built
inside `OpenOCRParallel.__init__`. The sibling script `tools/infer_e2e.py`
already declares `def main():`.
Signed-off-by: Anai-Guo <antai12232931@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
tools/infer_e2e_parallel.pycannot be run at all:The module's entry point is
but the function is declared
def main(cfg_det, cfg_rec):.Why removing the parameters is the right fix
Neither name is used anywhere in
main()'s body. The two configs are built insideOpenOCRParallel.__init__(:30–:34), which is where thecfg_det/cfg_reclocalsactually live — a different scope:
and
main()only doestext_sys = OpenOCRParallel(drop_score=drop_score, det_box_type='quad').The sibling end-to-end script
tools/infer_e2e.pyalready declaresdef main():with noparameters and is called the same way, so this just brings the parallel variant in line
with it.
One line, no behaviour change beyond making the script runnable.
🤖 Generated with Claude Code