question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'WhisperProcessor' object has no attribute 'as_target_processor'

See original GitHub issue

System Info

  • transformers version: 4.23.1
  • Platform: Linux-5.15.0-48-generic-x86_64-with-glibc2.17
  • Python version: 3.8.12
  • Huggingface_hub version: 0.10.1
  • PyTorch version (GPU?): 1.11.0 (True)
  • Tensorflow version (GPU?): not installed (NA)
  • Flax version (CPU?/GPU?/TPU?): not installed (NA)
  • Jax version: not installed
  • JaxLib version: not installed
  • Using GPU in script?: yes
  • Using distributed or parallel set-up in script?: no

Who can help?

@patrickvonplaten

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, …)
  • My own task or dataset (give details below)

Reproduction

I’m trying to train a Whisper model, using the WhisperProcessor.

As written in the doc of the __call__ method of the WhisperProcessor, I should have a context processor.as_target_processor() but it seems it doesn’t exist. “If used in the context ~WhisperProcessor.as_target_processor this method forwards all its arguments to WhisperTokenizer’s [call()]”

Steps to reproduce the bug :

target_text = 'this is a test text'
processor = WhisperProcessor.from_pretrained('openai/whisper-large')
with processor.as_target_processor():
    targets = processor(target_text).input_ids

Expected behavior

The __call__ method of WhisperProcessor instance in the as_target_processor context should give the result of the WhisperTokenizer __call__.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
NielsRoggecommented, Oct 17, 2022

Hi,

We’ll update that code snippet as we’ve recently deprecated the use of as_target_processor, and new processors like WhisperProcessor don’t implement it anymore. See #18325 for details.

You can replace

text = "hello world"

with processor.as_target_processor():
    encoded_labels = processor(text, padding=True)

by

encoded_labels = processor(text=text).input_ids
0reactions
ArthurZuckercommented, Oct 17, 2022

Nice catch! Will update the doc soon

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: '' object has no attribute '' - python - Stack Overflow
Your NewsFeed class instance n doesn't have a Canvas attribute. If you want to pass the Canvas defined in your Achtergrond class instance ......
Read more >
AttributeError: 'str' object has no attribute 'value' #3 - GitHub
Hi, Thank you for your effort developing this tool. I am trying to use the tool to request a TGT but it currently...
Read more >
AttributeError: 'MultivariateSample' object has no attribute 'train'
While running the python code that is available in the linkclient-libraries-multivariate , i got the below error in "Run the Application" area.
Read more >
AttributeError: 'NoneType' object has no attribute 'call' on ...
Hello, I'm at a loss to explain why this flow fails and succeeds at the same time… It only consists in triggering a...
Read more >
[Solved] AttributeError: 'module' object has no attribute
Click here to subscribe - https://www.youtube.com/channel/UCeVMnSShP_Iviwkknt83cww▻Instagram ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found