Skip to main content

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()

依赖

  • fasr
  • funasr
  • 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

fasr_punc_ct_transformer-0.4.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fasr_punc_ct_transformer-0.4.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file fasr_punc_ct_transformer-0.4.0.tar.gz.

File metadata

  • Download URL: fasr_punc_ct_transformer-0.4.0.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

Hashes for fasr_punc_ct_transformer-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e23bb652c15ff3b83b71b53ff8a442c675359fc3e78fe4265542b14f405bf0d4
MD5 6df82973ebcd0ebc918fcf4a883868c3
BLAKE2b-256 41459c699b6b450736043060ce38aecf9821c65b20ed8d71f19a7f8157b6add9

See more details on using hashes here.

File details

Details for the file fasr_punc_ct_transformer-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: fasr_punc_ct_transformer-0.4.0-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

Hashes for fasr_punc_ct_transformer-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55bea2cdd14e19a39bcf27721b5b13fe81436d3d7a730a7cebcbdd66fd342b5d
MD5 9884a36e6588771b93152ade7230f5c6
BLAKE2b-256 6f5ad906de4dbfd4a52ce09037399d3e7a5c7774c84d59f47961bf002ffc100c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page