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.

do_normalize set to True by default for WAV2VEC tokenizer

See original GitHub issue

Environment info

  • transformers version: 4.6.1
  • Platform: macOS-11.2.3-x86_64-i386-64bit
  • Python version: 3.8.2
  • PyTorch version (GPU?): 1.8.1 (False)
  • Tensorflow version (GPU?): 2.4.1 (False)
  • Using GPU in script?: No
  • Using distributed or parallel set-up in script?: No

Who can help

@LysandreJik @sgugger

Information

Model I am using (Bert, XLNet …): Wav2Vec

The problem arises when using:

  • [*] the official example scripts: (give details below)
  • my own modified scripts: (give details below)

The tasks I am working on is:

  • an official GLUE/SQUaD task: (give the name)
  • my own task or dataset: (give details below)

To reproduce

Steps to reproduce the behavior:

wav_input_16khz, samplerate = sf.read(AUDIOFILE) tokenizer = Wav2Vec2Tokenizer.from_pretrained(“facebook/wav2vec2-base-960h”) tokenizer_2 = Wav2Vec2Tokenizer.from_pretrained(“facebook/wav2vec2-base-960h”,do_normalize=False) features = tokenizer(wav_input_16khz, return_tensors=“pt”).input_values features_2 = tokenizer_2(wav_input_16khz, return_tensors=“pt”).input_values features == features_2

Out[1]: tensor([[False, False, False, …, False, False, False]])

Expected behavior

As written in the documentation "do_normalize (:obj:bool, optional, defaults to :obj:False): Whether or not to zero-mean unit-variance normalize the input. Normalizing can help to significantly improve the performance for some models, e.g., wav2vec2-lv60 <https://huggingface.co/models?search=lv60>__." should be set to False.

However, the option seems to be set to True by default during the initialization.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Lhemamoucommented, Jun 15, 2021

sure I will do it when I have free time 😃

1reaction
patrickvonplatencommented, Jun 15, 2021

Oh yeah you’re right @Lhemamou ! Would you maybe like to open a PR to fix the documentation ? It should state that it defaults to True in this case

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wav2Vec2 - Hugging Face
If set to True , the tokenizer assumes the input is already split into words (for instance, by splitting it on whitespace) which...
Read more >
transformers/tokenization_wav2vec2.py at main - GitHub
set. Converts a string in a sequence of tokens (string), using the tokenizer. def _convert_token_to_id(self, token: str) -> int: """Converts a token (str)...
Read more >
Fine-tune and deploy a Wav2Vec2 model for speech ...
First, we show how to load and preprocess the SUPERB dataset in a SageMaker environment in order to obtain a tokenizer and feature...
Read more >
Detect inquiry sentence in Wav2Vec 2.0 result - Stack Overflow
... model_name = "flexudy/t5-small-wav2vec2-grammar-fixer" tokenizer ... early_stopping=True ) sentence = tokenizer.decode(outputs[0], ...
Read more >
Fine-tuning Wav2Vec2 with an LM head | TensorFlow Hub
Setting Up; Model setup using TFHub; Setting up training state ... to identify the true quantized latent speech representation for a masked time...
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