Skip to content

fix: replace 9 bare excepts with specific exception types#117

Open
haosenwang1018 wants to merge 1 commit intokandinskylab:mainfrom
haosenwang1018:fix/bare-excepts
Open

fix: replace 9 bare excepts with specific exception types#117
haosenwang1018 wants to merge 1 commit intokandinskylab:mainfrom
haosenwang1018:fix/bare-excepts

Conversation

@haosenwang1018
Copy link
Copy Markdown

Replace bare except: with specific exception types across 5 files (9 sites).

Changes:

  • models/attention.py (3): except ImportError: — optional flash_attn/sageattention imports
  • utils.py (3): except (KeyError, ValueError): — env var access (LOCAL_RANK, WORLD_SIZE)
  • i2i_pipeline.py, i2v_pipeline.py, t2v_pipeline.py (3): except (FileNotFoundError, json.JSONDecodeError, TypeError): — adapter config loading

Why: Bare except: catches BaseException including KeyboardInterrupt and SystemExit, which can prevent clean shutdown during distributed training.

- models/attention.py (3): except: → except ImportError: (optional imports)
- utils.py (3): except: → except (KeyError, ValueError): (env var access)
- i2i/i2v/t2v_pipeline.py (3): except: → except (FileNotFoundError, json.JSONDecodeError, TypeError): (adapter config loading)
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.

1 participant