VibeVoice icon indicating copy to clipboard operation
VibeVoice copied to clipboard

refactor: harden python runtime checks and typing in modular components

Open 0xxy0 opened this issue 8 months ago • 3 comments

What I changed

Type-hint correctness + import hygiene

vibevoice/modular/streamer.py

  • Replaced Optional[any] with Optional[Any]
  • Added Any import
  • Moved inline import time to module scope

Production-safe runtime checks

vibevoice/modular/modeling_vibevoice.py
vibevoice/modular/modeling_vibevoice_asr.py
vibevoice/modular/modeling_vibevoice_streaming.py

  • Replaced assert False fallback with explicit RuntimeError in embedding lookup path

Clear input validation in inference

vibevoice/modular/modeling_vibevoice_streaming_inference.py

  • Replaced assert batch_size == 1 with ValueError including actual batch size

Safer checkpoint conversion

vibevoice/scripts/convert_nnscaler_checkpoint_to_transformers.py

  • Made torch.load(..., weights_only=False) explicit
  • Wrapped temporary dtype override in try/finally so dtype is always restored on failures

0xxy0 avatar Apr 02 '26 11:04 0xxy0

@microsoft-github-policy-service agree

0xxy0 avatar Apr 02 '26 11:04 0xxy0

Hi! This PR is ready for review.

Workflows are awaiting approval—could a maintainer please approve them? Thanks!

0xxy0 avatar Apr 03 '26 08:04 0xxy0

Python runtime checks and typing hardening in modular components. Type safety improvements — good practice. If tests pass, ready to merge.

rickthomasjr avatar Jun 14 '26 11:06 rickthomasjr