lintoai/linto-diarization-pybkLinTO-diarization is the LinTO service for speaker diarization.
LinTO-diarization can either be used as a standalone diarization service or deployed as a micro-services.
Prerequisites
Deploy
Usage
License
The transcription service requires docker up and running.
The diarization only entry point in job mode are tasks posted on a Redis message broker. Futhermore, to prevent large audio from transiting through the message broker, diarization uses a shared storage folder mounted on /opt/audio.
linto-diarization can be deployed:
1- First step is to build the image:
bashgit clone [***] cd linto-diarization docker build . -t linto-diarization-pybk:latest -f pybk/Dockerfile
1- Fill the .env
An example of .env file is provided in pybk/.envdefault.
Parameters:
| Variables | Description | Example |
|---|---|---|
| SERVING_MODE | Specify launch mode | http |
| CONCURRENCY | Number of HTTP worker* | 1+ |
2- Run the container
bashdocker run --rm \ -v SHARED_FOLDER:/opt/audio \ -p HOST_SERVING_PORT:80 \ --env-file .env \ linto-diarization:latest
This will run a container providing an http API binded on the host HOST_SERVING_PORT port.
Parameters:
| Variables | Description | Example |
|---|---|---|
| HOST_SERVING_PORT | Host serving port | 80 |
*diarization uses all CPU available, adding workers will share the available CPU thus decreasing processing speed for concurrent requests
LinTO-diarization can be deployed as a micro-service using celery. Used this way, the container spawn celery worker waiting for diarization task on a message broker.
You need a message broker up and running at SERVICES_BROKER.
1- Fill the .env
An example of .env file is provided in pybk/.envdefault.
Parameters:
| Variables | Description | Example |
|---|---|---|
| SERVING_MODE | Specify launch mode | task |
| SERVICES_BROKER | Service broker uri | redis://my_redis_broker:6379 |
| BROKER_PASS | Service broker password (Leave empty if there is no password) | my_password |
| QUEUE_NAME | (Optional) overide the generated queue's name (See Queue name bellow) | my_queue |
| SERVICE_NAME | Service's name | diarization-ml |
| LANGUAGE | Language code as a BCP-47 code | en-US or * or languages separated by "|" |
| MODEL_INFO | Human readable description of the model | Multilingual diarization model |
| CONCURRENCY | Number of worker (1 worker = 1 cpu) | >1 |
2- Fill the docker-compose.yml
#docker-compose.yml
yamlversion: '3.7' services: punctuation-service: image: linto-diarization-pybk:latest volumes: - /path/to/shared/folder:/opt/audio env_file: .env deploy: replicas: 1 networks: - your-net networks: your-net: external: true
3- Run with docker compose
bashdocker stack deploy --resolve-image always --compose-file docker-compose.yml your_stack
Queue name:
By default the service queue name is generated using SERVICE_NAME and LANGUAGE: diarization_{LANGUAGE}_{SERVICE_NAME}.
The queue name can be overided using the QUEUE_NAME env variable.
Service discovery:
As a micro-service, the instance will register itself in the service registry for discovery. The service information are stored as a JSON object in redis's db0 under the id service:{HOST_NAME}.
The following information are registered:
json{ "service_name": $SERVICE_NAME, "host_name": $HOST_NAME, "service_type": "diarization", "service_language": $LANGUAGE, "queue_name": $QUEUE_NAME, "version": "1.2.0", # This repository's version "info": $MODEL_INFO, "last_alive": 65478213, "concurrency": 1 }
Returns the state of the API
Method: GET
Returns "1" if healthcheck passes.
Diarization API
Return a json object when using structured as followed:
json{ "speakers": [ {"spk_id": "spk5", "duration": 2.0, "nbr_seg": 1}, ... ], "segments": [ {"seg_id": 1, "spk_id": "spk5", "seg_begin": 0.0, "seg_end": 2.0}, ... ] }
The /docs route offers a OpenAPI/swagger interface.
Diarization worker accepts requests with the following arguments:
file_path: (str) Is the location of the file within the shared_folder. /.../SHARED_FOLDER/{file_path}speaker_count: (int default None) Fixed number of speakers.max_speaker: (int default None) Max number of speaker if speaker_count=None.On a successfull transcription the returned object is a json object structured as follow:
json{ "speakers": [ {"spk_id": "spk5", "duration": 2.0, "nbr_seg": 1}, ... ], "segments": [ {"seg_id": 1, "spk_id": "spk5", "seg_begin": 0.0, "seg_end": 2.0}, ... ] }
speakers field contains an arraw of speaker with overall duration and number of segments.segments field contains each audio segment with the associated speaker id start time and end time.You can test you http API using curl:
bashcurl -X POST "[***]" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@YOUR_FILE.wav;type=audio/x-wav" -F "speaker_count=NUMBER_OF_SPEAKERS"
This project is developped under the AGPLv3 License (see LICENSE).
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像服务
在 Docker Desktop 配置镜像
Docker Compose 项目配置
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
MacOS OrbStack 容器配置
在宝塔面板一键配置镜像
Synology 群晖 NAS 配置
飞牛 fnOS 系统配置镜像
极空间 NAS 系统配置服务
爱快 iKuai 路由系统配置
绿联 NAS 系统配置镜像
QNAP 威联通 NAS 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
来自真实用户的反馈,见证轩辕镜像的优质服务