huggingface / huggingface/blog
KeyError in processor.batch_decode
- Dominant language
- Jupyter Notebook
- Stars
- 3.5k
- Forks
- 1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 19
Description
Hi @patrickvonplaten,
Thank you for your latest blogpost on boosting Wav2Vec2 with n-grams. I'm having trouble there with the `processor.batch_decode` step, since I get a `KeyError` in the `pyctcdecode/decoder.py` module when running the `Wav2Vec2ProcessorWithLM` model and processor.
I am using python 3.8.2, `pyctcdecode==0.3.0`, and `transformers==4.15.0`.
Below is the traceback:
```
Traceback (most recent call last):
File "/Users/gfigueroa/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/Users/gfigueroa/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "/Users/gfigueroa/.pyenv/versions/3.8.2/lib/python3.8/site-packages/pyctcdecode/decoder.py", line 547, in _decode_beams_mp_safe
decoded_beams = self.decode_beams(
File "/Users/gfigueroa/.pyenv/versions/3.8.2/lib/python3.8/site-packages/pyctcdecode/decoder.py", line 525, in decode_beams
decoded_beams = self._decode_logits(
File "/Users/gfigueroa/.pyenv/versions/3.8.2/lib/python3.8/site-packages/pyctcdecode/decoder.py", line 329, in _decode_logits
language_model = BeamSearchDecoderCTC.model_container[self._model_key]
KeyError: b'\xab\x94\xb9\xb0I\xc0\x1b\xf93\xa9\xa6\x1c]\t\xf6\x86'
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the Wav2Vec2ProcessorWithLM batch_decode failure with Python 3.8.2, pyctcdecode 0.3.0, and transformers 4.15.0. Trace the KeyError from pyctcdecode/decoder.py into _decode_logits and determine what change prevents the failure while preserving decoding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100