{"id":13958546,"url":"https://github.com/sooftware/conformer","last_synced_at":"2025-05-16T08:05:17.143Z","repository":{"id":41163141,"uuid":"331677971","full_name":"sooftware/conformer","owner":"sooftware","description":"[Unofficial] PyTorch implementation of \"Conformer: Convolution-augmented Transformer for Speech Recognition\" (INTERSPEECH 2020)","archived":false,"fork":false,"pushed_at":"2023-12-22T07:54:23.000Z","size":2946,"stargazers_count":1018,"open_issues_count":21,"forks_count":184,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-08T20:18:11.767Z","etag":null,"topics":["asr","augmented","cnn","conformer","conv","convolution","pytorch","recognition","speech","speech-recognition","transformer","transformer-xl"],"latest_commit_sha":null,"homepage":"","language":"Python","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/sooftware.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":"2021-01-21T15:57:20.000Z","updated_at":"2025-04-08T18:26:11.000Z","dependencies_parsed_at":"2023-01-21T08:46:33.707Z","dependency_job_id":"ff848680-2b45-4595-b409-69a4c47662d2","html_url":"https://github.com/sooftware/conformer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooftware%2Fconformer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooftware%2Fconformer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooftware%2Fconformer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooftware%2Fconformer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sooftware","download_url":"https://codeload.github.com/sooftware/conformer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493378,"owners_count":22080126,"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","augmented","cnn","conformer","conv","convolution","pytorch","recognition","speech","speech-recognition","transformer","transformer-xl"],"created_at":"2024-08-08T13:01:42.960Z","updated_at":"2025-05-16T08:05:12.134Z","avatar_url":"https://github.com/sooftware.png","language":"Python","readme":"\u003cp  align=\"center\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/42150335/105607164-aa878e00-5de0-11eb-8474-a12dd6ac919b.png\" height=100\u003e\n  \n\n\u003cdiv align=\"center\"\u003e\n\n**PyTorch implementation of Conformer: Convolution-augmented Transformer for Speech Recognition.**\n\n  \n\u003c/div\u003e\n\n***\n\n\u003cp  align=\"center\"\u003e \n     \u003ca href=\"https://github.com/sooftware/jasper/blob/main/LICENSE\"\u003e\n          \u003cimg src=\"http://img.shields.io/badge/license-Apache--2.0-informational\"\u003e \n     \u003c/a\u003e\n     \u003ca href=\"https://github.com/pytorch/pytorch\"\u003e\n          \u003cimg src=\"http://img.shields.io/badge/framework-PyTorch-informational\"\u003e \n     \u003c/a\u003e\n     \u003ca href=\"https://www.python.org/dev/peps/pep-0008/\"\u003e\n          \u003cimg src=\"http://img.shields.io/badge/codestyle-PEP--8-informational\"\u003e \n     \u003c/a\u003e\n     \u003ca href=\"https://github.com/sooftware/conformer\"\u003e\n          \u003cimg src=\"http://img.shields.io/badge/build-passing-success\"\u003e \n     \u003c/a\u003e\n\n  \nTransformer models are good at capturing content-based global interactions, while CNNs exploit local features effectively. Conformer combine convolution neural networks and transformers to model both local and global dependencies of an audio sequence in a parameter-efficient way. Conformer significantly outperforms the previous Transformer and CNN based models achieving state-of-the-art accuracies.   \n\n\u003cimg src=\"https://user-images.githubusercontent.com/42150335/105602364-aeafad80-5dd8-11eb-8886-b75e2d9d31f4.png\" height=600\u003e\n  \nThis repository contains only model code, but you can train with conformer at [openspeech](https://github.com/openspeech-team/openspeech)\n  \n## Installation\nThis project recommends Python 3.7 or higher.\nWe recommend creating a new virtual environment for this project (using virtual env or conda).\n  \n### Prerequisites\n* Numpy: `pip install numpy` (Refer [here](https://github.com/numpy/numpy) for problem installing Numpy).\n* Pytorch: Refer to [PyTorch website](http://pytorch.org/) to install the version w.r.t. your environment.  \n  \n### Install from source\nCurrently we only support installation from source code using setuptools. Checkout the source code and run the\nfollowing commands:  \n  \n```\npip install -e .\n```\n\n## Usage\n\n```python\nimport torch\nimport torch.nn as nn\nfrom conformer import Conformer\n\nbatch_size, sequence_length, dim = 3, 12345, 80\n\ncuda = torch.cuda.is_available()  \ndevice = torch.device('cuda' if cuda else 'cpu')\n\ncriterion = nn.CTCLoss().to(device)\n\ninputs = torch.rand(batch_size, sequence_length, dim).to(device)\ninput_lengths = torch.LongTensor([12345, 12300, 12000])\ntargets = torch.LongTensor([[1, 3, 3, 3, 3, 3, 4, 5, 6, 2],\n                            [1, 3, 3, 3, 3, 3, 4, 5, 2, 0],\n                            [1, 3, 3, 3, 3, 3, 4, 2, 0, 0]]).to(device)\ntarget_lengths = torch.LongTensor([9, 8, 7])\n\nmodel = Conformer(num_classes=10, \n                  input_dim=dim, \n                  encoder_dim=32, \n                  num_encoder_layers=3).to(device)\n\n# Forward propagate\noutputs, output_lengths = model(inputs, input_lengths)\n\n# Calculate CTC Loss\nloss = criterion(outputs.transpose(0, 1), targets, output_lengths, target_lengths)\n```\n  \n## Troubleshoots and Contributing\nIf you have any questions, bug reports, and feature requests, please [open an issue](https://github.com/sooftware/conformer/issues) on github or   \ncontacts sh951011@gmail.com please.\n  \nI appreciate any kind of feedback or contribution.  Feel free to proceed with small issues like bug fixes, documentation improvement.  For major contributions and new features, please discuss with the collaborators in corresponding issues.  \n  \n## Code Style\nI follow [PEP-8](https://www.python.org/dev/peps/pep-0008/) for code style. Especially the style of docstrings is important to generate documentation.  \n  \n## Reference\n- [Conformer: Convolution-augmented Transformer for Speech Recognition](https://arxiv.org/pdf/2005.08100.pdf)\n- [Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context](https://arxiv.org/abs/1901.02860)\n- [kimiyoung/transformer-xl](https://github.com/kimiyoung/transformer-xl)\n- [espnet/espnet](https://github.com/espnet/espnet)\n  \n## Author\n  \n* Soohwan Kim [@sooftware](https://github.com/sooftware)\n* Contacts: sh951011@gmail.com\n","funding_links":[],"categories":["语音识别"],"sub_categories":["网络服务_其他"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsooftware%2Fconformer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsooftware%2Fconformer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsooftware%2Fconformer/lists"}