MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / run_once

Function run_once

tests/chatterbox/chatterbox_python_warm_bench.py:112–144  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

110 model.s3gen.flow.inference_cfg_rate = args.s3gen_cfg_rate
111
112 def run_once(text: str) -> tuple[np.ndarray, int, float]:
113 torch.manual_seed(args.seed)
114 if args.backend == "cuda":
115 torch.cuda.manual_seed_all(args.seed)
116 started = time.perf_counter()
117 if language == "en":
118 wav = model.generate(
119 text,
120 audio_prompt_path=str(args.clone_audio),
121 exaggeration=args.exaggeration,
122 cfg_weight=args.cfg_weight,
123 temperature=args.temperature,
124 repetition_penalty=args.repetition_penalty,
125 min_p=args.min_p,
126 top_p=args.top_p,
127 )
128 else:
129 wav = model.generate(
130 text,
131 language_id=language,
132 audio_prompt_path=str(args.clone_audio),
133 exaggeration=args.exaggeration,
134 cfg_weight=args.cfg_weight,
135 temperature=args.temperature,
136 repetition_penalty=args.repetition_penalty,
137 min_p=args.min_p,
138 top_p=args.top_p,
139 )
140 if args.backend == "cuda":
141 torch.cuda.synchronize(args.device)
142 ended = time.perf_counter()
143 audio = wav.detach().cpu().numpy().astype(np.float32).reshape(-1)
144 return audio, int(model.sr), (ended - started) * 1000.0
145
146 args.timing_file.parent.mkdir(parents=True, exist_ok=True)
147 with args.timing_file.open("w", encoding="utf-8") as timing:

Callers 1

mainFunction · 0.70

Calls 1

generateMethod · 0.45

Tested by

no test coverage detected