funasr-torch


Namefunasr-torch JSON
Version 0.0.4 PyPI version JSON
download
home_pagehttps://github.com/alibaba-damo-academy/FunASR.git
SummaryFunASR: A Fundamental End-to-End Speech Recognition Toolkit
upload_time2023-04-14 15:21:25
maintainer
docs_urlNone
authorSpeech Lab, Alibaba Group, China
requires_python
licenseThe MIT License
keywords funasr paraformer funasr_torch
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Using funasr with libtorch

[FunASR](https://github.com/alibaba-damo-academy/FunASR) hopes to build a bridge between academic research and industrial applications on speech recognition. By supporting the training & finetuning of the industrial-grade speech recognition model released on ModelScope, researchers and developers can conduct research and production of speech recognition models more conveniently, and promote the development of speech recognition ecology. ASR for Fun!


### Steps:
1. Export the model.
   - Command: (`Tips`: torch >= 1.11.0 is required.)

       More details ref to ([export docs](https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/export))

       - `e.g.`, Export model from modelscope
         ```shell
         python -m funasr.export.export_model --model-name damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch --export-dir ./export --type torch --quantize False
         ```
       - `e.g.`, Export model from local path, the model'name must be `model.pb`.
         ```shell
         python -m funasr.export.export_model --model-name ./damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch --export-dir ./export --type torch --quantize False
         ```


2. Install the `funasr_torch`.
    
    install from pip
    ```shell
    pip install --upgrade funasr_torch -i https://pypi.Python.org/simple
    ```
    or install from source code

    ```shell
    git clone https://github.com/alibaba/FunASR.git && cd FunASR
    cd funasr/runtime/python/libtorch
    pip install -e ./
    ```

3. Run the demo.
   - Model_dir: the model path, which contains `model.torchscripts`, `config.yaml`, `am.mvn`.
   - Input: wav formt file, support formats: `str, np.ndarray, List[str]`
   - Output: `List[str]`: recognition result.
   - Example:
        ```python
        from funasr_torch import Paraformer

        model_dir = "/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
        model = Paraformer(model_dir, batch_size=1)

        wav_path = ['/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav']

        result = model(wav_path)
        print(result)
        ```

## Performance benchmark

Please ref to [benchmark](https://github.com/alibaba-damo-academy/FunASR/blob/main/funasr/runtime/python/benchmark_libtorch.md)

## Speed

Environment:Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz

Test [wav, 5.53s, 100 times avg.](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav)

| Backend  | RTF (FP32) |
|:--------:|:----------:|
| Pytorch  |   0.110    |
| Libtorch |   0.048    |
|   Onnx   |   0.038    |

## Acknowledge
This project is maintained by [FunASR community](https://github.com/alibaba-damo-academy/FunASR).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/alibaba-damo-academy/FunASR.git",
    "name": "funasr-torch",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "funasr,paraformer, funasr_torch",
    "author": "Speech Lab, Alibaba Group, China",
    "author_email": "funasr@list.alibaba-inc.com",
    "download_url": "https://files.pythonhosted.org/packages/a3/c8/6c21fe6dfa610990d05a71ee759d19960e6be4675c12403f9e5e955caafb/funasr_torch-0.0.4.tar.gz",
    "platform": "Any",
    "description": "## Using funasr with libtorch\n\n[FunASR](https://github.com/alibaba-damo-academy/FunASR) hopes to build a bridge between academic research and industrial applications on speech recognition. By supporting the training & finetuning of the industrial-grade speech recognition model released on ModelScope, researchers and developers can conduct research and production of speech recognition models more conveniently, and promote the development of speech recognition ecology. ASR for Fun\uff01\n\n\n### Steps:\n1. Export the model.\n   - Command: (`Tips`: torch >= 1.11.0 is required.)\n\n       More details ref to ([export docs](https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/export))\n\n       - `e.g.`, Export model from modelscope\n         ```shell\n         python -m funasr.export.export_model --model-name damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch --export-dir ./export --type torch --quantize False\n         ```\n       - `e.g.`, Export model from local path, the model'name must be `model.pb`.\n         ```shell\n         python -m funasr.export.export_model --model-name ./damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch --export-dir ./export --type torch --quantize False\n         ```\n\n\n2. Install the `funasr_torch`.\n    \n    install from pip\n    ```shell\n    pip install --upgrade funasr_torch -i https://pypi.Python.org/simple\n    ```\n    or install from source code\n\n    ```shell\n    git clone https://github.com/alibaba/FunASR.git && cd FunASR\n    cd funasr/runtime/python/libtorch\n    pip install -e ./\n    ```\n\n3. Run the demo.\n   - Model_dir: the model path, which contains `model.torchscripts`, `config.yaml`, `am.mvn`.\n   - Input: wav formt file, support formats: `str, np.ndarray, List[str]`\n   - Output: `List[str]`: recognition result.\n   - Example:\n        ```python\n        from funasr_torch import Paraformer\n\n        model_dir = \"/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch\"\n        model = Paraformer(model_dir, batch_size=1)\n\n        wav_path = ['/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav']\n\n        result = model(wav_path)\n        print(result)\n        ```\n\n## Performance benchmark\n\nPlease ref to [benchmark](https://github.com/alibaba-damo-academy/FunASR/blob/main/funasr/runtime/python/benchmark_libtorch.md)\n\n## Speed\n\nEnvironment\uff1aIntel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz\n\nTest [wav, 5.53s, 100 times avg.](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav)\n\n| Backend  | RTF (FP32) |\n|:--------:|:----------:|\n| Pytorch  |   0.110    |\n| Libtorch |   0.048    |\n|   Onnx   |   0.038    |\n\n## Acknowledge\nThis project is maintained by [FunASR community](https://github.com/alibaba-damo-academy/FunASR).\n",
    "bugtrack_url": null,
    "license": "The MIT License",
    "summary": "FunASR: A Fundamental End-to-End Speech Recognition Toolkit",
    "version": "0.0.4",
    "split_keywords": [
        "funasr",
        "paraformer",
        " funasr_torch"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f83cfe1c89e7a7ab68848d8eb7f1f6d45ecb55d8a939cecbc3f400747c93f365",
                "md5": "01dc738634e2f67f9737f9a826f615f5",
                "sha256": "8276af8bfba9d6344c03d7c67750080123a496268e0889b06712ba4dab08dff7"
            },
            "downloads": -1,
            "filename": "funasr_torch-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "01dc738634e2f67f9737f9a826f615f5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 2465,
            "upload_time": "2023-04-14T15:21:23",
            "upload_time_iso_8601": "2023-04-14T15:21:23.004740Z",
            "url": "https://files.pythonhosted.org/packages/f8/3c/fe1c89e7a7ab68848d8eb7f1f6d45ecb55d8a939cecbc3f400747c93f365/funasr_torch-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a3c86c21fe6dfa610990d05a71ee759d19960e6be4675c12403f9e5e955caafb",
                "md5": "d3762156f3a20dc2fe03d569a33f846d",
                "sha256": "41785e73674326ff147551f09b8b64efe3d0b6d6ddc23cef3d46388b3582423e"
            },
            "downloads": -1,
            "filename": "funasr_torch-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "d3762156f3a20dc2fe03d569a33f846d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2544,
            "upload_time": "2023-04-14T15:21:25",
            "upload_time_iso_8601": "2023-04-14T15:21:25.109963Z",
            "url": "https://files.pythonhosted.org/packages/a3/c8/6c21fe6dfa610990d05a71ee759d19960e6be4675c12403f9e5e955caafb/funasr_torch-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-14 15:21:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "alibaba-damo-academy",
    "github_project": "FunASR.git",
    "lcname": "funasr-torch"
}
        
Elapsed time: 0.08873s