Skip to content

Error when from flashlight.lib.sequence.criterion import CpuViterbiPath, get_data_ptr_as_bytes: ImportError: cannot import name 'CpuViterbiPath' from 'flashlight.lib.sequence.criterion' (/nvme/yun/fairseq/venv/lib/python3.10/site-packages/flashlight/lib/sequence/criterion.py) #19

@haoyunlf

Description

@haoyunlf

I installed flashlight-sequence following

git clone https://github.com/flashlight/sequence && cd sequence
pip install .

When I try to import it by from flashlight.lib.sequence.criterion import CpuViterbiPath, get_data_ptr_as_bytes in this script https://github.com/facebookresearch/fairseq/blob/main/examples/speech_recognition/w2l_decoder.py

this error is thrown:
ImportError: cannot import name 'CpuViterbiPath' from 'flashlight.lib.sequence.criterion' (/nvme/yun/fairseq/venv/lib/python3.10/site-packages/flashlight/lib/sequence/criterion.py)

I installed flashlight-text similarly and the import was successful.

Python 3.10.12
Ubuntu 22.04.3 LTS

This error can be also reproduced when I tried to run on google colab

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions