# Error while cloning repository

**URL:** <https://discuss.huggingface.co/t/error-while-cloning-repository/115958>\
**Category:** Beginners\
**Created:** [November 6, 2024, 8:36am UTC](https://discuss.huggingface.co/t/error-while-cloning-repository/115958 "2024-11-06T08:36:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hangunwoo07](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@hangunwoo07](https://discuss.huggingface.co/u/hangunwoo07)\
**Post date:** [November 6, 2024, 8:36am UTC](https://discuss.huggingface.co/t/error-while-cloning-repository/115958/1 "2024-11-06T08:36:38Z")

</div>

Hi everyone,

I’m encountering an issue while trying to build my project. It’s failing with a very minimal error message:

Build Log:  
===== Build Queued at 2024-11-06 07:46:28 / Commit SHA: [b439bbc](https://huggingface.co/spaces/hangunwoo07/BIORD/commit/b439bbc) =====  
“Error while cloning repository”

I can’t find any more error logs.

Here’s my questions:

1. Could this be related to the number/size of image files? I uploaded many image files to my space.
2. If it is, how can I upload numbers of image files to my space?

Any guidance on resolving this issue or best practices for uploads would be greatly appreciated.

Here’s the link of my space.

> **[BIORD - a Hugging Face Space by hangunwoo07](https://huggingface.co/spaces/hangunwoo07/BIORD)**
>
> BIORD Webpage Project

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [November 6, 2024, 8:54am UTC](https://discuss.huggingface.co/t/error-while-cloning-repository/115958/2 "2024-11-06T08:54:42Z")

</div>

To put it briefly, the problem you are encountering is probably a temporary bug in HF. The workaround is to put the data in the model repo or dataset repo, and put the programs in Spaces. If it’s just an image, there shouldn’t be a problem, but if it’s too much, it might not be the case.

> [@Build error: Error while cloning repository](https://discuss.huggingface.co/t/build-error-error-while-cloning-repository/113801):
>
> I’ve attempted to restart and perform a factory build multiple times, yet the build error persists. I’ve also researched and tried solutions from similar issues, but to no avail. Space link: [Image Matching Webui - a Hugging Face Space by Realcat](https://huggingface.co/spaces/Realcat/image-matching-webui) Thanks for your help:)

---

<div class="post-metadata">

**Author:** ![hangunwoo07](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@hangunwoo07](https://discuss.huggingface.co/u/hangunwoo07)\
**Post date:** [November 6, 2024, 9:38am UTC](https://discuss.huggingface.co/t/error-while-cloning-repository/115958/3 "2024-11-06T09:38:12Z")

</div>

Is tgz file available to my dataset? It would be much easier to upload my whole image files if it’s okay.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [November 6, 2024, 9:43am UTC](https://discuss.huggingface.co/t/error-while-cloning-repository/115958/4 "2024-11-06T09:43:32Z")

</div>

Even free users can upload files of up to 50GB per file and 300GB per repo (actually, you can go even higher, but that’s the nominal limit), and you can upload as many repos as you like. Of course, you can also upload tgz files.  
The problem is whether or not it’s easy to handle from the HF dataset library, etc., but please refer to the following for that.

> **[Image Dataset](https://huggingface.co/docs/hub/datasets-image)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

> **[WebDataset](https://huggingface.co/docs/hub/datasets-webdataset)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

If you don’t mind, just upload it.

---

<div class="post-metadata">

**Author:** ![hangunwoo07](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@hangunwoo07](https://discuss.huggingface.co/u/hangunwoo07)\
**Post date:** [November 6, 2024, 11:01am UTC](https://discuss.huggingface.co/t/error-while-cloning-repository/115958/5 "2024-11-06T11:01:47Z")

</div>

Sorry if this question is off topic, but I’m having trouble loading a dataset into my project. This is the container log.

```auto
===== Application Startup at 2024-11-06 10:51:02 =====

Traceback (most recent call last):
  File "/home/user/app/app.py", line 16, in <module>
    dataset = load_dataset("imagefolder", data_dir="hangunwoo07/Naturing_Bird_Data/bird_data_naturing.tgz")
  File "/usr/local/lib/python3.10/site-packages/datasets/load.py", line 2132, in load_dataset
    builder_instance = load_dataset_builder(
  File "/usr/local/lib/python3.10/site-packages/datasets/load.py", line 1853, in load_dataset_builder
    dataset_module = dataset_module_factory(
  File "/usr/local/lib/python3.10/site-packages/datasets/load.py", line 1562, in dataset_module_factory
    ).get_module()
  File "/usr/local/lib/python3.10/site-packages/datasets/load.py", line 940, in get_module
    else get_data_patterns(base_path, download_config=self.download_config)
  File "/usr/local/lib/python3.10/site-packages/datasets/data_files.py", line 503, in get_data_patterns
    raise EmptyDatasetError(f"The directory at {base_path} doesn't contain any data files") from None
datasets.data_files.EmptyDatasetError: The directory at /home/user/app/hangunwoo07/Naturing_Bird_Data/bird_data_naturing.tgz doesn't contain any data files
Traceback (most recent call last):
  File "/home/user/app/app.py", line 16, in <module>
    dataset = load_dataset("imagefolder", data_dir="hangunwoo07/Naturing_Bird_Data/bird_data_naturing.tgz")
  File "/usr/local/lib/python3.10/site-packages/datasets/load.py", line 2132, in load_dataset
    builder_instance = load_dataset_builder(
  File "/usr/local/lib/python3.10/site-packages/datasets/load.py", line 1853, in load_dataset_builder
    dataset_module = dataset_module_factory(
  File "/usr/local/lib/python3.10/site-packages/datasets/load.py", line 1562, in dataset_module_factory
    ).get_module()
  File "/usr/local/lib/python3.10/site-packages/datasets/load.py", line 940, in get_module
    else get_data_patterns(base_path, download_config=self.download_config)
  File "/usr/local/lib/python3.10/site-packages/datasets/data_files.py", line 503, in get_data_patterns
    raise EmptyDatasetError(f"The directory at {base_path} doesn't contain any data files") from None
datasets.data_files.EmptyDatasetError: The directory at /home/user/app/hangunwoo07/Naturing_Bird_Data/bird_data_naturing.tgz doesn't contain any data files

```

I’m trying to load dataset like this:

```auto
dataset = load_dataset("imagefolder", data_dir="hangunwoo07/Naturing_Bird_Data/bird_data_naturing.tgz")

def get_image_from_dataset(bird_name, image_filename):
    try:
        image_path = f"naturing_bird_image/naturing_bird_image/{bird_name}/{image_filename}"
        image_data = dataset[image_path]['image']

        if isinstance(image_data, Image.Image):
            img_byte_arr = io.BytesIO()
            image_data.save(img_byte_arr, format='JPEG')
            return img_byte_arr.getvalue()
        return image_data
        
    except Exception as e:
        print(f"Error accessing image from dataset: {e}")
        print(f"Attempted path: {image_path}")
        return None

```

How can I use dataset in my project?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [November 6, 2024, 11:03am UTC](https://discuss.huggingface.co/t/error-while-cloning-repository/115958/6 "2024-11-06T11:03:55Z")

</div>

Maybe this? I think it’s not off-topic because it’s caused by an error on the HF side and we’re doing it to avoid it.

> <https://github.com/huggingface/datasets/issues/7005>
>
> \### Describe the bug
> 
> while trying to load custom dataset from jsonl file, I get… the error: "metadata.jsonl doesn't contain any data files"
> 
> \### Steps to reproduce the bug
> 
> This is my \[metadata\_v2.jsonl\](https://github.com/user-attachments/files/16016011/metadata\_v2.json) file. I have this file in the folder with all images mentioned in that json(l) file.
> 
> Through below mentioned command I am trying to load\_dataset so that I can upload it as mentioned here on the \[official website\](https://huggingface.co/docs/datasets/en/image\_dataset#upload-dataset-to-the-hub).
> 
> \`\`\`\`
> from datasets import load\_dataset
> 
> dataset = load\_dataset("imagefolder", data\_dir="path/to/jsonl/metadata.jsonl")
> \`\`\`\`
> 
> error:
> 
> \`\`\`\`
> EmptyDatasetError Traceback (most recent call last)
> Cell In\[18\], line 3
> 1 from datasets import load\_dataset
> \----\> 3 dataset = load\_dataset("imagefolder", 
> 4 data\_dir="path/to/jsonl/file/metadata.jsonl")
> 5 dataset\[0\]\["objects"\]
> 
> File ~/anaconda3/envs/lvis/lib/python3.11/site-packages/datasets/load.py:2594, in load\_dataset(path, name, data\_dir, data\_files, split, cache\_dir, features, download\_config, download\_mode, verification\_mode, ignore\_verifications, keep\_in\_memory, save\_infos, revision, token, use\_auth\_token, task, streaming, num\_proc, storage\_options, trust\_remote\_code, \*\*config\_kwargs)
> 2589 verification\_mode = VerificationMode(
> 2590 (verification\_mode or VerificationMode.BASIC\_CHECKS) if not save\_infos else VerificationMode.ALL\_CHECKS
> 2591 )
> 2593 # Create a dataset builder
> \-\> 2594 builder\_instance = load\_dataset\_builder(
> 2595 path=path,
> 2596 name=name,
> 2597 data\_dir=data\_dir,
> 2598 data\_files=data\_files,
> 2599 cache\_dir=cache\_dir,
> 2600 features=features,
> 2601 download\_config=download\_config,
> 2602 download\_mode=download\_mode,
> 2603 revision=revision,
> 2604 token=token,
> 2605 storage\_options=storage\_options,
> 2606 trust\_remote\_code=trust\_remote\_code,
> 2607 \_require\_default\_config\_name=name is None,
> 2608 \*\*config\_kwargs,
> 2609 )
> 2611 # Return iterable dataset in case of streaming
> 2612 if streaming:
> 
> File ~/anaconda3/envs/lvis/lib/python3.11/site-packages/datasets/load.py:2266, in load\_dataset\_builder(path, name, data\_dir, data\_files, cache\_dir, features, download\_config, download\_mode, revision, token, use\_auth\_token, storage\_options, trust\_remote\_code, \_require\_default\_config\_name, \*\*config\_kwargs)
> 2264 download\_config = download\_config.copy() if download\_config else DownloadConfig()
> 2265 download\_config.storage\_options.update(storage\_options)
> \-\> 2266 dataset\_module = dataset\_module\_factory(
> 2267 path,
> 2268 revision=revision,
> 2269 download\_config=download\_config,
> 2270 download\_mode=download\_mode,
> 2271 data\_dir=data\_dir,
> 2272 data\_files=data\_files,
> 2273 cache\_dir=cache\_dir,
> 2274 trust\_remote\_code=trust\_remote\_code,
> 2275 \_require\_default\_config\_name=\_require\_default\_config\_name,
> 2276 \_require\_custom\_configs=bool(config\_kwargs),
> 2277 )
> 2278 # Get dataset builder class from the processing script
> 2279 builder\_kwargs = dataset\_module.builder\_kwargs
> 
> File ~/anaconda3/envs/lvis/lib/python3.11/site-packages/datasets/load.py:1805, in dataset\_module\_factory(path, revision, download\_config, download\_mode, dynamic\_modules\_path, data\_dir, data\_files, cache\_dir, trust\_remote\_code, \_require\_default\_config\_name, \_require\_custom\_configs, \*\*download\_kwargs)
> 1782 # We have several ways to get a dataset builder:
> 1783 #
> 1784 # - if path is the name of a packaged dataset module
> (...)
> 1796 
> 1797 # Try packaged
> 1798 if path in \_PACKAGED\_DATASETS\_MODULES:
> 1799 return PackagedDatasetModuleFactory(
> 1800 path,
> 1801 data\_dir=data\_dir,
> 1802 data\_files=data\_files,
> 1803 download\_config=download\_config,
> 1804 download\_mode=download\_mode,
> \-\> 1805 ).get\_module()
> 1806 # Try locally
> 1807 elif path.endswith(filename):
> 
> File ~/anaconda3/envs/lvis/lib/python3.11/site-packages/datasets/load.py:1140, in PackagedDatasetModuleFactory.get\_module(self)
> 1135 def get\_module(self) -\> DatasetModule:
> 1136 base\_path = Path(self.data\_dir or "").expanduser().resolve().as\_posix()
> 1137 patterns = (
> 1138 sanitize\_patterns(self.data\_files)
> 1139 if self.data\_files is not None
> \-\> 1140 else get\_data\_patterns(base\_path, download\_config=self.download\_config)
> 1141 )
> 1142 data\_files = DataFilesDict.from\_patterns(
> 1143 patterns,
> 1144 download\_config=self.download\_config,
> 1145 base\_path=base\_path,
> 1146 )
> 1147 supports\_metadata = self.name in \_MODULE\_SUPPORTS\_METADATA
> 
> File ~/anaconda3/envs/lvis/lib/python3.11/site-packages/datasets/data\_files.py:503, in get\_data\_patterns(base\_path, download\_config)
> 501 return \_get\_data\_files\_patterns(resolver)
> 502 except FileNotFoundError:
> \--\> 503 raise EmptyDatasetError(f"The directory at {base\_path} doesn't contain any data files") from None
> 
> EmptyDatasetError: The directory at path/to/jsonl/file/metadata.jsonl doesn't contain any data files\`
> \`\`\`
> 
> \### Expected behavior
> 
> It should be able load the whole file in a format of "dataset" inside the dataset variable. But it gives error "The directory at "path/to/jsonl/metadata.jsonl" doesn't contain any data files."
> 
> \### Environment info
> 
> I am using conda environment.

> Hi ! `data_dir=` is for directories, can you try using `data_files=` instead ?
