prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  DLL load failed while importing _wenet: 找不到指定的模块。
  我安装了wenet, pip install wenet.
  安装提示成功了。
  我用例子程序做识别。
  程序如下：
  import sys
  import wenet
  
  def get_text_from_wav(dir, wav):
      model_dir = dir
      wav_file = wav
      decoder = wenet.Decoder(model_dir)
      ans = decoder.decode_wav(wav_file)
      print(ans)
  
  if __name__ == '__main__':
      dir = "./models"
      wav = "./1.wav"
      get_text_from_wav(dir,wav)
  
  但是运行报错如下：
  Traceback (most recent call last):
    File "D:\codes\speech2word\main.py", line 2, in <module>
      import wenet
    File "D:\codes\speech2word\venv\lib\site-packages\wenet\__init__.py", line 1, in <module>
      from .decoder import Decoder  # noqa
    File "D:\codes\speech2word\venv\lib\site-packages\wenet\decoder.py", line 17, in <module>
      import _wenet
  ImportError: DLL load failed while importing _wenet: 找不到指定的模块。
  
  请问如何解决？
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `runtime/binding/python/setup.py`
  Content:
  ```
  1 #!/usr/bin/env python3
  2 # Copyright (c)  2020  Xiaomi Corporation (author: Fangjun Kuang)
  3 #                2022  Binbin Zhang(binbzha@qq.com)
  4 
  5 import glob
  6 import os
  7 import platform
  8 import shutil
  9 import sys
  10 
  11 import setuptools
  12 from setuptools.command.build_ext import build_ext
  13 
  14 
  15 def is_windows():
  16     return platform.system() == "Windows"
  17 
  18 
  19 def cmake_extension(name, *args, **kwargs) -> setuptools.Extension:
  20     kwargs["language"] = "c++"
  21     sources = []
  22     return setuptools.Extension(name, sources, *args, **kwargs)
  23 
  24 
  25 class BuildExtension(build_ext):
  26     def build_extension(self, ext: setuptools.extension.Extension):
  27         os.makedirs(self.build_temp, exist_ok=True)
  28         os.makedirs(self.build_lib, exist_ok=True)
  29 
  30         cmake_args = os.environ.get("WENET_CMAKE_ARGS",
  31                                     "-DCMAKE_BUILD_TYPE=Release")
  32         if "PYTHON_EXECUTABLE" not in cmake_args:
  33             print(f"Setting PYTHON_EXECUTABLE to {sys.executable}")
  34             cmake_args += f" -DPYTHON_EXECUTABLE={sys.executable}"
  35 
  36         src_dir = os.path.dirname(os.path.abspath(__file__))
  37         os.system(f"cmake {cmake_args} -B {self.build_temp} -S {src_dir}")
  38         ret = os.system(f"""
  39             cmake --build {self.build_temp} --target _wenet --config Release
  40         """)
  41         if ret != 0:
  42             raise Exception(
  43                 "\nBuild wenet failed. Please check the error message.\n"
  44                 "You can ask for help by creating an issue on GitHub.\n"
  45                 "\nClick:\n    https://github.com/wenet-e2e/wenet/issues/new\n"
  46             )
  47 
  48         libs = []
  49         torch_lib = 'fc_base/libtorch-src/lib'
  50         for ext in ['so', 'pyd']:
  51             libs.extend(glob.glob(
  52                 f"{self.build_temp}/**/_wenet*.{ext}", recursive=True))
  53         for ext in ['so', 'dylib', 'dll']:
  54             libs.extend(glob.glob(
  55                 f"{self.build_temp}/**/*wenet_api.{ext}", recursive=True))
  56             libs.extend(glob.glob(f'{src_dir}/{torch_lib}/*c10.{ext}'))
  57             libs.extend(glob.glob(f'{src_dir}/{torch_lib}/*torch_cpu.{ext}'))
  58 
  59         if not is_windows():
  60             fst_lib = 'fc_base/openfst-build/src/lib/.libs'
  61             for ext in ['so', 'dylib']:
  62                 libs.extend(glob.glob(f'{src_dir}/{fst_lib}/libfst.{ext}'))
  63             libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libgomp*'))  # linux
  64             libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libiomp*'))  # macos
  65         else:
  66             libs.extend(glob.glob(f'{src_dir}/{torch_lib}/asmjit.dll'))
  67             libs.extend(glob.glob(f'{src_dir}/{torch_lib}/fbgemm.dll'))
  68             libs.extend(glob.glob(f'{src_dir}/{torch_lib}/uv.dll'))
  69 
  70         for lib in libs:
  71             print(f"Copying {lib} to {self.build_lib}/")
  72             shutil.copy(f"{lib}", f"{self.build_lib}/")
  73 
  74 
  75 def read_long_description():
  76     with open("README.md", encoding="utf8") as f:
  77         readme = f.read()
  78     return readme
  79 
  80 
  81 package_name = "wenet"
  82 
  83 setuptools.setup(
  84     name=package_name,
  85     version='1.0.4',
  86     author="Binbin Zhang",
  87     author_email="binbzha@qq.com",
  88     package_dir={
  89         package_name: "py",
  90     },
  91     packages=[package_name],
  92     url="https://github.com/wenet-e2e/wenet",
  93     long_description=read_long_description(),
  94     long_description_content_type="text/markdown",
  95     ext_modules=[cmake_extension("_wenet")],
  96     cmdclass={"build_ext": BuildExtension},
  97     zip_safe=False,
  98     classifiers=[
  99         "Programming Language :: C++",
  100         "Programming Language :: Python",
  101         "Topic :: Scientific/Engineering :: Artificial Intelligence",
  102     ],
  103     license="Apache licensed, as found in the LICENSE file",
  104     python_requires=">=3.6",
  105 )
  106
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/runtime/binding/python/setup.py b/runtime/binding/python/setup.py
  --- a/runtime/binding/python/setup.py
  +++ b/runtime/binding/python/setup.py
  @@ -60,12 +60,12 @@
               fst_lib = 'fc_base/openfst-build/src/lib/.libs'
               for ext in ['so', 'dylib']:
                   libs.extend(glob.glob(f'{src_dir}/{fst_lib}/libfst.{ext}'))
  -            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libgomp*'))  # linux
  -            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libiomp*'))  # macos
           else:
               libs.extend(glob.glob(f'{src_dir}/{torch_lib}/asmjit.dll'))
               libs.extend(glob.glob(f'{src_dir}/{torch_lib}/fbgemm.dll'))
               libs.extend(glob.glob(f'{src_dir}/{torch_lib}/uv.dll'))
  +        libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libgomp*'))  # linux
  +        libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libiomp5*'))  # macos/win
   
           for lib in libs:
               print(f"Copying {lib} to {self.build_lib}/")
  
verification_info: {"golden_diff": "diff --git a/runtime/binding/python/setup.py b/runtime/binding/python/setup.py\n--- a/runtime/binding/python/setup.py\n+++ b/runtime/binding/python/setup.py\n@@ -60,12 +60,12 @@\n             fst_lib = 'fc_base/openfst-build/src/lib/.libs'\n             for ext in ['so', 'dylib']:\n                 libs.extend(glob.glob(f'{src_dir}/{fst_lib}/libfst.{ext}'))\n-            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libgomp*'))  # linux\n-            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libiomp*'))  # macos\n         else:\n             libs.extend(glob.glob(f'{src_dir}/{torch_lib}/asmjit.dll'))\n             libs.extend(glob.glob(f'{src_dir}/{torch_lib}/fbgemm.dll'))\n             libs.extend(glob.glob(f'{src_dir}/{torch_lib}/uv.dll'))\n+        libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libgomp*'))  # linux\n+        libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libiomp5*'))  # macos/win\n \n         for lib in libs:\n             print(f\"Copying {lib} to {self.build_lib}/\")\n", "issue": "DLL load failed while importing _wenet: \u627e\u4e0d\u5230\u6307\u5b9a\u7684\u6a21\u5757\u3002\n\u6211\u5b89\u88c5\u4e86wenet, pip install wenet.\r\n\u5b89\u88c5\u63d0\u793a\u6210\u529f\u4e86\u3002\r\n\u6211\u7528\u4f8b\u5b50\u7a0b\u5e8f\u505a\u8bc6\u522b\u3002\r\n\u7a0b\u5e8f\u5982\u4e0b\uff1a\r\nimport sys\r\nimport wenet\r\n\r\ndef get_text_from_wav(dir, wav):\r\n    model_dir = dir\r\n    wav_file = wav\r\n    decoder = wenet.Decoder(model_dir)\r\n    ans = decoder.decode_wav(wav_file)\r\n    print(ans)\r\n\r\nif __name__ == '__main__':\r\n    dir = \"./models\"\r\n    wav = \"./1.wav\"\r\n    get_text_from_wav(dir,wav)\r\n\r\n\u4f46\u662f\u8fd0\u884c\u62a5\u9519\u5982\u4e0b\uff1a\r\nTraceback (most recent call last):\r\n  File \"D:\\codes\\speech2word\\main.py\", line 2, in <module>\r\n    import wenet\r\n  File \"D:\\codes\\speech2word\\venv\\lib\\site-packages\\wenet\\__init__.py\", line 1, in <module>\r\n    from .decoder import Decoder  # noqa\r\n  File \"D:\\codes\\speech2word\\venv\\lib\\site-packages\\wenet\\decoder.py\", line 17, in <module>\r\n    import _wenet\r\nImportError: DLL load failed while importing _wenet: \u627e\u4e0d\u5230\u6307\u5b9a\u7684\u6a21\u5757\u3002\r\n\r\n\u8bf7\u95ee\u5982\u4f55\u89e3\u51b3\uff1f\r\n\n", "before_files": [{"content": "#!/usr/bin/env python3\n# Copyright (c)  2020  Xiaomi Corporation (author: Fangjun Kuang)\n#                2022  Binbin Zhang(binbzha@qq.com)\n\nimport glob\nimport os\nimport platform\nimport shutil\nimport sys\n\nimport setuptools\nfrom setuptools.command.build_ext import build_ext\n\n\ndef is_windows():\n    return platform.system() == \"Windows\"\n\n\ndef cmake_extension(name, *args, **kwargs) -> setuptools.Extension:\n    kwargs[\"language\"] = \"c++\"\n    sources = []\n    return setuptools.Extension(name, sources, *args, **kwargs)\n\n\nclass BuildExtension(build_ext):\n    def build_extension(self, ext: setuptools.extension.Extension):\n        os.makedirs(self.build_temp, exist_ok=True)\n        os.makedirs(self.build_lib, exist_ok=True)\n\n        cmake_args = os.environ.get(\"WENET_CMAKE_ARGS\",\n                                    \"-DCMAKE_BUILD_TYPE=Release\")\n        if \"PYTHON_EXECUTABLE\" not in cmake_args:\n            print(f\"Setting PYTHON_EXECUTABLE to {sys.executable}\")\n            cmake_args += f\" -DPYTHON_EXECUTABLE={sys.executable}\"\n\n        src_dir = os.path.dirname(os.path.abspath(__file__))\n        os.system(f\"cmake {cmake_args} -B {self.build_temp} -S {src_dir}\")\n        ret = os.system(f\"\"\"\n            cmake --build {self.build_temp} --target _wenet --config Release\n        \"\"\")\n        if ret != 0:\n            raise Exception(\n                \"\\nBuild wenet failed. Please check the error message.\\n\"\n                \"You can ask for help by creating an issue on GitHub.\\n\"\n                \"\\nClick:\\n    https://github.com/wenet-e2e/wenet/issues/new\\n\"\n            )\n\n        libs = []\n        torch_lib = 'fc_base/libtorch-src/lib'\n        for ext in ['so', 'pyd']:\n            libs.extend(glob.glob(\n                f\"{self.build_temp}/**/_wenet*.{ext}\", recursive=True))\n        for ext in ['so', 'dylib', 'dll']:\n            libs.extend(glob.glob(\n                f\"{self.build_temp}/**/*wenet_api.{ext}\", recursive=True))\n            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/*c10.{ext}'))\n            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/*torch_cpu.{ext}'))\n\n        if not is_windows():\n            fst_lib = 'fc_base/openfst-build/src/lib/.libs'\n            for ext in ['so', 'dylib']:\n                libs.extend(glob.glob(f'{src_dir}/{fst_lib}/libfst.{ext}'))\n            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libgomp*'))  # linux\n            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libiomp*'))  # macos\n        else:\n            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/asmjit.dll'))\n            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/fbgemm.dll'))\n            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/uv.dll'))\n\n        for lib in libs:\n            print(f\"Copying {lib} to {self.build_lib}/\")\n            shutil.copy(f\"{lib}\", f\"{self.build_lib}/\")\n\n\ndef read_long_description():\n    with open(\"README.md\", encoding=\"utf8\") as f:\n        readme = f.read()\n    return readme\n\n\npackage_name = \"wenet\"\n\nsetuptools.setup(\n    name=package_name,\n    version='1.0.4',\n    author=\"Binbin Zhang\",\n    author_email=\"binbzha@qq.com\",\n    package_dir={\n        package_name: \"py\",\n    },\n    packages=[package_name],\n    url=\"https://github.com/wenet-e2e/wenet\",\n    long_description=read_long_description(),\n    long_description_content_type=\"text/markdown\",\n    ext_modules=[cmake_extension(\"_wenet\")],\n    cmdclass={\"build_ext\": BuildExtension},\n    zip_safe=False,\n    classifiers=[\n        \"Programming Language :: C++\",\n        \"Programming Language :: Python\",\n        \"Topic :: Scientific/Engineering :: Artificial Intelligence\",\n    ],\n    license=\"Apache licensed, as found in the LICENSE file\",\n    python_requires=\">=3.6\",\n)\n", "path": "runtime/binding/python/setup.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n# Copyright (c)  2020  Xiaomi Corporation (author: Fangjun Kuang)\n#                2022  Binbin Zhang(binbzha@qq.com)\n\nimport glob\nimport os\nimport platform\nimport shutil\nimport sys\n\nimport setuptools\nfrom setuptools.command.build_ext import build_ext\n\n\ndef is_windows():\n    return platform.system() == \"Windows\"\n\n\ndef cmake_extension(name, *args, **kwargs) -> setuptools.Extension:\n    kwargs[\"language\"] = \"c++\"\n    sources = []\n    return setuptools.Extension(name, sources, *args, **kwargs)\n\n\nclass BuildExtension(build_ext):\n    def build_extension(self, ext: setuptools.extension.Extension):\n        os.makedirs(self.build_temp, exist_ok=True)\n        os.makedirs(self.build_lib, exist_ok=True)\n\n        cmake_args = os.environ.get(\"WENET_CMAKE_ARGS\",\n                                    \"-DCMAKE_BUILD_TYPE=Release\")\n        if \"PYTHON_EXECUTABLE\" not in cmake_args:\n            print(f\"Setting PYTHON_EXECUTABLE to {sys.executable}\")\n            cmake_args += f\" -DPYTHON_EXECUTABLE={sys.executable}\"\n\n        src_dir = os.path.dirname(os.path.abspath(__file__))\n        os.system(f\"cmake {cmake_args} -B {self.build_temp} -S {src_dir}\")\n        ret = os.system(f\"\"\"\n            cmake --build {self.build_temp} --target _wenet --config Release\n        \"\"\")\n        if ret != 0:\n            raise Exception(\n                \"\\nBuild wenet failed. Please check the error message.\\n\"\n                \"You can ask for help by creating an issue on GitHub.\\n\"\n                \"\\nClick:\\n    https://github.com/wenet-e2e/wenet/issues/new\\n\"\n            )\n\n        libs = []\n        torch_lib = 'fc_base/libtorch-src/lib'\n        for ext in ['so', 'pyd']:\n            libs.extend(glob.glob(\n                f\"{self.build_temp}/**/_wenet*.{ext}\", recursive=True))\n        for ext in ['so', 'dylib', 'dll']:\n            libs.extend(glob.glob(\n                f\"{self.build_temp}/**/*wenet_api.{ext}\", recursive=True))\n            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/*c10.{ext}'))\n            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/*torch_cpu.{ext}'))\n\n        if not is_windows():\n            fst_lib = 'fc_base/openfst-build/src/lib/.libs'\n            for ext in ['so', 'dylib']:\n                libs.extend(glob.glob(f'{src_dir}/{fst_lib}/libfst.{ext}'))\n        else:\n            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/asmjit.dll'))\n            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/fbgemm.dll'))\n            libs.extend(glob.glob(f'{src_dir}/{torch_lib}/uv.dll'))\n        libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libgomp*'))  # linux\n        libs.extend(glob.glob(f'{src_dir}/{torch_lib}/libiomp5*'))  # macos/win\n\n        for lib in libs:\n            print(f\"Copying {lib} to {self.build_lib}/\")\n            shutil.copy(f\"{lib}\", f\"{self.build_lib}/\")\n\n\ndef read_long_description():\n    with open(\"README.md\", encoding=\"utf8\") as f:\n        readme = f.read()\n    return readme\n\n\npackage_name = \"wenet\"\n\nsetuptools.setup(\n    name=package_name,\n    version='1.0.4',\n    author=\"Binbin Zhang\",\n    author_email=\"binbzha@qq.com\",\n    package_dir={\n        package_name: \"py\",\n    },\n    packages=[package_name],\n    url=\"https://github.com/wenet-e2e/wenet\",\n    long_description=read_long_description(),\n    long_description_content_type=\"text/markdown\",\n    ext_modules=[cmake_extension(\"_wenet\")],\n    cmdclass={\"build_ext\": BuildExtension},\n    zip_safe=False,\n    classifiers=[\n        \"Programming Language :: C++\",\n        \"Programming Language :: Python\",\n        \"Topic :: Scientific/Engineering :: Artificial Intelligence\",\n    ],\n    license=\"Apache licensed, as found in the LICENSE file\",\n    python_requires=\">=3.6\",\n)\n", "path": "runtime/binding/python/setup.py"}]}