k2-fsa / sherpa

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

Encoder initial state error in conformer streaming_server #31

Closed ahazned closed 2 years ago

ahazned commented 2 years ago

Hi,

I cloned&built the latest master branch that includes the merged pr https://github.com/k2-fsa/sherpa/pull/17 and conformer_rnnt/offline_server.py works fine. But when I try streaming_conformer_rnnt/streaming_server.py with the same model (pruned_transducer_stateless2) I get the below error in loading the initial states of the encoder. Any ideas how to fix this? Thanks

(sherpa) ahazned@server:/home/ahazned/sherpa/sherpa/bin/streaming_conformer_rnnt$ CUDA_VISIBLE_DEVICES=2 python ./streaming_server.py --port 6008 --nn-model-filename /home/ahazned/sherpa/models/enUS_jit.pt --bpe-model-filename /home/ahazned/sherpa/models/enUS_bpe.model

2022-06-15 12:22:02,554 INFO [streaming_server.py:579] {'port': 6008, 'nn_model_filename': '/home/ahazned/sherpa/models/enUS_jit.pt', 'bpe_model_filename': '/home/ahazned/sherpa/models/enUS_bpe.model', 'decode_chunk_size': 8, 'decode_left_context': 32, 'decode_right_context': 2, 'nn_pool_size': 1, 'max_batch_size': 50, 'max_wait_ms': 10, 'max_message_size': 1048576, 'max_queue_size': 32, 'max_active_connections': 500}
Traceback (most recent call last):
  File "./streaming_server.py", line 633, in <module>
    main()
  File "/home/ahazned/miniconda3/envs/sherpa/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
    return func(*args, **kwargs)
  File "./streaming_server.py", line 594, in main
    server = StreamingServer(
  File "./streaming_server.py", line 330, in __init__
    self.initial_states = self.model.get_encoder_init_states(
RuntimeError: Method 'get_init_state' is not defined.
pkufool commented 2 years ago

The streaming model code in icefall has not been merged, please use the code in https://github.com/k2-fsa/icefall/pull/380. We will merge it soon.

ahazned commented 2 years ago

Ok, thanks.