flashlight: NameError: name 'CriterionType' is not defined

This is the error I get:

NameError                                 Traceback (most recent call last)
/tmp/ipykernel_18106/1529090364.py in <module>
     31 
     32 upstream = 'wav2vec2_hug_base_960'
---> 33 runner = Runner(args, config)

~/Desktop/ASR/s3prl/s3prl/downstream/runner.py in __init__(self, args, config)
     50         self.upstream = self._get_upstream()
     51         self.featurizer = self._get_featurizer()
---> 52         self.downstream = self._get_downstream()
     53         self.all_entries = [self.upstream, self.featurizer, self.downstream]
     54 

~/Desktop/ASR/s3prl/s3prl/downstream/runner.py in _get_downstream(self)
    131             upstream_rate = self.featurizer.model.downsample_rate,
    132             **self.config,
--> 133             **vars(self.args)
    134         ).to(self.args.device)
    135 

~/Desktop/ASR/s3prl/s3prl/downstream/

I reviewed this issue but I did not help me https://github.com/flashlight/flashlight/issues/416#issue-783305697

  1. when I run this import flashlight --> does not raises any error
  2. when I run this from flashlight.lib.text.decoder import CriterionType --> it raises this: ModuleNotFoundError: No module named 'flashlight.lib.text'
  3. I can successfully run examples in the flashlight without any error. so this command python flashlight/bindings/python/example/criterion_example.py does NOT raise any error
  4. And I have kenlm in this address /usr/local/share/kenlm

@jacobkahn I tried to address the questions @tlikhomanenko had asked in that issue in order to make it easier.

I really really appreciate it if you could give me some hints where should I check.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 36 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@benam2 — well — turns out this is a bug in some envs!

Fix is in https://github.com/flashlight/flashlight/pull/1032. I’ll let you know when those both land and we can retry.

@benam2 — you need to pip uninstall flashlight and pip uninstall flashlight-text before installing them both again, from source, with up to date branches.

@benam2 The package you’re trying to use doesn’t use ASG, which is the only thing in the sequence library that is eligible to be built with CUDA. Building with it won’t affect performance since that codepath isn’t being called but you can enable it if you feel like it 😃

@benam2 if the import succeeds, it means Flashlight Text is installed correctly and that there’s an issue with s3prl. You should open an issue in their repo.

Im trying to run https://github.com/s3prl/s3prl/blob/main/s3prl/downstream/asr/w2l_decoder.py script and it raises error while reaches the line to import from flashlight.lib.text.decoder import CriterionType.

Yea I have activated the env for the asr and then try to get that script running. I will create a new env again and try from scratch. Thanks for taking the time. I will share If I was successful.