Skip to content

config传参默认可以不传,解决默认onnx,报须torch库的问题#97

Merged
SWHL merged 3 commits into
RapidAI:mainfrom
hbh112233abc:main
Jun 21, 2025
Merged

config传参默认可以不传,解决默认onnx,报须torch库的问题#97
SWHL merged 3 commits into
RapidAI:mainfrom
hbh112233abc:main

Conversation

@hbh112233abc

@hbh112233abc hbh112233abc commented Jun 20, 2025

Copy link
Copy Markdown
Contributor
  1. config传参默认可以不传,自动取默认值
  2. 检查config类型,非RapidTableInput则异常提醒
  3. 解决默认onnx,报须torch库的问题

1. config传参默认可以不传,自动取默认值
2. 检查config类型,非RapidTableInput则异常提醒
解决 默认onnxruntime 报错须torch库的问题
解决 默认onnxruntime驱动 报错须torch库的问题
@hbh112233abc hbh112233abc changed the title config传参默认可以不传 config传参默认可以不传,解决默认onnx,报须torch库的问题 Jun 20, 2025
@SWHL
SWHL requested a review from Copilot June 21, 2025 00:10

Copilot AI left a comment

Copy link
Copy Markdown

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 improves the configuration handling by making the config parameter optional, automatically providing a default, and adding a type check to ensure correctness. It also removes global imports in favor of conditional local imports based on the config state, which helps resolve dependency issues with the torch library when using the default onnx setup.

  • Allow config to be optional by defaulting it to RapidTableInput()
  • Add type checking for the config parameter with an informative error message
  • Replace global imports with conditional, inline imports to address dependency concerns

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
rapid_table/table_structure/init.py Removed unnecessary global imports for TableStructurer and TableStructureUnitable
rapid_table/main.py Updated RapidTable.init to support optional config, added type validation, and moved local imports
Comments suppressed due to low confidence (2)

rapid_table/main.py:65

  • Consider including details about the expected types in the error message to make debugging easier. For example, mention that config should be an instance of RapidTableInput.
        if not isinstance(config, RapidTableInput):

rapid_table/main.py:77

  • [nitpick] Review the necessity of these inline (local) imports. If there's no cyclic dependency issue, moving them to the top of the module might improve clarity and reduce the overhead of repeated imports.
            from .table_structure.table_structure_unitable import TableStructureUnitable

@SWHL

SWHL commented Jun 21, 2025

Copy link
Copy Markdown
Member

LGTM

@SWHL
SWHL merged commit b9adda2 into RapidAI:main Jun 21, 2025
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.

3 participants