GokseninYuksel commited on
Commit
50bf69f
·
verified ·
1 Parent(s): b609c6b

Add files using upload-large-folder tool

Browse files
train/shard-000000.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6cbc42606671d8d6d4a2a0cee3de8d9d7fb06cbdfa9edc6bc6000b9c6825645b
3
+ size 18433034240
train/shard-000001.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e5bf88cb35e79e20456274bfe9b8e48ad0b1f04344eaa48cc21014ba7a6acf6
3
+ size 18433034240
train/shard-000002.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e5b704c4c36418767d54f99444b3ab923552a77d36ec0d9861c2d6d034854b54
3
+ size 18433034240
train/shard-000003.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b065e650968b414e1bfdb0b9563bd31d06f637ce039c2943b4ab70dacaa1c599
3
+ size 18433034240
train/shard-000004.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4bf3514c4ef2ce341099161d6d2cb81a59935504b6fa01b093be178723f04670
3
+ size 18433034240
train/shard-000005.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f59822c10a4cdf27dff598a5c38343ec8c31327e274a2ddfc9931c836ac69cf1
3
+ size 18433034240
train/shard-000008.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7aae1785fc48d4308834c0f4717e91ee242b6b7b682fb6b6a47f135d219e9c73
3
+ size 18433034240
train/shard-000009.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:013c9dd1b5945a50db35ef649586e6ad1c5a1bd7e2e61a2a14839a558e66c4e7
3
+ size 18433034240
train/shard-000010.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:500262f12aa0cb8d8257f06baa480fe68d68c4358c1646fd7a91ed23cf483617
3
+ size 18433034240
train/shard-000011.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f3971260f1b604d590e7e863bb9051588be9e210d8e25bbc5a9f21f5115e920
3
+ size 18433034240
train/shard-000012.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ee2d8a93f0b3ebf802ae0feeede4bdc02927f4821d95862bcda1dede0df424d
3
+ size 18433034240
train/shard-000015.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:66640d0a2b5faba5329c8248b41d502a297b4fbb5cf5cfae492cebc4e889249e
3
+ size 18433034240
train/shard-000019.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f901d78160b213f5c7b8537183addd546d9305ca92cdea5e77a32b2de5237225
3
+ size 18433034240
train/shard-000020.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:47f39c7e2e3d6eaf210aff97456cf757bd8dc6b21bd47d736bf3acf963c8e698
3
+ size 18433034240
train/shard-000021.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0e0421c258603e2a99af625587cb2e3b66818b1c69d6d764a503a6c29a40aa9b
3
+ size 18433034240
train/shard-000022.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:111308deb5fc4b1e4b50e53bcab139679767095c5351e0bc5bb575e9e0645bbf
3
+ size 18433034240
train/shard-000023.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d50f6a3fe3bd6f54e913202f1b4fadac921b7f1e11eccad63c056ac0d27e79e2
3
+ size 18433034240
train/shard-000026.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d2025cc67de4c0033f582145384a0f839decb28684e6982cd7eca11fa176b310
3
+ size 18433034240
train/shard-000028.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a471c359cdd6dd6e5c0ddea9d72391f0a439f5d517ce7cf6cfa202946d3b61ce
3
+ size 18433034240
train/shard-000030.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c198e4f772d231899e52ff7733010fbd514111136e6b6980acf645dcf8305ce4
3
+ size 18433034240
train/shard-000031.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2e7bc5dd49d4323b3add55cbc2260319bfca323a5c74a0e6145766dbdf74e507
3
+ size 18433034240
train/shard-000033.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6cf7e90fcf9b1aea8aec24bc08dd98cf7fd5d75f0d36461b4360589b1a2021c5
3
+ size 18433034240
train/shard-000034.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f016b62c99f62be058dac31b4879bf4658f023a4d5efc9c9ebaf07428a145b69
3
+ size 18433034240
train/shard-000035.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ce6ba57a12719a945c932fe3fbe27790fd5266f996e62f443d726b73a1c2073a
3
+ size 18433034240
train/shard-000036.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54531ab9e90b962fbd086a1f5ffaa6e833dd3a269f378fe35a211ba02a3225cd
3
+ size 18433034240
train/shard-000038.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1d41526e290910219f9bb186c7a0fd4c5a949a22d7fd8e854348993c42ada148
3
+ size 18433034240
train/shard-000039.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:68b672564ccb78e3b4b5d35ccd0bcb65f058fa75a1712f27eb551fb17e3e09c7
3
+ size 18433034240
train/shard-000040.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5cc505592f843d628008540dc0e744943d2872a03637f8c6e413e86509eb3153
3
+ size 18433034240
train/shard-000042.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b9299cc5c6d5a401e4c76653edb2d216e9f503bb0a83d338b14f44492e9d1f13
3
+ size 18433034240
train/shard-000043.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:af2fe20b5ee65e0e204941495c7edbe21c9151df6c1820bf0aa6857f55604de1
3
+ size 18433034240
train/shard-000044.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3981711c94717ba5626e6128ddabb57f09bcc860b040d7690f7a728233a9c8a9
3
+ size 18433034240
train/shard-000045.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4ab9952b78d74e79dbab3682c290e415c49454466b891fa0712b5ee53a6e0669
3
+ size 18433034240
train/shard-000047.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f80b713f28d00fbf1ffab787ddc3c33085c0a69447e389372e742faacf1bbe8
3
+ size 18433034240
train/shard-000048.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8eacb86fabeb255e3b5210d7fb1baefba40e0077e48da47cf5cb3d95264fb40
3
+ size 18433034240
train/shard-000049.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4527b2ea46cdabfe9b8d49f4ffe906f85c2bab852e6b940958d6259d22c758aa
3
+ size 18433034240
train/shard-000051.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7d2a9f83f978c44a29828620d9ab7166e66fb1947320dab973c0b7d6d363c59
3
+ size 18433034240
train/shard-000052.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8130cb52bf1c693387c8cf10de24b0a9a21b99fe14292b86153fd12c62b9efb6
3
+ size 18433034240
train/shard-000053.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb5faf3d201f5badfa8c43cf3563298f5479cad6b0c71c552af91569f6190e4e
3
+ size 18433034240
train/shard-000055.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5206ba74e3cbc4a58fb4e3b8fa5f699d7bc1a8a6ef29058c5676dc33fc5353a
3
+ size 18433034240
train/shard-000056.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd43f08fd6936a36fdfe55fc391fe0b00352a5eb403939aaeb9b297f5dba3e20
3
+ size 18433034240
train/shard-000057.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:327437562d5761c629af7a393b379576bb63fb71fb5a3793b7d3e86d5a196d73
3
+ size 18433034240
train/shard-000060.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bf8f27aca9eff0af53bd610d43804cd065b57eaedbd44ddacb02adc0100cb703
3
+ size 18433034240
train/shard-000061.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ffeac549fbfb0768b6d8565a25e26dcee3da7351d7fc6ccc5a43dd5ef4e0d30e
3
+ size 18433034240
train/shard-000062.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a4b8ab6ee39db2b46c8774d1e3caf50182ff022a630ce832169eef3503e7ea8
3
+ size 18433034240
train/shard-000064.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0eb97cfe91f2f356cdbc45c95b841f25ceac8aa993cb34cc0aaa7f4e8a11f10b
3
+ size 18433034240
train/shard-000066.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d9c3ae459404b0b8693ccbe82afe9a6cacdc88b9c48f5215978f13a9869828f
3
+ size 18433034240
train/shard-000067.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:64968ecde3cdde7d832bf45cda383a005affd012fc27b297ac684b658f3c3cdc
3
+ size 18433034240
train/shard-000069.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:545e6a025351557a422c0ef16cab82b8a2364c5286c8bf715d83977ef9bc0690
3
+ size 18433034240
upload.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import HfApi
2
+ from huggingface_hub import login
3
+
4
+ login()
5
+ api = HfApi()
6
+
7
+ api.upload_large_folder(
8
+ repo_id="labhamlet/GRAM-Naturalistic-Scenes-Ambisonics",
9
+ repo_type="dataset",
10
+ folder_path=".",
11
+ )
wds_converter.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Convert [NPY] folder to WebDataset format for reading.
4
+
5
+ This script is optimized to use all available CPU cores for parallel processing
6
+ and includes a progress bar for monitoring.
7
+ """
8
+
9
+ import tarfile
10
+ import numpy as np
11
+ from pathlib import Path
12
+ import io
13
+ import concurrent.futures
14
+ from tqdm import tqdm
15
+
16
+ def _create_shard(args):
17
+ """
18
+ Worker function to create a single WebDataset shard from a list of .npy files.
19
+ This function is designed to be called by a process pool.
20
+ """
21
+ shard_id, npy_files_chunk, output_path = args
22
+ shard_name = f"shard-{shard_id:06d}.tar"
23
+ shard_path = output_path / shard_name
24
+
25
+ with tarfile.open(shard_path, 'w') as current_tar:
26
+ for npy_file in npy_files_chunk:
27
+ try:
28
+ # Load numpy array
29
+ array = np.load(npy_file)
30
+
31
+ # Create sample key (filename without extension)
32
+ sample_key = npy_file.stem
33
+
34
+ # Add numpy array as .npy file in tar
35
+ npy_buffer = io.BytesIO()
36
+ np.save(npy_buffer, array)
37
+ npy_buffer.seek(0)
38
+
39
+ tarinfo = tarfile.TarInfo(name=f"{sample_key}.npy")
40
+ tarinfo.size = npy_buffer.getbuffer().nbytes
41
+ current_tar.addfile(tarinfo, npy_buffer)
42
+
43
+ except Exception as e:
44
+ print(f"Error processing {npy_file} for shard {shard_id}: {e}")
45
+ continue
46
+ return shard_path
47
+
48
+ def create_webdataset_from_npy(
49
+ input_dir: str = "[NPY]",
50
+ output_dir: str = "webdataset_output",
51
+ shard_size: int = 1000
52
+ ):
53
+ """
54
+ Convert .npy files from an input folder to WebDataset format in parallel.
55
+
56
+ Args:
57
+ input_dir (str): Directory containing .npy files.
58
+ output_dir (str): Directory to save WebDataset tar files.
59
+ shard_size (int): Number of samples per shard.
60
+ """
61
+ input_path = Path(input_dir)
62
+ output_path = Path(output_dir)
63
+ output_path.mkdir(parents=True, exist_ok=True)
64
+
65
+ # Get and sort all .npy files for consistent ordering
66
+ npy_files = sorted(list(input_path.glob("*.npy")), key=lambda x: x.name)
67
+
68
+ if not npy_files:
69
+ raise ValueError(f"No .npy files found in {input_dir}")
70
+
71
+ print(f"Found {len(npy_files)} .npy files to process.")
72
+
73
+ # Split files into chunks for each shard
74
+ file_chunks = [
75
+ npy_files[i:i + shard_size]
76
+ for i in range(0, len(npy_files), shard_size)
77
+ ]
78
+
79
+ num_shards = len(file_chunks)
80
+ print(f"Data will be split into {num_shards} shards.")
81
+
82
+ # Prepare arguments for the worker function
83
+ tasks = [
84
+ (shard_id, chunk, output_path)
85
+ for shard_id, chunk in enumerate(file_chunks)
86
+ ]
87
+
88
+ with concurrent.futures.ProcessPoolExecutor() as executor:
89
+ # Use tqdm to create a progress bar
90
+ results = list(tqdm(
91
+ executor.map(_create_shard, tasks),
92
+ total=num_shards,
93
+ desc="Creating Shards"
94
+ ))
95
+
96
+ print(f"\nConversion complete! Created {len(results)} shards in '{output_dir}'.")
97
+ return len(results)
98
+
99
+
100
+ if __name__ == "__main__":
101
+ num_created_shards = create_webdataset_from_npy(
102
+ input_dir="raw",
103
+ output_dir="webdataset_output",
104
+ shard_size=1000 # Each .tar file will contain 1000 samples
105
+ )
106
+
107
+ print(f"\nSuccessfully created {num_created_shards} shards.")