# Datasets map modifying audio array to list?

**URL:** <https://discuss.huggingface.co/t/datasets-map-modifying-audio-array-to-list/12303>\
**Category:** 🤗Datasets\
**Created:** [November 26, 2021, 12:22pm UTC](https://discuss.huggingface.co/t/datasets-map-modifying-audio-array-to-list/12303 "2021-11-26T12:22:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abnerh](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/abnerh/32/31127_2.png) [@abnerh](https://discuss.huggingface.co/u/abnerh)\
**Post date:** [November 26, 2021, 12:22pm UTC](https://discuss.huggingface.co/t/datasets-map-modifying-audio-array-to-list/12303/1 "2021-11-26T12:22:35Z")

</div>

I’m trying to use my own data for fine-tuning a Wav2Vec2 model but every time I create my DatasetDict, it converts my audio array to a list? Am I doing something incorrectly? How can I preserve the audio as an array?

```auto
def speech_file_to_array_fn(batch):
    speech_array, sampling_rate = sf.read(batch["file"])
    batch["audio"] = speech_array
    return batch

updated_dataset = my_dataset.map(speech_file_to_array_fn)

```

```auto
my_audio = updated_dataset['test'][0]
print(my_audio)
{'file': '/disks/data3/UASPEECH/control/CM04/CM04_B2_UW33_M3.wav', 'text': 'APPROACH', 'audio': [0.0001220703125, -0.00018310546875, 0.000152587890625, -0.00030517578125, 6.103515625e-05, 9.1552734375e-05,...}

print(type(my_audio['audio']))
<class 'list'>

```

---

<div class="post-metadata">

**Author:** ![mariosasko](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mariosasko/32/31548_2.png) [@mariosasko](https://discuss.huggingface.co/u/mariosasko)\
**Post date:** [November 29, 2021, 3:49pm UTC](https://discuss.huggingface.co/t/datasets-map-modifying-audio-array-to-list/12303/2 "2021-11-29T15:49:42Z")

</div>

Hi,

set format to NumPy to get an array as follows:

```auto
updated_dataset.set_format("numpy", columns=["audio"], output_all_columns=True)
updated_dataset["test"][0]

```
