PART 2: Critical Argument Reversals, NumPy 1.24+ Security Breaks, and Dynamic Mel-Spectrogram Shape Mismatches in Python 3.12 Branch
Author: LebedevIVCreated Aug 24, 2026Updated Aug 28, 2026
Labelsfollowing up
Bug 7: Complete Positional Argument Mismatch inside train/dataset/extract_f0.py
- Problem: When invoking pitch extraction directly via the CLI module execution (
python -m train.dataset.extract_f0), the updated internal argument parser (sys.argv) completely reverses the expected input layout. Instead of reading standard pipeline indices, line 20 checksmode = sys.argv[1].lower()against hardcoded environment strings ("cpu","cuda","dml"). If a user passes an extraction method string first (e.g.,rmvpe), it falls back to a fatal crash:ValueError: Unsupported F0 extraction mode: rmvpe. Conversely, if paths are passed sequentially, it parses the folder directory string as the hardware backend, throwing:ValueError: Unsupported F0 extraction mode: d:/git/rvc/logs/k_dedu. - File affected:
train/dataset/extract_f0.py - Solution required: Standardize the argument parser structure across both WebUI wrapper calls and direct standalone module initializations. Enforce explicit
argparseflags instead of relying on fragile, shiftingsys.argvabsolute array positioning.
Bug 8: NumPy 1.24+ Validation Failure (allow_pickle=False) in train/data_utils.py
- Problem: Recent security patches in NumPy 1.24+ deprecate and block the deserialization of object arrays via
np.load()by default to mitigate remote code execution risks (ValueError: Cannot load file containing pickled data when allow_pickle=False). However, RVC’s feature extraction sub-scripts (extract_hubert_feature.py) continue to generate hidden context.npyvoice arrays utilizing object serialization protocols. As a result, theDataLoadercompletely halts training at the very first step of Epoch 1. - File affected:
train/data_utils.py - Solution provided: Modify the label compilation arrays inside
get_labels()to explicitly override the strict global security defaults since these feature weights are computed locally and are entirely deterministic:
def get_labels(self, phone, pitch, pitchf):
phone = np.load(phone, allow_pickle=True)
phone = np.repeat(phone, 2, axis=0)
pitch = np.load(pitch, allow_pickle=True)
pitchf = np.load(pitchf, allow_pickle=True)Bug 9: Fatal RuntimeError Due to HiFi-GAN Vocoder Mel-Spectrogram Frame Alignment Dropping
- Problem: When a dataset consists of short sliced audio packets (e.g., 3-second segments produced by the automated
audio-slicer), the random target cropping length can drop below or fall out of mathematical alignment with the vocoder's network layer chain. The generator upsamples temporal data features using a strict multiplier sequence (12 * 10 * 2 * 2 = 480). If the internalsegment_sizewindow doesn't map cleanly to the remaining audio chunk borders, the target size and input size mismatch, triggering a fatal tensor crash during L1 loss calculation:RuntimeError: The size of tensor a (120) must match the size of tensor b (480) at non-singleton dimension 2 - File affected:
train/train.py - Solution provided: Implement a resilient frame-level matrix shape balancer immediately prior to executing the
F.l1_lossloss evaluation module to clip padding edge discrepancies dynamically on the fly:
# --- ARCHITECTURAL TENSOR SIZE BALANCER FIX ---
if y_mel.size(-1) != y_hat_mel.size(-1):
min_frames = min(y_mel.size(-1), y_hat_mel.size(-1))
y_mel = y_mel[:, :, :min_frames]
y_hat_mel = y_hat_mel[:, :, :min_frames]
loss_mel = F.l1_loss(y_mel, y_hat_mel) * hps.train.c_mel
# -----------------------------------------------Bug 10: Broken Output Directory Fallback in Dataset Preprocessing
- Problem: The custom destination folder argument passed to
train/preprocess.pyfrom the WebUI is systematically ignored during dataset slicing routines. The script hard-routes all sliced audio chunks directly into the project's base fallback directory (./logs/k_dedu/0_gt_wavs), completely disregarding user-specified experiment directory tags (e.g.,k_dedu_v3). This overwrites existing index footprints and creates background file conflicts. - File affected:
train/preprocess.py
Bug 11: Missing Native UTF-8 Byte Order Mark (BOM) Sanitization
- Problem: When files like
filelist.txtorconfig.jsonare parsed on Windows environments, common local shell text outputs or editors prepend a non-visual 3-byte BOM marker (п»ї) to the initialization stream. The framework's input parsing methods read this header as text data, prepending it to file path lookups and throwing:OSError: [WinError 123] Invalid filename syntax: 'п»їD:\\git\\...'. - File affected:
tools/file_io.py/train/utils.py - Solution suggested: Enforce
utf-8-sigencoding globally across all text-reading functions to automatically strip neoteric Windows structural byte artifacts.
FEATURE REQUEST / SUGGESTION FOR EXTRACT SCRIPTS
Add a Force Regenerate Cache flag to extract_f0.py and extract_hubert_feature.py. Currently, the tools check for file completion globally based on simple directory string presence. If the naming convention shifts (e.g., creating 0_1.wav.npy instead of 0_1.npy), the scripts write a success state log and skip extraction completely, rendering empty data packets and forcing users to manually flush cache folders via system shells.
Source: RVC-Project/Retrieval-based-Voice-Conversion-WebUI