Skip to content

fix onnx in latexocr #14910

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

Open
wants to merge 2 commits into
base: release/2.10
Choose a base branch
from

Conversation

liuhongen1234567
Copy link
Collaborator

No description provided.

Copy link

paddle-bot bot commented Mar 20, 2025

Thanks for your contribution!

@jzhang533 jzhang533 requested a review from Copilot April 2, 2025 05:52
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses issues with ONNX export in the LaTeX OCR head by simplifying the sampling logic during inference.

  • Modified sampling by replacing multinomial sampling with argmax in the generate and generate_export functions.
  • Removed the branch that applied filter_logits_fn for top_k and top_p filtering.
Comments suppressed due to low confidence (2)

ppocr/modeling/heads/rec_latexocr_head.py:910

  • Replacing softmax and multinomial sampling with argmax disregards the temperature and filtering parameters, which may alter the intended prediction distribution. Consider documenting this change or refactoring the unused parameters if deterministic output is acceptable for ONNX export.
sample = paddle.argmax(logits, axis=1).reshape([-1, 1])

ppocr/modeling/heads/rec_latexocr_head.py:962

  • The switch to a deterministic argmax approach in generate_export may impact the output behavior compared to the previous stochastic sampling method. Ensure this change aligns with the overall model requirements and ONNX export compatibility.
sample = paddle.argmax(logits, axis=1).reshape([-1, 1])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant