k2-fsa / sherpa

Speech-to-text server framework with next-gen Kaldi
https://k2-fsa.github.io/sherpa
Apache License 2.0
515 stars 103 forks source link

make failed (missing: location_k2_torch_api location_k2_torch) #368

Closed misamisa3000 closed 1 year ago

misamisa3000 commented 1 year ago

it seem could not find k2 . but I installed k2 release version by https://k2-fsa.github.io/k2/installation/for_developers.html k2 version is 1.23.4 -- Using environment variable K2_INSTALL_PREFIX: /root/k2/build_release -- K2_CMAKE_PREFIX_PATH: /root/k2/build_release CMake Error at /usr/local/lib/python3.7/site-packages/cmake/data/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find k2 (missing: location_k2_torch_api location_k2_torch) Call Stack (most recent call first): /usr/local/lib/python3.7/site-packages/cmake/data/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) /root/k2/build_release/k2Config.cmake:74 (find_package_handle_standard_args) cmake/k2.cmake:18 (find_package) CMakeLists.txt:137 (include)

-- Configuring incomplete, errors occurred! make: * 没有规则可以创建目标“install/strip”。 停止。 Traceback (most recent call last): File "setup.py", line 121, in license="Apache licensed, as found in the LICENSE file", File "/usr/local/lib/python3.7/site-packages/setuptools/init.py", line 129, in setup return distutils.core.setup(attrs) File "/usr/local/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/local/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/lib/python3.7/site-packages/setuptools/command/install.py", line 67, in run self.do_egg_install() File "/usr/local/lib/python3.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install self.run_command('bdist_egg') File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 172, in run cmd = self.call_command('install_lib', warn_dir=0) File "/usr/local/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command self.run_command(cmdname) File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/lib/python3.7/site-packages/setuptools/command/install_lib.py", line 11, in run self.build() File "/usr/local/lib/python3.7/distutils/command/install_lib.py", line 107, in build self.run_command('build_ext') File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 78, in run _build_ext.run(self) File "/usr/local/lib/python3.7/distutils/command/build_ext.py", line 339, in run self.build_extensions() File "/usr/local/lib/python3.7/distutils/command/build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "/usr/local/lib/python3.7/distutils/command/build_ext.py", line 473, in _build_extensions_serial self.build_extension(ext) File "/root/sherpa-1.0/cmake/cmake_extension.py", line 118, in build_extension "\nBuild sherpa failed. Please check the error message.\n" Exception: Build sherpa failed. Please check the error message. You can ask for help by creating an issue on GitHub.

misamisa3000 commented 1 year ago

requirement is [root@localhost sherpa-1.0]# pip install -r ./requirements.txt Requirement already satisfied: websockets in /usr/local/lib/python3.7/site-packages (from -r ./requirements.txt (line 1)) (11.0.2) Requirement already satisfied: kaldifeat in /usr/local/lib/python3.7/site-packages/kaldifeat-1.23-py3.7-linux-x86_64.egg (from -r ./requirements.txt (line 2)) (1.23) Requirement already satisfied: sentencepiece>=0.1.96 in /usr/local/lib/python3.7/site-packages (from -r ./requirements.txt (line 3)) (0.1.98) Requirement already satisfied: numpy in /usr/local/lib/python3.7/site-packages (from -r ./requirements.txt (line 4)) (1.21.6) W

misamisa3000 commented 1 year ago

anything wrong with the environment? or lost some file?

csukuangfj commented 1 year ago

Which version of PyTorch are you using?

misamisa3000 commented 1 year ago

torch 1.6.0 use this pip3 install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

csukuangfj commented 1 year ago

Please update your torch to at least torch 1.8 or switch to a CPU version of PyTorch.

It is a limitation posed by the following code https://github.com/k2-fsa/k2/blob/0d7ef1a7867f70354ab5c59f2feb98c45558dcc7/k2/CMakeLists.txt#L7

if(K2_USE_PYTORCH)
  # We use K2_TORCH_VERSION instead of TORCH_VERSION
  # since TORCH_VERSION may contain something like "+cpu", "+cu113"
  if(K2_TORCH_VERSION VERSION_GREATER_EQUAL 1.8 OR NOT K2_WITH_CUDA)
    message(STATUS "Including k2/torch. K2_TORCH_VERSION is ${K2_TORCH_VERSION}")
    include(kaldifeat)
    add_subdirectory(torch)
  else()
    message(WARNING "Please use at least torch 1.8.0 when CUDA \
    is enabled - skipping compiling k2/torch. Current torch version: ${TORCH_VERSION}")
  endif()
endif()
misamisa3000 commented 1 year ago

thanks~ I have to try it tomorrow see then

misamisa3000 commented 1 year ago

[ 50%] Building CXX object sherpa/csrc/CMakeFiles/sherpa_core.dir/rnnt_emformer_model.cc.o [ 51%] Building CXX object sherpa/csrc/CMakeFiles/sherpa_core.dir/rnnt_lstm_model.cc.o make[2]: 没有规则可以创建“lib/libsherpa_core.so”需要的目标“/usr/local/lib/python3.7/site-packages/k2-1.23.4.dev20230425+cuda10.1.torch1.6.0-py3.7-linux-x86_64.eg g/k2/lib64/libk2_log.so”。 停止。 make[2]: 正在等待未完成的任务.... [ 52%] Building CXX object sherpa/csrc/CMakeFiles/sherpa_core.dir/symbol_table.cc.o make[1]: [sherpa/csrc/CMakeFiles/sherpa_core.dir/all] 错误 2 make: [all] 错误 2 Traceback (most recent call last): File "setup.py", line 121, in license="Apache licensed, as found in the LICENSE file", File "/usr/local/lib/python3.7/site-packages/setuptools/init.py", line 129, in setup return distutils.core.setup(**attrs) File "/usr/local/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/local/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/lib/python3.7/site-packages/setuptools/command/install.py", line 67, in run self.do_egg_install() File "/usr/local/lib/python3.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install self.run_command('bdist_egg') File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 172, in run cmd = self.call_command('install_lib', warn_dir=0) File "/usr/local/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command self.run_command(cmdname) File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/lib/python3.7/site-packages/setuptools/command/install_lib.py", line 11, in run self.build() File "/usr/local/lib/python3.7/distutils/command/install_lib.py", line 107, in build self.run_command('build_ext') File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 78, in run _build_ext.run(self) File "/usr/local/lib/python3.7/distutils/command/build_ext.py", line 339, in run self.build_extensions() File "/usr/local/lib/python3.7/distutils/command/build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "/usr/local/lib/python3.7/distutils/command/build_ext.py", line 473, in _build_extensions_serial self.build_extension(ext) File "/root/sherpa-1.0/cmake/cmake_extension.py", line 118, in build_extension "\nBuild sherpa failed. Please check the error message.\n" Exception: Build sherpa failed. Please check the error message. You can ask for help by creating an issue on GitHub.

Click: https://github.com/k2-fsa/sherpa/issues/new

csukuangfj commented 1 year ago

Did you remove the build directory of sherpa after reinstalling k2?

misamisa3000 commented 1 year ago

sorry  you are right  havnt remove that  remake it now

---Original--- From: "Fangjun @.> Date: Wed, Apr 26, 2023 12:55 PM To: @.>; Cc: @.**@.>; Subject: Re: [k2-fsa/sherpa] make failed (missing: location_k2_torch_apilocation_k2_torch) (Issue #368)

Did you remove the build directory of sherpa after reinstalling k2?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

misamisa3000 commented 1 year ago

great! It's ok now! so many thanks~ but after installed. there is still 3 problem code is: SyntaxError: invalid syntax

File "/usr/local/lib/python3.7/site-packages/k2_sherpa-1.2-py3.7-linux-x86_64.egg/sherpa/bin/lstm_transducer_stateless/streaming_client.py", line 1 ../pruned_stateless_emformer_rnnt2/streaming_client.py ^ SyntaxError: invalid syntax

File "/usr/local/lib/python3.7/site-packages/k2_sherpa-1.2-py3.7-linux-x86_64.egg/sherpa/bin/streaming_pruned_transducer_statelessX/streaming_client.py", line 1 ../pruned_stateless_emformer_rnnt2/streaming_client.py ^ SyntaxError: invalid syntax

k2-sherpa 1.2 is already the active version in easy-install.pth

above is: byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/streaming_pruned_transducer_statelessX/streaming_client.py to streaming_client.cpython-37.pyc File "build/bdist.linux-x86_64/egg/sherpa/bin/streaming_pruned_transducer_statelessX/streaming_client.py", line 1 ../pruned_stateless_emformer_rnnt2/streaming_client.py ^ SyntaxError: invalid syntax

byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/streaming_pruned_transducer_statelessX/stream.py to stream.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/streaming_pruned_transducer_statelessX/decode_manifest.py to decode_manifest.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/streaming_pruned_transducer_statelessX/beam_search.py to beam_search.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_transducer_statelessX/init.py to init.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_transducer_statelessX/offline_server.py to offline_server.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_transducer_statelessX/offline_client.py to offline_client.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_transducer_statelessX/offline_asr.py to offline_asr.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_transducer_statelessX/decode_manifest.py to decode_manifest.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_transducer_statelessX/beam_search.py to beam_search.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_stateless_emformer_rnnt2/streaming_server.py to streaming_server.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_stateless_emformer_rnnt2/streaming_client.py to streaming_client.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_stateless_emformer_rnnt2/stream.py to stream.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_stateless_emformer_rnnt2/beam_search.py to beam_search.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/lstm_transducer_stateless/streaming_server.py to streaming_server.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/lstm_transducer_stateless/streaming_client.py to streaming_client.cpython-37.pyc File "build/bdist.linux-x86_64/egg/sherpa/bin/lstm_transducer_stateless/streaming_client.py", line 1 ../pruned_stateless_emformer_rnnt2/streaming_client.py ^ SyntaxError: invalid syntax

byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/lstm_transducer_stateless/stream.py to stream.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/lstm_transducer_stateless/offline_asr.py to offline_asr.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/lstm_transducer_stateless/beam_search.py to beam_search.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/conv_emformer_transducer_stateless2/streaming_server.py to streaming_server.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/conv_emformer_transducer_stateless2/streaming_client.py to streaming_client.cpython-37.pyc File "build/bdist.linux-x86_64/egg/sherpa/bin/conv_emformer_transducer_stateless2/streaming_client.py", line 1 ../pruned_stateless_emformer_rnnt2/streaming_client.py ^ SyntaxError: invalid syntax

byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/conv_emformer_transducer_stateless2/stream.py to stream.cpython-37.pyc

is that a problem?

csukuangfj commented 1 year ago

code is: SyntaxError: invalid syntax

What is your code and what is your command to run the code?

Please give us more details.

misamisa3000 commented 1 year ago

it happend on install just the install command python3 setup.py install --verbose I'm tying another version of sherpa (1.00) the same error

csukuangfj commented 1 year ago

Please post the complete command or even better the screenshot.

If you follow the documentation to install sherpa, you won't get such errors.

misamisa3000 commented 1 year ago

i run python3 setup.py install --verbose to install after making code is: creating build/bdist.linux-x86_64/egg/sherpa/include creating build/bdist.linux-x86_64/egg/sherpa/include/sherpa creating build/bdist.linux-x86_64/egg/sherpa/include/sherpa/cpp_api copying build/lib.linux-x86_64-3.7/sherpa/include/sherpa/cpp_api/offline_recognizer.h -> build/bdist.linux-x86_64/egg/sherpa/include/sherpa/cpp_api copying build/lib.linux-x86_64-3.7/sherpa/include/sherpa/cpp_api/online_recognizer.h -> build/bdist.linux-x86_64/egg/sherpa/include/sherpa/cpp_api copying build/lib.linux-x86_64-3.7/sherpa/include/sherpa/cpp_api/online_stream.h -> build/bdist.linux-x86_64/egg/sherpa/include/sherpa/cpp_api copying build/lib.linux-x86_64-3.7/_sherpa.cpython-37m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg byte-compiling build/bdist.linux-x86_64/egg/sherpa/utils.py to utils.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/timestamp.py to timestamp.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/online_endpoint.py to online_endpoint.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/nbest.py to nbest.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/lexicon.py to lexicon.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/http_server.py to http_server.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/decode.py to decode.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/torch_version.py to torch_version.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/init.py to init.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/web/start-https-server.py to start-https-server.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/web/generate-certificate.py to generate-certificate.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/streaming_pruned_transducer_statelessX/streaming_server.py to streaming_server.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/streaming_pruned_transducer_statelessX/streaming_client.py to streaming_client.cpython-37.pyc File "build/bdist.linux-x86_64/egg/sherpa/bin/streaming_pruned_transducer_statelessX/streaming_client.py", line 1 ../pruned_stateless_emformer_rnnt2/streaming_client.py ^ SyntaxError: invalid syntax

byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/streaming_pruned_transducer_statelessX/stream.py to stream.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/streaming_pruned_transducer_statelessX/beam_search.py to beam_search.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_transducer_statelessX/init.py to init.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_transducer_statelessX/offline_server.py to offline_server.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_transducer_statelessX/offline_client.py to offline_client.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_transducer_statelessX/offline_asr.py to offline_asr.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_transducer_statelessX/decode_manifest.py to decode_manifest.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_transducer_statelessX/beam_search.py to beam_search.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_stateless_emformer_rnnt2/streaming_server.py to streaming_server.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_stateless_emformer_rnnt2/streaming_client.py to streaming_client.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_stateless_emformer_rnnt2/stream.py to stream.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/pruned_stateless_emformer_rnnt2/beam_search.py to beam_search.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/lstm_transducer_stateless/streaming_server.py to streaming_server.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/lstm_transducer_stateless/streaming_client.py to streaming_client.cpython-37.pyc File "build/bdist.linux-x86_64/egg/sherpa/bin/lstm_transducer_stateless/streaming_client.py", line 1 ../pruned_stateless_emformer_rnnt2/streaming_client.py ^ SyntaxError: invalid syntax

byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/lstm_transducer_stateless/stream.py to stream.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/lstm_transducer_stateless/offline_asr.py to offline_asr.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/lstm_transducer_stateless/beam_search.py to beam_search.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/conv_emformer_transducer_stateless2/streaming_server.py to streaming_server.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/conv_emformer_transducer_stateless2/streaming_client.py to streaming_client.cpython-37.pyc File "build/bdist.linux-x86_64/egg/sherpa/bin/conv_emformer_transducer_stateless2/streaming_client.py", line 1 ../pruned_stateless_emformer_rnnt2/streaming_client.py ^ SyntaxError: invalid syntax

byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/conv_emformer_transducer_stateless2/stream.py to stream.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sherpa/bin/conv_emformer_transducer_stateless2/beam_search.py to beam_search.cpython-37.pyc creating stub loader for _sherpa.cpython-37m-x86_64-linux-gnu.so byte-compiling build/bdist.linux-x86_64/egg/_sherpa.py to _sherpa.cpython-37.pyc installing package data to build/bdist.linux-x86_64/egg running install_data creating build/bdist.linux-x86_64/egg/bin copying build/sherpa/bin/sherpa -> build/bdist.linux-x86_64/egg/bin copying build/sherpa/bin/sherpa-online -> build/bdist.linux-x86_64/egg/bin copying build/sherpa/bin/sherpa-version -> build/bdist.linux-x86_64/egg/bin copying build/sherpa/bin/offline_websocket_client -> build/bdist.linux-x86_64/egg/bin copying build/sherpa/bin/offline_websocket_server -> build/bdist.linux-x86_64/egg/bin copying build/sherpa/bin/online_websocket_client -> build/bdist.linux-x86_64/egg/bin copying build/sherpa/bin/online_websocket_server -> build/bdist.linux-x86_64/egg/bin copying build/sherpa/bin/online_websocket_client_from_microphone -> build/bdist.linux-x86_64/egg/bin creating build/bdist.linux-x86_64/egg/EGG-INFO copying k2_sherpa.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying k2_sherpa.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying k2_sherpa.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying k2_sherpa.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO copying k2_sherpa.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt creating dist creating 'dist/k2_sherpa-1.0-py3.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing k2_sherpa-1.0-py3.7-linux-x86_64.egg creating /usr/local/lib/python3.7/site-packages/k2_sherpa-1.0-py3.7-linux-x86_64.egg Extracting k2_sherpa-1.0-py3.7-linux-x86_64.egg to /usr/local/lib/python3.7/site-packages File "/usr/local/lib/python3.7/site-packages/k2_sherpa-1.0-py3.7-linux-x86_64.egg/sherpa/bin/conv_emformer_transducer_stateless2/streaming_client.py", line 1 ../pruned_stateless_emformer_rnnt2/streaming_client.py ^ SyntaxError: invalid syntax

File "/usr/local/lib/python3.7/site-packages/k2_sherpa-1.0-py3.7-linux-x86_64.egg/sherpa/bin/lstm_transducer_stateless/streaming_client.py", line 1 ../pruned_stateless_emformer_rnnt2/streaming_client.py ^ SyntaxError: invalid syntax

File "/usr/local/lib/python3.7/site-packages/k2_sherpa-1.0-py3.7-linux-x86_64.egg/sherpa/bin/streaming_pruned_transducer_statelessX/streaming_client.py", line 1 ../pruned_stateless_emformer_rnnt2/streaming_client.py ^ SyntaxError: invalid syntax

Adding k2-sherpa 1.0 to easy-install.pth file

Installed /usr/local/lib/python3.7/site-packages/k2_sherpa-1.0-py3.7-linux-x86_64.egg Processing dependencies for k2-sherpa==1.0 Finished processing dependencies for k2-sherpa==1.0

misamisa3000 commented 1 year ago

then i run python3 -c "import sherpa; print(sherpa.version)" answer is 1.0 it seems ok but I run [root@localhost pruned_stateless_emformer_rnnt2]# ./streaming_server.py --port 6006 to start the server reply: usage: streaming_server.py [-h] [--decoding-method DECODING_METHOD] [--beam BEAM] [--num-paths NUM_PATHS] [--num-active-paths NUM_ACTIVE_PATHS] [--nbest-scale NBEST_SCALE] [--temperature TEMPERATURE] [--max-contexts MAX_CONTEXTS] [--max-states MAX_STATES] [--lang-dir LANG_DIR] [--ngram-lm-scale NGRAM_LM_SCALE] [--endpoint.rule1.must-contain-nonsilence ENDPOINT_RULE1_MUST_CONTAIN_NONSILENCE] [--endpoint.rule1.min-trailing-silence ENDPOINT_RULE1_MIN_TRAILING_SILENCE] [--endpoint.rule1.min-utterance-length ENDPOINT_RULE1_MIN_UTTERANCE_LENGTH] [--endpoint.rule2.must-contain-nonsilence ENDPOINT_RULE2_MUST_CONTAIN_NONSILENCE] [--endpoint.rule2.min-trailing-silence ENDPOINT_RULE2_MIN_TRAILING_SILENCE] [--endpoint.rule2.min-utterance-length ENDPOINT_RULE2_MIN_UTTERANCE_LENGTH] [--endpoint.rule3.must-contain-nonsilence ENDPOINT_RULE3_MUST_CONTAIN_NONSILENCE] [--endpoint.rule3.min-trailing-silence ENDPOINT_RULE3_MIN_TRAILING_SILENCE] [--endpoint.rule3.min-utterance-length ENDPOINT_RULE3_MIN_UTTERANCE_LENGTH] [--port PORT] --nn-model-filename NN_MODEL_FILENAME [--bpe-model-filename BPE_MODEL_FILENAME] [--token-filename TOKEN_FILENAME] [--decode-chunk-size DECODE_CHUNK_SIZE] [--decode-left-context DECODE_LEFT_CONTEXT] [--decode-right-context DECODE_RIGHT_CONTEXT] [--nn-pool-size NN_POOL_SIZE] [--max-batch-size MAX_BATCH_SIZE] [--max-wait-ms MAX_WAIT_MS] [--max-message-size MAX_MESSAGE_SIZE] [--max-queue-size MAX_QUEUE_SIZE] [--max-active-connections MAX_ACTIVE_CONNECTIONS] [--certificate CERTIFICATE] [--doc-root DOC_ROOT] streaming_server.py: error: the following arguments are required: --nn-model-filename

seems havnt copy model files? are there any maked model could use for test?

csukuangfj commented 1 year ago

please follow our doc to run the command https://k2-fsa.github.io/sherpa/

If you still have issues after reading the doc, please post your question again.

misamisa3000 commented 1 year ago

I have installed sherpa-1.0 then I use command on https://k2-fsa.github.io/sherpa/python/streaming_asr/emformer/server.html to test start the server with the pretrained model. command and output is: [root@localhost sherpa-1.0]# ./sherpa/bin/pruned_stateless_emformer_rnnt2/streaming_server.py --endpoint.rule3.min-utterance-length 1000.0 --port 6007 --max-batch-size 50 --max-wait-ms 5 --nn-pool-size 1 --nn-model-filename ./icefall-asr-librispeech-pruned-stateless-emformer-rnnt2-2022-06-01/exp/cpu_jit-epoch-39-avg-6-use-averaged-model-1.pt --bpe-model-filename ./icefall-asr-librispeech-pruned-stateless-emformer-rnnt2-2022-06-01/data/lang_bpe_500/bpe.model 2023-05-06 16:18:30,333 INFO [streaming_server.py:630] {'decoding_method': 'greedy_search', 'beam': 10.0, 'num_paths': 200, 'num_active_paths': 4, 'nbest_scale': 0.5, 'temperature': 1.0, 'max_contexts': 8, 'max_states': 32, 'lang_dir': PosixPath('data/lang_bpe_500'), 'ngram_lm_scale': 0.01} 2023-05-06 16:18:30,333 INFO [streaming_server.py:633] {'endpoint_rule1_must_contain_nonsilence': False, 'endpoint_rule1_min_trailing_silence': 5.0, 'endpoint_rule1_min_utterance_length': 0.0, 'endpoint_rule2_must_contain_nonsilence': True, 'endpoint_rule2_min_trailing_silence': 2.0, 'endpoint_rule2_min_utterance_length': 0.0, 'endpoint_rule3_must_contain_nonsilence': False, 'endpoint_rule3_min_trailing_silence': 0.0, 'endpoint_rule3_min_utterance_length': 1000.0} 2023-05-06 16:18:30,333 INFO [streaming_server.py:639] {'decoding_method': 'greedy_search', 'beam': 10.0, 'num_paths': 200, 'num_active_paths': 4, 'nbest_scale': 0.5, 'temperature': 1.0, 'max_contexts': 8, 'max_states': 32, 'lang_dir': PosixPath('data/lang_bpe_500'), 'ngram_lm_scale': 0.01, 'endpoint_rule1_must_contain_nonsilence': False, 'endpoint_rule1_min_trailing_silence': 5.0, 'endpoint_rule1_min_utterance_length': 0.0, 'endpoint_rule2_must_contain_nonsilence': True, 'endpoint_rule2_min_trailing_silence': 2.0, 'endpoint_rule2_min_utterance_length': 0.0, 'endpoint_rule3_must_contain_nonsilence': False, 'endpoint_rule3_min_trailing_silence': 0.0, 'endpoint_rule3_min_utterance_length': 1000.0, 'port': 6007, 'nn_model_filename': './icefall-asr-librispeech-pruned-stateless-emformer-rnnt2-2022-06-01/exp/cpu_jit-epoch-39-avg-6-use-averaged-model-1.pt', 'bpe_model_filename': './icefall-asr-librispeech-pruned-stateless-emformer-rnnt2-2022-06-01/data/lang_bpe_500/bpe.model', 'token_filename': None, 'decode_chunk_size': 8, 'decode_left_context': 32, 'decode_right_context': 2, 'nn_pool_size': 1, 'max_batch_size': 50, 'max_wait_ms': 5.0, 'max_message_size': 1048576, 'max_queue_size': 32, 'max_active_connections': 500, 'certificate': None, 'doc_root': './sherpa/bin/web'} 2023-05-06 16:18:31,447 INFO [streaming_server.py:269] Using device: cuda:0 Traceback (most recent call last): File "./sherpa/bin/pruned_stateless_emformer_rnnt2/streaming_server.py", line 705, in main() File "/usr/local/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "./sherpa/bin/pruned_stateless_emformer_rnnt2/streaming_server.py", line 676, in main doc_root=doc_root, File "./sherpa/bin/pruned_stateless_emformer_rnnt2/streaming_server.py", line 271, in init self.model = RnntEmformerModel(nn_model_filename, device=device) RuntimeError: Unknown type name 'NoneType': Serialized File "code/torch/torch/nn/modules/container.py", line 5 buffers = [] training : bool _is_full_backward_hook : NoneType


  __annotations__["0"] = __torch__.torch.nn.modules.conv.Conv2d
  __annotations__["1"] = __torch__.torch.nn.modules.activation.ReLU

---------------------------------
version is not right?  which icefall version could work on torch1.8 ? 
or anything wrong else? 
csukuangfj commented 1 year ago

That pretrained model is exported using a newer version of Pytorch than the one you are currently using.

I suggest switching to torch 1.10 or torch 1.13.