jyoti / tinyasr /codec_factory_v2.py
voidash's picture
jyoti 2.3 kbps speech codec: development candidate C (p=0.50) + variant B (p=0.25), inference bundle
b1882a9 verified
Raw History Blame Contribute Delete
590 Bytes
"""Architecture selection including the projected scalar warmup experiment."""
import torch
from tinyasr.codec_factory_v1 import load_codec_checkpoint as load_previous
from tinyasr.codec_projected_warmup_v1 import ARCHITECTURE, ProjectedWarmupCodec
def load_codec_checkpoint(path):
checkpoint = torch.load(path, map_location='cpu', weights_only=False)
if checkpoint.get('architecture') != ARCHITECTURE:
return load_previous(path)
model = ProjectedWarmupCodec()
model.load_state_dict(checkpoint['codec'], strict=True)
return model.eval().requires_grad_(False)