k2-fsa / fast_rnnt

A torch implementation of a recursion which turns out to be useful for RNN-T.
Other
139 stars 22 forks source link

Import fast_rnnt is Failed #27

Open jeff-lim opened 1 year ago

jeff-lim commented 1 year ago

Hi team,

I installed successfully with pip install fast_rnnt. But can't import fast_rnnt (as attached img).

Here's my environment information.

image
jeff-lim commented 1 year ago

I think.. it is same issue to #17 . Is there're any updates or PR about this issue?

csukuangfj commented 1 year ago

Could you list the files in your python site-packages, especially the files whose name contains fast_rnnt?

jeff-lim commented 1 year ago

there're only directories... It is okay....?

image
jeff-lim commented 1 year ago

FYI tree of fast_rnnt, fast_rnnt-1.2.dist-info

fast_rnnt

image

fast_rnnt-1.2.dist-info

image
csukuangfj commented 1 year ago

Is there a file containing _fast_rnnt in its name?

jeff-lim commented 1 year ago

no.. not at all. Actually I wondering the reason why from/import _fast_rnnt in the __init__.py, mutual_information.py

init.py GitRepo from _fast_rnnt import with_cuda

mutual_information.py GitRepo import _fast_rnnt

csukuangfj commented 1 year ago

After checking pypi.org, I am afraid you cannot use "pip install fast_rnnt" on Windows at pesent.

jeff-lim commented 1 year ago

Oh my.. But, I also faced same issue, when I installed from source(git clone, python setup.py...), too.

Is it known issue to you/team?

csukuangfj commented 1 year ago

Actually I wondering the reason why from/import _fast_rnnt in the init.py, mutual_information.py

I bet you have seen torch._C. If you don't know what _C is, please google it.

Similarly, we have _fast_rnnt, which is a Python extension module, implemented in C++/CUDA.


Is it known issue to you/team?

I just looked at the file setup.py and find that it does not support Windows.

Please use the following commands to build fast_rnnt for windows:

git clone https://github.com/k2-fsa/fast_rnnt
cd fast_rnnt
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --target _fast_rnnt --config Release

After running the above commands, please find the directory where _fast_rnnt*.pyd locates and add the directory to the environment variable PYTHONPATH.

Similarly, find the directory where mutual_information_core.dll locates and add it to the environment variable path.

Finally, add the directory /path/to/fast_rnnt/fast_rnnt/python to the environment variable PYTHONPATH.

Now you should be able to run python -c "import fast_rnnt".

csukuangfj commented 1 year ago

If I install and run the code on Ubuntu, I will be okay to using fast_rnnt with cuda?

Yes, I believe so.

csukuangfj commented 1 year ago

I think @pkufool will support installing fast_rnnt on Windows so that others won't have the same issue as yours.