Sarim-Hash commited on
Commit
1a84bee
Β·
verified Β·
1 Parent(s): 2ad78b2

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. .gitignore +1 -0
  2. copier.ipynb +105 -0
  3. digit_upscaled.zip +3 -0
  4. vlcs.zip +3 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ push.sh
copier.ipynb ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stdout",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "Starting copy with 48 processes...\n"
13
+ ]
14
+ },
15
+ {
16
+ "name": "stderr",
17
+ "output_type": "stream",
18
+ "text": [
19
+ "Copying files: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 7680/7680 [00:12<00:00, 626.66it/s]\n"
20
+ ]
21
+ }
22
+ ],
23
+ "source": [
24
+ "import os\n",
25
+ "import shutil\n",
26
+ "from multiprocessing import Pool\n",
27
+ "from pathlib import Path\n",
28
+ "from tqdm import tqdm\n",
29
+ "\n",
30
+ "def copy_file(args):\n",
31
+ " src, dst = args\n",
32
+ " os.makedirs(os.path.dirname(dst), exist_ok=True)\n",
33
+ " shutil.copy2(src, dst)\n",
34
+ " return src\n",
35
+ "\n",
36
+ "def parallel_copy():\n",
37
+ " # Source and destination paths\n",
38
+ " src_dir = \"/l/users/chaimaa.abi/all_code_thesis/finetune-DM/dataset_upscaled/upscaled_VLCS\"\n",
39
+ " dst_dir = \"/l/users/sarim.hashmi/Thesis/ICCV/chimaa_data/upscaled_VLCS\"\n",
40
+ " \n",
41
+ " # Get all files from source directory\n",
42
+ " src_files = []\n",
43
+ " dst_files = []\n",
44
+ " \n",
45
+ " for root, _, files in os.walk(src_dir):\n",
46
+ " for file in files:\n",
47
+ " src_path = os.path.join(root, file)\n",
48
+ " # Create corresponding destination path\n",
49
+ " rel_path = os.path.relpath(src_path, src_dir)\n",
50
+ " dst_path = os.path.join(dst_dir, rel_path)\n",
51
+ " \n",
52
+ " src_files.append(src_path)\n",
53
+ " dst_files.append(dst_path)\n",
54
+ " \n",
55
+ " # Create file pairs for mapping\n",
56
+ " file_pairs = list(zip(src_files, dst_files))\n",
57
+ " \n",
58
+ " # Create destination directory\n",
59
+ " os.makedirs(dst_dir, exist_ok=True)\n",
60
+ " \n",
61
+ " # Use Process Pool for parallel copying\n",
62
+ " num_processes = os.cpu_count() # Use all available CPU cores\n",
63
+ " print(f\"Starting copy with {num_processes} processes...\")\n",
64
+ " \n",
65
+ " with Pool(num_processes) as pool:\n",
66
+ " # Use tqdm to show progress\n",
67
+ " for _ in tqdm(pool.imap_unordered(copy_file, file_pairs), \n",
68
+ " total=len(file_pairs),\n",
69
+ " desc=\"Copying files\"):\n",
70
+ " pass\n",
71
+ "\n",
72
+ "if __name__ == \"__main__\":\n",
73
+ " parallel_copy()"
74
+ ]
75
+ },
76
+ {
77
+ "cell_type": "code",
78
+ "execution_count": null,
79
+ "metadata": {},
80
+ "outputs": [],
81
+ "source": []
82
+ }
83
+ ],
84
+ "metadata": {
85
+ "kernelspec": {
86
+ "display_name": "AI702",
87
+ "language": "python",
88
+ "name": "python3"
89
+ },
90
+ "language_info": {
91
+ "codemirror_mode": {
92
+ "name": "ipython",
93
+ "version": 3
94
+ },
95
+ "file_extension": ".py",
96
+ "mimetype": "text/x-python",
97
+ "name": "python",
98
+ "nbconvert_exporter": "python",
99
+ "pygments_lexer": "ipython3",
100
+ "version": "3.12.1"
101
+ }
102
+ },
103
+ "nbformat": 4,
104
+ "nbformat_minor": 2
105
+ }
digit_upscaled.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:20dcb0f70ce85440a143eb03e932c334781fa12279f5cc3d234d9ac58f4d053c
3
+ size 2572978205
vlcs.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:242922590bb43ddd5021b9881249356607864f82dffe3b009ff26524f81f3ddb
3
+ size 2793376634