{"id":22603481,"url":"https://github.com/1ytic/pytorch-edit-distance","last_synced_at":"2025-06-19T12:34:02.108Z","repository":{"id":57476488,"uuid":"219220843","full_name":"1ytic/pytorch-edit-distance","owner":"1ytic","description":"Levenshtein edit-distance on PyTorch and CUDA","archived":false,"fork":false,"pushed_at":"2023-01-24T21:06:51.000Z","size":10,"stargazers_count":95,"open_issues_count":4,"forks_count":14,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-20T13:09:20.791Z","etag":null,"topics":["asr","cuda","edit-distance","levenshtein","nlp","pytorch"],"latest_commit_sha":null,"homepage":null,"language":"Cuda","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1ytic.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}},"created_at":"2019-11-02T22:16:50.000Z","updated_at":"2025-04-15T13:38:27.000Z","dependencies_parsed_at":"2023-02-14T01:25:12.455Z","dependency_job_id":null,"html_url":"https://github.com/1ytic/pytorch-edit-distance","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/1ytic/pytorch-edit-distance","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1ytic%2Fpytorch-edit-distance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1ytic%2Fpytorch-edit-distance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1ytic%2Fpytorch-edit-distance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1ytic%2Fpytorch-edit-distance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1ytic","download_url":"https://codeload.github.com/1ytic/pytorch-edit-distance/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1ytic%2Fpytorch-edit-distance/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260751394,"owners_count":23057136,"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","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":["asr","cuda","edit-distance","levenshtein","nlp","pytorch"],"created_at":"2024-12-08T13:06:29.128Z","updated_at":"2025-06-19T12:33:57.091Z","avatar_url":"https://github.com/1ytic.png","language":"Cuda","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyTorch edit-distance functions\n\nUseful functions for E2E Speech Recognition training with PyTorch and CUDA.\n\nHere is a simple use case with Reinforcement Learning and RNN-T loss:\n\n```python\nblank = torch.tensor([0], dtype=torch.int).cuda()\nspace = torch.tensor([1], dtype=torch.int).cuda()\n\nxs = model.greedy_decode(xs, sampled=True)\n\ntorch_edit_distance.remove_blank(xs, xn, blank)\n\nrewards = 1 - torch_edit_distance.compute_wer(xs, ys, xn, yn, blank, space)\n\nnll = rnnt_loss(zs, ys, xn, yn)\n\nloss = nll * rewards\n```\n\n### levenshtein_distance\n\nLevenshtein edit-distance with detailed statistics for ins/del/sub operations.\n\n### collapse_repeated\n\nMerge repeated tokens, useful for CTC-based model.\n\n### remove_blank\n\nRemove unnecessary blank tokens, useful for CTC, RNN-T, RNA models.\n\n### strip_separator\n\nRemove leading, trailing and repeated middle separators.\n\n## Requirements\n\n- C++11 compiler (tested with GCC 9.4.0).\n- Python: 3.5, 3.6, 3.7, 3.8, 3.9 (tested with version 3.8).\n- [PyTorch](http://pytorch.org/) \u003e= 1.5.0 (tested with version 1.13.1+cu116).\n- [CUDA Toolkit](https://developer.nvidia.com/cuda-zone) (tested with version 11.2).\n\n## Install\n\nThere is no compiled version of the package. The following setup instructions compile the package from the source code locally.\n\n### From Pypi\n\n```bash\npip install torch_edit_distance\n```\n\n### From GitHub\n\n```bash\ngit clone https://github.com/1ytic/pytorch-edit-distance\ncd pytorch-edit-distance\npython setup.py install\n```\n\n## Test\n\n```bash\npython -m torch_edit_distance.test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1ytic%2Fpytorch-edit-distance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1ytic%2Fpytorch-edit-distance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1ytic%2Fpytorch-edit-distance/lists"}