File size: 1,132 Bytes
adabee1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | """tiny_voca.train with the texture loss starting at TEXTURE_LOW_HZ instead of the built-in 2 kHz.
The texture loss (``--texture W``) matches the amount of frame-to-frame change of the Vocos log-mel
per band and utterance. Upstream hard-codes its bands to centres >= 2 kHz
(TrainingSystem.texture_bands, low_hz=2000). Night of 2026-11-25: with it, vowel motion reached
-3% / -6% of the real speaker at 2-4 / 4-8 kHz, but 1-2 kHz stayed 10% short. This wrapper moves
the start of the band without rebuilding the image. All arguments go to tiny_voca.train unchanged:
TEXTURE_LOW_HZ=1000 python scripts/train_texture_low.py --texture 20 ...
"""
import os
import sys
from tiny_voca import train
LOW_HZ = float(os.environ.get('TEXTURE_LOW_HZ', '2000'))
_original = train.TrainingSystem.texture_bands.__func__
def _texture_bands(cls, bands, device, low_hz=2000.0):
return _original(cls, bands, device, LOW_HZ)
train.TrainingSystem.texture_bands = classmethod(_texture_bands)
if __name__ == '__main__':
print(f'texture loss bands from {LOW_HZ:.0f} Hz', flush=True)
sys.argv[0] = 'tiny_voca.train'
train.main()
|