mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
quant
This commit is contained in:
parent
8f8484bfa3
commit
b8b764df02
@ -24,12 +24,15 @@ class Paraformer():
|
|||||||
device_id: Union[str, int] = "-1",
|
device_id: Union[str, int] = "-1",
|
||||||
plot_timestamp_to: str = "",
|
plot_timestamp_to: str = "",
|
||||||
pred_bias: int = 1,
|
pred_bias: int = 1,
|
||||||
|
quantize: bool = False,
|
||||||
):
|
):
|
||||||
|
|
||||||
if not Path(model_dir).exists():
|
if not Path(model_dir).exists():
|
||||||
raise FileNotFoundError(f'{model_dir} does not exist.')
|
raise FileNotFoundError(f'{model_dir} does not exist.')
|
||||||
|
|
||||||
model_file = os.path.join(model_dir, 'model.torchscripts')
|
model_file = os.path.join(model_dir, 'model.torchscripts')
|
||||||
|
if quantize:
|
||||||
|
model_file = os.path.join(model_dir, 'model_quant.torchscripts')
|
||||||
config_file = os.path.join(model_dir, 'config.yaml')
|
config_file = os.path.join(model_dir, 'config.yaml')
|
||||||
cmvn_file = os.path.join(model_dir, 'am.mvn')
|
cmvn_file = os.path.join(model_dir, 'am.mvn')
|
||||||
config = read_yaml(config_file)
|
config = read_yaml(config_file)
|
||||||
|
|||||||
@ -26,12 +26,15 @@ class Paraformer():
|
|||||||
device_id: Union[str, int] = "-1",
|
device_id: Union[str, int] = "-1",
|
||||||
plot_timestamp_to: str = "",
|
plot_timestamp_to: str = "",
|
||||||
pred_bias: int = 1,
|
pred_bias: int = 1,
|
||||||
|
quantize: bool = False,
|
||||||
):
|
):
|
||||||
|
|
||||||
if not Path(model_dir).exists():
|
if not Path(model_dir).exists():
|
||||||
raise FileNotFoundError(f'{model_dir} does not exist.')
|
raise FileNotFoundError(f'{model_dir} does not exist.')
|
||||||
|
|
||||||
model_file = os.path.join(model_dir, 'model.onnx')
|
model_file = os.path.join(model_dir, 'model.onnx')
|
||||||
|
if quantize:
|
||||||
|
model_file = os.path.join(model_dir, 'model_quant.onnx')
|
||||||
config_file = os.path.join(model_dir, 'config.yaml')
|
config_file = os.path.join(model_dir, 'config.yaml')
|
||||||
cmvn_file = os.path.join(model_dir, 'am.mvn')
|
cmvn_file = os.path.join(model_dir, 'am.mvn')
|
||||||
config = read_yaml(config_file)
|
config = read_yaml(config_file)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user