config传参默认可以不传,解决默认onnx,报须torch库的问题#97
Merged
Merged
Conversation
1. config传参默认可以不传,自动取默认值 2. 检查config类型,非RapidTableInput则异常提醒
解决 默认onnxruntime 报错须torch库的问题
There was a problem hiding this comment.
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
Closed
Member
|
LGTM |
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.
Uh oh!
There was an error while loading. Please reload this page.