ImageFolder BadZipFile: Bad offset for central directory
MEMBER
Hi ! Could you share the full stack trace ? Which dataset did you try to load ?

it may be related to https://github.com/huggingface/datasets/pull/5640
2023-01-23T17:25:56Z
https://github.com/huggingface/datasets/issues/5451#issuecomment-1400713524
https://api.github.com/repos/huggingface/datasets/issues/5451
IC_kwDODunzps5TfTE0
https://api.github.com/repos/huggingface/datasets/issues/comments/1400713524/reactions
2023-05-23T10:35:48Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1400713524
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
COLLABORATOR
The `BadZipFile` error means the ZIP file is corrupted, so I'm closing this issue as it's not directly related to `datasets`.
2023-02-10T16:31:36Z
https://github.com/huggingface/datasets/issues/5451#issuecomment-1426054208
https://api.github.com/repos/huggingface/datasets/issues/5451
IC_kwDODunzps5U_9xA
https://api.github.com/repos/huggingface/datasets/issues/comments/1426054208/reactions
2023-02-10T16:31:36Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1426054208
https://avatars.githubusercontent.com/u/47462742?v=4
https://api.github.com/users/mariosasko/events{/privacy}
https://api.github.com/users/mariosasko/followers
https://api.github.com/users/mariosasko/following{/other_user}
https://api.github.com/users/mariosasko/gists{/gist_id}
https://github.com/mariosasko
mariosasko
MDQ6VXNlcjQ3NDYyNzQy
https://api.github.com/users/mariosasko/orgs
https://api.github.com/users/mariosasko/received_events
https://api.github.com/users/mariosasko/repos
https://api.github.com/users/mariosasko/starred{/owner}{/repo}
https://api.github.com/users/mariosasko/subscriptions
User
https://api.github.com/users/mariosasko
public
NONE
For others that find this issue following a `BadZipFile` error, I had the same problem because I had a file in a folder dataset `my-image.target` and the datasets library was incorrectly determining that the (PNG) file was a zip archive. When it tried to extract the file, this error occurred. 

Updating to `datasets==2.12.0` fixed the problem for me.
2023-05-22T20:28:31Z
https://github.com/huggingface/datasets/issues/5451#issuecomment-1557930689
https://api.github.com/repos/huggingface/datasets/issues/5451
IC_kwDODunzps5c3CLB
https://api.github.com/repos/huggingface/datasets/issues/comments/1557930689/reactions
2023-05-22T20:30:17Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1557930689
https://avatars.githubusercontent.com/u/101493?v=4
https://api.github.com/users/justindujardin/events{/privacy}
https://api.github.com/users/justindujardin/followers
https://api.github.com/users/justindujardin/following{/other_user}
https://api.github.com/users/justindujardin/gists{/gist_id}
https://github.com/justindujardin
justindujardin
MDQ6VXNlcjEwMTQ5Mw==
https://api.github.com/users/justindujardin/orgs
https://api.github.com/users/justindujardin/received_events
https://api.github.com/users/justindujardin/repos
https://api.github.com/users/justindujardin/starred{/owner}{/repo}
https://api.github.com/users/justindujardin/subscriptions
User
https://api.github.com/users/justindujardin
public
### Describe the bug

I'm getting the following exception:
```
lib/python3.10/zipfile.py:1353 in _RealGetContents        │
│                                                                                                  │
│   1350 │   │   # self.start_dir:  Position of start of central directory                         │
│   1351 │   │   self.start_dir = offset_cd + concat                                               │
│   1352 │   │   if self.start_dir < 0:                                                            │
│ ❱ 1353 │   │   │   raise BadZipFile("Bad offset for central directory")                          │
│   1354 │   │   fp.seek(self.start_dir, 0)                                                        │
│   1355 │   │   data = fp.read(size_cd)                                                           │
│   1356 │   │   fp = io.BytesIO(data)                                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
BadZipFile: Bad offset for central directory                                                                            
Extracting data files:  35%|█████████████████▊                                 | 38572/110812 [00:10<00:20, 3576.26it/s]
```



### Steps to reproduce the bug

```
load_dataset(
    args.dataset_name,
    args.dataset_config_name,
    cache_dir=args.cache_dir,
),
```

### Expected behavior

loads the dataset

### Environment info

datasets==2.8.0
Python 3.10.8
Linux 129-146-3-202 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux