Spaces:
Running
on
Zero
Running
on
Zero
禾息
commited on
Commit
•
18599be
1
Parent(s):
2940836
mirror modify
Browse files- cosyvoice/bin/export_trt.py +14 -0
- cosyvoice/cli/model.py +1 -5
- cosyvoice/flow/flow_matching.py +0 -1
cosyvoice/bin/export_trt.py
CHANGED
@@ -1,3 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import argparse
|
2 |
import logging
|
3 |
import os
|
|
|
1 |
+
# Copyright (c) 2024 Antgroup Inc (authors: Zhoubofan, [email protected])
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
|
15 |
import argparse
|
16 |
import logging
|
17 |
import os
|
cosyvoice/cli/model.py
CHANGED
@@ -20,11 +20,6 @@ from contextlib import nullcontext
|
|
20 |
import uuid
|
21 |
from cosyvoice.utils.common import fade_in_out
|
22 |
|
23 |
-
try:
|
24 |
-
import tensorrt as trt
|
25 |
-
except ImportError:
|
26 |
-
...
|
27 |
-
|
28 |
class CosyVoiceModel:
|
29 |
|
30 |
def __init__(self,
|
@@ -72,6 +67,7 @@ class CosyVoiceModel:
|
|
72 |
self.llm.llm = llm_llm
|
73 |
|
74 |
def load_trt(self, model_dir, use_fp16):
|
|
|
75 |
trt_file_name = 'estimator_fp16.plan' if use_fp16 else 'estimator_fp32.plan'
|
76 |
trt_file_path = os.path.join(model_dir, trt_file_name)
|
77 |
if not os.path.isfile(trt_file_path):
|
|
|
20 |
import uuid
|
21 |
from cosyvoice.utils.common import fade_in_out
|
22 |
|
|
|
|
|
|
|
|
|
|
|
23 |
class CosyVoiceModel:
|
24 |
|
25 |
def __init__(self,
|
|
|
67 |
self.llm.llm = llm_llm
|
68 |
|
69 |
def load_trt(self, model_dir, use_fp16):
|
70 |
+
import tensorrt as trt
|
71 |
trt_file_name = 'estimator_fp16.plan' if use_fp16 else 'estimator_fp32.plan'
|
72 |
trt_file_path = os.path.join(model_dir, trt_file_name)
|
73 |
if not os.path.isfile(trt_file_path):
|
cosyvoice/flow/flow_matching.py
CHANGED
@@ -102,7 +102,6 @@ class ConditionalCFM(BASECFM):
|
|
102 |
if self.estimator is not None:
|
103 |
return self.estimator.forward(x, mask, mu, t, spks, cond)
|
104 |
else:
|
105 |
-
print("-----------")
|
106 |
assert self.training is False, 'tensorrt cannot be used in training'
|
107 |
bs = x.shape[0]
|
108 |
hs = x.shape[1]
|
|
|
102 |
if self.estimator is not None:
|
103 |
return self.estimator.forward(x, mask, mu, t, spks, cond)
|
104 |
else:
|
|
|
105 |
assert self.training is False, 'tensorrt cannot be used in training'
|
106 |
bs = x.shape[0]
|
107 |
hs = x.shape[1]
|