MCPcopy Create free account
hub / github.com/OpenMOSS/MOSS-TTS / build_processor

Function build_processor

moss_tts_delay/finetuning/sft.py:260–283  ·  view source on GitHub ↗
(
    model_path: str,
    codec_path: str,
    need_audio_tokenizer: bool,
    audio_tokenizer_device: Optional[str],
    default_audio_tokenizer_device: str,
)

Source from the content-addressed store, hash-verified

258
259
260def build_processor(
261 model_path: str,
262 codec_path: str,
263 need_audio_tokenizer: bool,
264 audio_tokenizer_device: Optional[str],
265 default_audio_tokenizer_device: str,
266):
267 config = AutoConfig.from_pretrained(model_path, trust_remote_code=True)
268 tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
269 processor = MossTTSDelayProcessor(
270 tokenizer=tokenizer,
271 audio_tokenizer=None,
272 model_config=config,
273 )
274
275 if need_audio_tokenizer:
276 processor = MossTTSDelayProcessor.from_pretrained(
277 model_path,
278 codec_path=codec_path,
279 )
280 device = audio_tokenizer_device or default_audio_tokenizer_device
281 processor.audio_tokenizer = processor.audio_tokenizer.to(device)
282
283 return processor
284
285
286@contextmanager

Callers 1

mainFunction · 0.70

Calls 3

from_pretrainedMethod · 0.45
toMethod · 0.45

Tested by

no test coverage detected