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

Function build_processor

moss_tts_local/finetuning/sft.py:259–282  ·  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

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

Callers 1

mainFunction · 0.70

Calls 3

from_pretrainedMethod · 0.45
toMethod · 0.45

Tested by

no test coverage detected