MCPcopy Create free account
hub / github.com/FunAudioLLM/Fun-Audio-Chat / get_audio_tokenizer

Function get_audio_tokenizer

utils/cosyvoice_tokenizer.py:89–99  ·  view source on GitHub ↗
(onnx_path = "pretrained_models/Fun-CosyVoice3-0.5B-2512/speech_tokenizer_v3.onnx", device_id=0)

Source from the content-addressed store, hash-verified

87
88
89def get_audio_tokenizer(onnx_path = "pretrained_models/Fun-CosyVoice3-0.5B-2512/speech_tokenizer_v3.onnx", device_id=0):
90 option = onnxruntime.SessionOptions()
91 option.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_ENABLE_ALL
92 option.intra_op_num_threads = 1
93 # 指定使用哪个 GPU
94 providers = [
95 ("CUDAExecutionProvider", {"device_id": device_id}),
96 "CPUExecutionProvider"
97 ]
98 ort_session = onnxruntime.InferenceSession(onnx_path, sess_options=option, providers=providers)
99 return ort_session

Callers 1

convert_formatFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected