Skip to content

fix: replace 3 bare except clauses with except Exception#815

Open
KeloYuan wants to merge 1 commit into
TensorSpeech:masterfrom
KeloYuan:fix/bare-except-improvements
Open

fix: replace 3 bare except clauses with except Exception#815
KeloYuan wants to merge 1 commit into
TensorSpeech:masterfrom
KeloYuan:fix/bare-except-improvements

Conversation

@KeloYuan

@KeloYuan KeloYuan commented May 8, 2026

Copy link
Copy Markdown

Replaces 3 bare except: with except Exception: in utils/cleaners.py, inference/auto_model.py, examples/mfa_extraction/fix_mismatch.py.

Changed: utils/cleaners.py, inference/auto_model.py, fix_mismatch.py
Copilot AI review requested due to automatic review settings May 8, 2026 13:14

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 aims to make exception handling safer and more explicit by replacing three bare except: clauses with except Exception: across the codebase.

Changes:

  • Updated optional import handling for german_transliterate in tensorflow_tts/utils/cleaners.py.
  • Updated weight-loading fallback logic in tensorflow_tts/inference/auto_model.py.
  • Updated duration-file loading fallback logic in examples/mfa_extraction/fix_mismatch.py.

Reviewed changes

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

File Description
tensorflow_tts/utils/cleaners.py Replaces a bare import except: with except Exception: for optional German transliteration dependency.
tensorflow_tts/inference/auto_model.py Replaces a bare except: around load_weights with except Exception: before attempting a fallback load mode.
examples/mfa_extraction/fix_mismatch.py Replaces a bare except: when loading trimmed durations with except Exception: and falls back to untrimmed durations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +30 to 31
except Exception:
pass
Comment on lines 105 to 111
if pretrained_path is not None and ".h5" in pretrained_path:
try:
model.load_weights(pretrained_path)
except:
except Exception:
model.load_weights(
pretrained_path, by_name=True, skip_mismatch=True
)
os.path.join(trimmed_dur_path, f"{i.split('-')[0]}-durations.npy")
)
except:
except Exception:
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.

2 participants