ct-transformer punctuation model for fasr
Project description
fasr-punc-ct-transformer
基于 CT-Transformer 的标点恢复模型插件,为 fasr 提供中英文混合标点恢复能力。
安装
pip install fasr-punc-ct-transformer
注册模型
| 注册名 | 类 | 默认 checkpoint | 说明 |
|---|---|---|---|
ct_transformer |
CTTransformerForPunc |
iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch |
CT-Transformer 标点恢复,支持中英文混合 |
模型权重默认从 ModelScope 自动下载。
使用方式
在流水线中使用
标点模型通常作为 sentencizer 组件在流水线末端使用:
from fasr import AudioPipeline
pipeline = (
AudioPipeline()
.add_pipe("detector", model="fsmn")
.add_pipe("recognizer", model="paraformer")
.add_pipe("sentencizer", model="ct_transformer")
)
单独使用模型
from fasr.config import registry
model = registry.punc_models.get("ct_transformer")()
model.from_checkpoint()
spans = model.restore("今天天气真好我想出去玩你觉得呢")
for span in spans:
print(span.text) # 带标点的句子
from_checkpoint 参数
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
checkpoint_dir |
str | Path | None |
None(自动下载) |
模型权重目录 |
disable_update |
bool |
True |
禁用 FunASR 自动更新检查 |
disable_log |
bool |
True |
禁用 FunASR 日志输出 |
disable_pbar |
bool |
True |
禁用进度条 |
额外 **kwargs 会直接传递给 funasr.AutoModel()。
依赖
fasrfunasr- Python 3.10–3.12
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fasr_punc_ct_transformer-0.3.9.tar.gz.
File metadata
- Download URL: fasr_punc_ct_transformer-0.3.9.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
246f7b8d422519c642bfa8b79e3252bbec92d6a69c380190ec13ee83b6c9ea18
|
|
| MD5 |
1c8583eca8cab8e455d5813e6dcf79c2
|
|
| BLAKE2b-256 |
d9bbddc88492747e48a1df9f94ba7df34b3afeffa0c0490d12eea6ce99951bf1
|
File details
Details for the file fasr_punc_ct_transformer-0.3.9-py3-none-any.whl.
File metadata
- Download URL: fasr_punc_ct_transformer-0.3.9-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d61cab702cfbe0cf8df0610af75aff4eb0e57cae6abd7b26c42e81ffe54644a9
|
|
| MD5 |
d2f71ad0f9b47b29b70f3615e2a1b215
|
|
| BLAKE2b-256 |
f319b9307b0a99870e3f13fc3d16ee6c59363df102f0daadd40a36a393df7b1e
|