# My dataset loading script is not working

**URL:** <https://discuss.huggingface.co/t/my-dataset-loading-script-is-not-working/22971>\
**Category:** 🤗Datasets\
**Created:** [September 11, 2022, 4:50pm UTC](https://discuss.huggingface.co/t/my-dataset-loading-script-is-not-working/22971 "2022-09-11T16:50:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![osbm](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/osbm/32/52540_2.png) [@osbm](https://discuss.huggingface.co/u/osbm)\
**Post date:** [September 11, 2022, 4:50pm UTC](https://discuss.huggingface.co/t/my-dataset-loading-script-is-not-working/22971/1 "2022-09-11T16:50:45Z")

</div>

Hello, I am trying to get my first dataset working. Here is the [link](https://huggingface.co/datasets/osbm/abdominal_mri_images). But I can’t get it to work. Any help would be awesome.

My csv file head:

```nohighlight
Class,BBox,file_name
acute_diverticulitis,122-137-176-182,1188233_Seri5_30423865057.png
healthy,,1187990_Seri4_30211303061.png
healthy,,1188237_Seri2_30425664485.png

```

I think this part is the problem in the [script](https://huggingface.co/datasets/beans/blob/main/beans.py#L71-L102):

```python
    def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
        data_dir = dl_manager.download_and_extract(_URLS)
        return [
            datasets.SplitGenerator(
                name=datasets.Split.TRAIN,
                gen_kwargs={
                    "df_path": dl_manager.iter_files([data_dir["train_df"]]),
                    "split": "train",
                    "images_path": dl_manager.iter_archive([data_dir["train"]]),
                },
            ),
            datasets.SplitGenerator(
                name=datasets.Split.TEST,
                gen_kwargs={
                    "df_path": dl_manager.iter_files([data_dir["test_df"]]),
                    "split": "test",
                    "images_path": dl_manager.iter_archive([data_dir["test"]]),
                },
            ),
        ]

    def _generate_examples(self, df_path, split, images_path):
        dataframe = pd.read_csv(df_path, delimiter=",")

        for id_, row in dataframe.iterrows():
            yield id_, {
                "image": os.path.join(images_path, row["image"]),
                "bounding-box": row["BBox"],
                "class": row["Class"],
            }

```

---

<div class="post-metadata">

**Author:** ![NimaBoscarino](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nimaboscarino/32/4358_2.png) [@NimaBoscarino](https://discuss.huggingface.co/u/NimaBoscarino)\
**Post date:** [September 12, 2022, 9:17am UTC](https://discuss.huggingface.co/t/my-dataset-loading-script-is-not-working/22971/2 "2022-09-12T09:17:23Z")

</div>

Hello! I think the issue is with `data_dir = dl_manager.download_and_extract(_URLS)`. The error on your dataset page ([osbm/abdominal\_mri\_images · Datasets at Hugging Face](https://huggingface.co/datasets/osbm/abdominal_mri_images)) says:

```auto
NotImplementedError: Extraction protocol for TAR archives like 'https://huggingface.co/datasets/osbm/abdominal_mri_images/blob/main/train.tar.gz' is not implemented in streaming mode. Please use `dl_manager.iter_archive` instead.

```

I haven’t worked with this particular kind of thing before, but this issue might be helpful for you! [Trouble with streaming frgfm/imagenette vision dataset with TAR archive · Issue #4697 · huggingface/datasets · GitHub](https://github.com/huggingface/datasets/issues/4697)

---

<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:** [September 15, 2022, 12:42pm UTC](https://discuss.huggingface.co/t/my-dataset-loading-script-is-not-working/22971/3 "2022-09-15T12:42:04Z")

</div>

Hi! I’ve just opened a PR to make your dataset streamable (needed for the preview): [osbm/abdominal\_mri\_images · Make dataset streamable](https://huggingface.co/datasets/osbm/abdominal_mri_images/discussions/1). Let us know if you have some additional questions/issues.

---

<div class="post-metadata">

**Author:** ![osbm](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/osbm/32/52540_2.png) [@osbm](https://discuss.huggingface.co/u/osbm)\
**Post date:** [September 15, 2022, 12:53pm UTC](https://discuss.huggingface.co/t/my-dataset-loading-script-is-not-working/22971/4 "2022-09-15T12:53:33Z")

</div>

Thank you so much. This is awesome.
