-
Notifications
You must be signed in to change notification settings - Fork 210
fix: multiple bug fixes (#390, #311, #316) #405
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -682,7 +682,11 @@ def __init__( | |||||
| self.pad_to_multiple_of = pad_to_multiple_of | ||||||
| self.snap_to_patch_size = snap_to_patch_size | ||||||
| try: | ||||||
| self.patch_size = model.config.vision_config.patch_size | ||||||
| patch_size = model.config.vision_config.patch_size | ||||||
| # Handle tuple patch sizes (e.g., (14, 14) for InternVL3) - use first element | ||||||
| if isinstance(patch_size, (tuple, list)): | ||||||
| patch_size = patch_size[0] | ||||||
| self.patch_size = patch_size | ||||||
| except: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of a bare
Suggested change
|
||||||
| if hasattr(model.config, 'vision_config') and hasattr(model.config.vision_config, 'model_type'): | ||||||
| lower_name = model.config.vision_config.model_type.lower() | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a bare
exceptis generally discouraged as it can catch unexpected errors, includingSystemExitandKeyboardInterrupt, making the program harder to debug and interrupt. Per PEP 8, it's better to catch specific exceptions. In this case, since accessing attributes fromdir()can sometimes raise various exceptions if they are computed properties, catchingExceptionwould be a safer and more explicit choice.