Perceiver IO : How to preprocess raw audio into vector  
@NielsRogge  I am working with end to end application where I have to take raw video input and have to identify user sentiment from it . For that I want to know how to preprocess the raw audio to be used by PerceiverAudioPreprocessor. 
I would really like to collaborate with @anton-l and @patrickvonplaten to make an audio example for Perceiver IO.

Basically, the `PerceiverAudioPreprocessor` turns a batch of raw audio streams into a tensor of shape `(batch_size, seq_len, hidden_size)`. This is often called `hidden_states` in Transformers (it's like the initial tensor you provide to a Transformer encoder). 

The way you encode your audio to these hidden states doesn't matter, there are multiple ways.

* `PerceiverAudioPreprocessor` is one example. It just takes the raw audio and adds position embeddings (trainable/Fourier) to it.
* Another example is using Wav2Vec2's method, as follows:

```
from transformers import Wav2Vec2FeatureExtractor
from transformers.models.wav2vec2.modeling_wav2vec2 import Wav2VecFeatureWav2Vec2FeatureEncoder
from datasets import load_dataset

dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
dataset = dataset.sort("id")
sampling_rate = dataset.features["audio"].sampling_rate

feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained("facebook/wav2vec2-base-960h")
config = Wav2Vec2Config.from_pretrained("facebook/wav2vec2-base-960h")
feature_encoder = Wav2Vec2FeatureEncoder(config)

# construct raw audio
# audio file is decoded on the fly
inputs = feature_extractor(dataset[0]["audio"]["array"], sampling_rate=sampling_rate, return_tensors="pt")

# turn raw audio into hidden_states of shape (B, L, C)
hidden_states = feature_encoder(**inputs)
```

However, in this case, there are no position embeddings added it seems (not sure if Wav2Vec2 uses position embeddings).

Next, you can do cross-attention between the `latents` of Perceiver, and the `hidden_states` we just created.<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.