{"id":17923185,"url":"https://github.com/awni/transducer","last_synced_at":"2025-07-27T03:10:11.230Z","repository":{"id":150056610,"uuid":"116437879","full_name":"awni/transducer","owner":"awni","description":"A Fast Sequence Transducer Implementation with PyTorch Bindings ","archived":false,"fork":false,"pushed_at":"2022-09-20T16:15:37.000Z","size":169,"stargazers_count":198,"open_issues_count":4,"forks_count":36,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-04T20:09:55.732Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-05T23:38:58.000Z","updated_at":"2025-03-12T20:44:48.000Z","dependencies_parsed_at":"2023-04-14T02:16:46.697Z","dependency_job_id":null,"html_url":"https://github.com/awni/transducer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/awni/transducer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awni%2Ftransducer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awni%2Ftransducer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awni%2Ftransducer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awni%2Ftransducer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awni","download_url":"https://codeload.github.com/awni/transducer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awni%2Ftransducer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267293818,"owners_count":24065327,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-28T20:42:28.479Z","updated_at":"2025-07-27T03:10:11.210Z","avatar_url":"https://github.com/awni.png","language":"C++","funding_links":[],"categories":["Paper implementations｜论文实现","Paper implementations"],"sub_categories":["Other libraries｜其他库:","Other libraries:"],"readme":"# transducer\n\nA fast RNN-Transducer implementation on the CPU and GPU (CUDA) with python\nbindings and a PyTorch extension. The RNN-T loss function was published in\n[Sequence Transduction with Recurrent Neural Networks](https://arxiv.org/abs/1211.3711).\n\nThe code has been tested with Python 3.9 and PyTorch 1.9.\n\n## Install and Test\n\nTo install from the top level of the repo run:\n\n```\npython setup.py install\n```\n\nTo use the PyTorch extension, install [PyTorch](http://pytorch.org/)\nand test with:\n\n```\npython torch_test.py\n```\n\n## Usage\n\nThe easiest way to use the transducer loss is with the PyTorch bindings:\n\n```\ncriterion = transducer.TransducerLoss()\nloss = criterion(emissions, predictions, labels, input_lengths, label_lengths)\n```\n\nThe loss will run on the same device as the input tensors. For more\ninformation, see the [criterion\ndocumentation](https://github.com/awni/transducer/blob/0d3187718653a26afe58cce00a804e27d0a01909/transducer/torch_binding.py#L60).\n\nTo get the \"teacher forced\" best path:\n\n```\npredicted_labels = criterion.viterbi(emissions, predictions, input_lengths, label_lengths)\n```\n\n## Memory Use and Benchmarks\n\nThe transducer is designed to be much lighter in memory use. Most\nimplementations use memory which scales with the product `B * T * U * V` (where\n`B` is the batch size, `T` is the maximum input length in the batch, `U` is the\nmaximum output length in the batch, and `V` is the token set size). The memory\nof this implementation scales with the product `B * T * U` and does not\nincrease with the token set size. This is particularly important for the large\ntoken set sizes commonly used with word pieces. (**NB** In this implementation you\ncannot use a \"joiner\" network to connect the outputs of the transcription and\nprediction models. The algorithm hardcodes the fact that these are additively\ncombined.)\n\nPerformance benchmarks for the CUDA version running on an A100 GPU are below.\nWe compare to the [Torch Audio RNN-T\nloss](https://pytorch.org/audio/stable/functional.html#rnnt-loss) which was\nalso run on the same A100 GPU. An entry of \"OOM\" means the implementation ran\nout of memory (in this case 20GB).\n\nTimes are reported in milliseconds. \n\n#### T=2000, U=100, B=8\n\n| V     | Transducer | Torch Audio |\n| ----- | ---------- | ----------- |\n| 100   | 8.18       | 139.26      |\n| 1000  | 13.64      | OOM         |\n| 2000  | 18.83      | OOM         |\n| 10000 | 59.18      | OOM         |\n\n#### T=2000, U=100, B=32\n\n| V     | Transducer | Torch Audio |\n| ----- | ---------- | ----------- |\n| 100   | 20.58      | 555.00      |\n| 1000  | 38.42      | OOM         |\n| 2000  | 58.19      | OOM         |\n| 10000 | 223.33     | OOM         |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawni%2Ftransducer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawni%2Ftransducer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawni%2Ftransducer/lists"}