Sequence
int64 1
25.2k
| Time
int64 1
858M
| File
stringclasses 830
values | RangeOffset
int64 0
2.21M
| RangeLength
int64 0
168k
| Text
stringlengths 1
4.7M
⌀ | Language
stringclasses 20
values | Type
stringclasses 9
values |
|---|---|---|---|---|---|---|---|
2,300
| 2,703,546
|
TERMINAL
| 0
| 0
|
bash
| null |
terminal_focus
|
2,301
| 2,706,195
|
TERMINAL
| 0
| 0
|
bash
| null |
terminal_focus
|
2,302
| 2,706,198
|
utils/preprocess_dataset.py
| 0
| 0
| null |
python
|
tab
|
2,303
| 2,708,712
|
utils/preprocess_dataset.py
| 0
| 2,104
|
from dataclasses import dataclass\n\nimport tensorflow as tf\nimport numpy as np\nimport logging\nimport tyro\nfrom pathlib import Path\nfrom tqdm import tqdm\n\nlogging.basicConfig(level=logging.INFO)\n\n\n@dataclass\nclass Args:\n source_data_dir: str = "data/coinrun_episodes"\n output_tfrecords_dir: str = "data_tfrecords"\n num_shards: int = 50\n\n\nargs = tyro.cli(Args)\n\n\ndef _bytes_feature(value):\n if isinstance(value, type(tf.constant(0))):\n value = value.numpy()\n return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))\n\n\ndef _int64_feature(value):\n return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))\n\n\ndef create_tfrecord_example(episode_numpy_array):\n feature = {\n "height": _int64_feature(episode_numpy_array.shape[1]),\n "width": _int64_feature(episode_numpy_array.shape[2]),\n "channels": _int64_feature(episode_numpy_array.shape[3]),\n "sequence_length": _int64_feature(episode_numpy_array.shape[0]),\n "raw_video": _bytes_feature(episode_numpy_array.tobytes()),\n }\n return tf.train.Example(features=tf.train.Features(feature=feature))\n\n\ndef main_preprocess(data_dir_str, output_dir_str, num_shards):\n data_dir = Path(data_dir_str)\n output_dir = Path(output_dir_str)\n output_dir.mkdir(parents=True, exist_ok=True)\n\n metadata = np.load(data_dir / "metadata.npy", allow_pickle=True)\n episode_source_paths = [Path(item["path"]) for item in metadata]\n num_total_episodes = len(episode_source_paths)\n\n if num_shards <= 0:\n raise ValueError("num_shards must be positive.")\n if num_shards > num_total_episodes:\n logging.warning(\n f"Warning: num_shards ({num_shards}) is greater than total episodes ({num_total_episodes}). "\n f"Setting num_shards to {num_total_episodes}."\n )\n num_shards = num_total_episodes\n\n logging.info(\n f"Preparing to write {num_total_episodes} episodes to {num_shards} TFRecord shards in {output_dir}..."\n )\n\n output_filenames = [\n str(output_dir / f"shard-{i:05d}-of-{num_shards:05d}.tfrecord")
|
python
|
selection_command
|
2,304
| 2,709,225
|
utils/preprocess_dataset.py
| 0
| 0
| null |
python
|
selection_command
|
2,305
| 2,709,761
|
utils/preprocess_dataset.py
| 34
| 0
| null |
python
|
selection_command
|
2,306
| 2,710,008
|
utils/preprocess_dataset.py
| 35
| 0
| null |
python
|
selection_command
|
2,307
| 2,710,033
|
utils/preprocess_dataset.py
| 59
| 0
| null |
python
|
selection_command
|
2,308
| 2,710,063
|
utils/preprocess_dataset.py
| 78
| 0
| null |
python
|
selection_command
|
2,309
| 2,710,098
|
utils/preprocess_dataset.py
| 93
| 0
| null |
python
|
selection_command
|
2,310
| 2,710,131
|
utils/preprocess_dataset.py
| 105
| 0
| null |
python
|
selection_command
|
2,311
| 2,710,164
|
utils/preprocess_dataset.py
| 130
| 0
| null |
python
|
selection_command
|
2,312
| 2,710,199
|
utils/preprocess_dataset.py
| 152
| 0
| null |
python
|
selection_command
|
2,313
| 2,710,233
|
utils/preprocess_dataset.py
| 153
| 0
| null |
python
|
selection_command
|
2,314
| 2,710,269
|
utils/preprocess_dataset.py
| 193
| 0
| null |
python
|
selection_command
|
2,315
| 2,710,302
|
utils/preprocess_dataset.py
| 194
| 0
| null |
python
|
selection_command
|
2,316
| 2,710,336
|
utils/preprocess_dataset.py
| 195
| 0
| null |
python
|
selection_command
|
2,317
| 2,710,376
|
utils/preprocess_dataset.py
| 206
| 0
| null |
python
|
selection_command
|
2,318
| 2,710,408
|
utils/preprocess_dataset.py
| 218
| 0
| null |
python
|
selection_command
|
2,319
| 2,710,510
|
utils/preprocess_dataset.py
| 269
| 0
| null |
python
|
selection_command
|
2,320
| 2,710,513
|
utils/preprocess_dataset.py
| 318
| 0
| null |
python
|
selection_command
|
2,321
| 2,710,515
|
utils/preprocess_dataset.py
| 343
| 0
| null |
python
|
selection_command
|
2,322
| 2,710,536
|
utils/preprocess_dataset.py
| 344
| 0
| null |
python
|
selection_command
|
2,323
| 2,710,568
|
utils/preprocess_dataset.py
| 345
| 0
| null |
python
|
selection_command
|
2,324
| 2,710,601
|
utils/preprocess_dataset.py
| 367
| 0
| null |
python
|
selection_command
|
2,325
| 2,710,633
|
utils/preprocess_dataset.py
| 368
| 0
| null |
python
|
selection_command
|
2,326
| 2,710,668
|
utils/preprocess_dataset.py
| 369
| 0
| null |
python
|
selection_command
|
2,327
| 2,710,700
|
utils/preprocess_dataset.py
| 396
| 0
| null |
python
|
selection_command
|
2,328
| 2,710,735
|
utils/preprocess_dataset.py
| 444
| 0
| null |
python
|
selection_command
|
2,329
| 2,710,774
|
utils/preprocess_dataset.py
| 474
| 0
| null |
python
|
selection_command
|
2,330
| 2,710,809
|
utils/preprocess_dataset.py
| 548
| 0
| null |
python
|
selection_command
|
2,331
| 2,710,843
|
utils/preprocess_dataset.py
| 549
| 0
| null |
python
|
selection_command
|
2,332
| 2,710,873
|
utils/preprocess_dataset.py
| 550
| 0
| null |
python
|
selection_command
|
2,333
| 2,710,906
|
utils/preprocess_dataset.py
| 577
| 0
| null |
python
|
selection_command
|
2,334
| 2,710,940
|
utils/preprocess_dataset.py
| 651
| 0
| null |
python
|
selection_command
|
2,335
| 2,710,972
|
utils/preprocess_dataset.py
| 652
| 0
| null |
python
|
selection_command
|
2,336
| 2,711,006
|
utils/preprocess_dataset.py
| 653
| 0
| null |
python
|
selection_command
|
2,337
| 2,711,041
|
utils/preprocess_dataset.py
| 703
| 0
| null |
python
|
selection_command
|
2,338
| 2,711,071
|
utils/preprocess_dataset.py
| 719
| 0
| null |
python
|
selection_command
|
2,339
| 2,899,815
|
sbatch_scripts/preprocess/npy_to_tfrecord_6xx.sbatch
| 0
| 0
| null |
shellscript
|
tab
|
2,340
| 2,900,135
|
sbatch_scripts/preprocess/npy_to_tfrecord_10xx.sbatch
| 0
| 0
| null |
shellscript
|
tab
|
2,341
| 2,904,596
|
TERMINAL
| 0
| 0
| null | null |
terminal_focus
|
2,342
| 2,908,042
|
TERMINAL
| 0
| 0
|
gs
| null |
terminal_command
|
2,343
| 2,908,093
|
TERMINAL
| 0
| 0
|
]633;E;2025-06-25 11:05:41 gs;496a50d8-7b93-48a0-91cd-6498b834980b]633;C
| null |
terminal_output
|
2,344
| 2,908,158
|
TERMINAL
| 0
| 0
|
On branch preprocess_video\r\nYour branch is up to date with 'origin/preprocess_video'.\r\n\r\nChanges not staged for commit:\r\n (use "git add <file>..." to update what will be committed)\r\n (use "git restore <file>..." to discard changes in working directory)\r\n\t[31mmodified: utils/preprocess_dataset.py[m\r\n\t[31mmodified: utils/preprocess_video_to_npy.py[m\r\n\r\nUntracked files:\r\n (use "git add <file>..." to include in what will be committed)\r\n\t[31mnotes.md[m\r\n\t[31mrequirements_franz.txt[m\r\n\t[31msample_resolution_batches.py[m\r\n\t[31mshell_scripts/[m\r\n\t[31mtrain_dynamics_single_batch.py[m\r\n\t[31mtrain_lam_single_batch.py[m\r\n\t[31mtrain_lam_tf_seeding.py[m\r\n\t[31mtrain_tokenizer_logging.py[m\r\n\t[31mtrain_tokenizer_single_batch.py[m\r\n\t[31mutils/clip_checker.py[m\r\n\t[31mutils/dataloader_seeding.py[m\r\n\r\nno changes added to commit (use "git add" and/or "git commit -a")\r\n]0;tum_ind3695@hkn1993:~/projects/jafar]633;D;0
| null |
terminal_output
|
2,345
| 2,913,724
|
utils/preprocess_dataset.py
| 0
| 0
| null |
python
|
tab
|
2,346
| 2,913,743
|
utils/preprocess_dataset.py
| 130
| 0
| null |
python
|
selection_command
|
2,347
| 2,927,604
|
utils/preprocess_video_to_npy.py
| 0
| 0
|
import ffmpeg\nimport numpy as np\nimport os\nimport tyro\nimport multiprocessing as mp\nfrom dataclasses import dataclass\nimport json\n\n@dataclass\nclass Args:\n target_width, target_height = 160, 90\n target_fps = 10\n input_path: str = (\n "/hkfs/work/workspace/scratch/tum_ind3695-jafa_ws_shared/data/knoms/"\n )\n output_path: str = (\n "/hkfs/work/workspace/scratch/tum_ind3695-jafa_ws_shared/data/knoms_npy"\n )\n\n\ndef preprocess_video(\n idx, in_filename, output_path, target_width, target_height, target_fps\n):\n print(f"Processing video {idx}")\n \n print('filename', in_filename)\n try:\n out, _ = (\n ffmpeg.input(in_filename)\n .filter("fps", fps=target_fps, round="up")\n .filter("scale", target_width, target_height)\n .output("pipe:", format="rawvideo", pix_fmt="rgb24")\n .run(capture_stdout=True, quiet=True)\n )\n \n frame_size = target_height * target_width * 3\n n_frames = len(out) // frame_size\n \n frames = np.frombuffer(out, np.uint8).reshape(\n n_frames, target_height, target_width, 3\n )\n \n output_file = f'{output_path}/{os.path.splitext(os.path.basename(in_filename))[0]}.npy'\n if not os.path.exists(os.path.dirname(output_file)):\n os.makedirs(os.path.dirname(output_file))\n \n np.save(output_file, frames)\n print(f"Saved {n_frames} frames to {output_file} with shape {frames.shape}")\n return in_filename, True\n except Exception as e:\n print(f"Error processing video {idx} ({in_filename}): {e}")\n return in_filename, False\n\n\ndef get_meta_data(filename, directory):\n filepath = os.path.join(directory, filename)\n arr = np.load(filepath, mmap_mode="r")\n return filepath, arr.shape[0]\n\n\ndef main():\n args = tyro.cli(Args)\n\n output_path = f"{args.output_path}/{args.target_fps}fps_{args.target_width}x{args.target_height}"\n print(output_path)\n\n num_processes = mp.cpu_count()\n print(f"Number of processes: {num_processes}")\n\n print("Converting mp4 to npy files...")\n pool_args = [\n (\n idx,\n args.input_path + in_filename,\n output_path,\n args.target_width,\n args.target_height,\n args.target_fps,\n )\n for idx, in_filename in enumerate(os.listdir(args.input_path))\n if in_filename.endswith(".mp4") or in_filename.endswith(".webm")\n ]\n\n results = []\n with mp.Pool(processes=num_processes) as pool:\n for result in pool.starmap(preprocess_video, pool_args):\n results.append(result)\n print("Done converting mp4 to npy files")\n\n # count the number of failed videos\n failed_videos = [result for result in results if not result[1]]\n print(f"Number of failed videos: {len(failed_videos)}")\n print(f"Number of successful videos: {len(results) - len(failed_videos)}")\n print(f"Number of total videos: {len(results)}")\n\n json.dump(failed_videos, open(output_path + "/failed_videos.json", "w"))\n\n print("Creating metadata file...")\n metadata = []\n filenames = [\n filename\n for filename in os.listdir(output_path)\n if filename.endswith(".npy") and filename != "metadata.npy"\n ]\n pool_args = [(filename, output_path) for filename in filenames]\n\n with mp.Pool(processes=num_processes) as pool:\n results = list(pool.starmap(get_meta_data, pool_args))\n metadata = [{"path": path, "length": length} for path, length in results]\n np.save(output_path + "/metadata.npy", metadata)\n print(f"Saved {len(metadata)} videos to {output_path}")\n\n\nif __name__ == "__main__":\n main()\n
|
python
|
tab
|
2,348
| 2,927,606
|
utils/preprocess_video_to_npy.py
| 118
| 0
| null |
python
|
selection_command
|
2,349
| 2,939,235
|
TERMINAL
| 0
| 0
|
bash
| null |
terminal_focus
|
2,350
| 2,945,014
|
TERMINAL
| 0
| 0
|
gs
| null |
terminal_command
|
2,351
| 2,945,085
|
TERMINAL
| 0
| 0
|
]633;E;2025-06-25 11:06:18 gs;a9a4de27-e0e0-4f7a-a81f-6ae3e98df676]633;COn branch preprocess_video\r\nYour branch is up to date with 'origin/preprocess_video'.\r\n\r\nChanges not staged for commit:\r\n (use "git add <file>..." to update what will be committed)\r\n (use "git restore <file>..." to discard changes in working directory)\r\n\t[31mmodified: utils/preprocess_dataset.py[m\r\n\t[31mmodified: utils/preprocess_video_to_npy.py[m\r\n\r\nUntracked files:\r\n (use "git add <file>..." to include in what will be committed)\r\n\t[31mnotes.md[m\r\n\t[31mrequirements_franz.txt[m\r\n\t[31msample_resolution_batches.py[m\r\n\t[31mshell_scripts/[m\r\n\t[31mtrain_dynamics_single_batch.py[m\r\n\t[31mtrain_lam_single_batch.py[m\r\n\t[31mtrain_lam_tf_seeding.py[m\r\n\t[31mtrain_tokenizer_logging.py[m\r\n\t[31mtrain_tokenizer_single_batch.py[m\r\n\t[31mutils/clip_checker.py[m\r\n\t[31mutils/dataloader_seeding.py[m\r\n\r\nno changes added to commit (use "git add" and/or "git commit -a")\r\n]0;tum_ind3695@hkn1993:~/projects/jafar]633;D;0
| null |
terminal_output
|
2,352
| 2,953,745
|
TERMINAL
| 0
| 0
|
git add utils/preprocess_*
| null |
terminal_command
|
2,353
| 2,953,794
|
TERMINAL
| 0
| 0
|
]633;E;2025-06-25 11:06:27 git add utils/preprocess_*;a9a4de27-e0e0-4f7a-a81f-6ae3e98df676]633;C]0;tum_ind3695@hkn1993:~/projects/jafar]633;D;0
| null |
terminal_output
|
2,354
| 2,962,591
|
TERMINAL
| 0
| 0
|
gs
| null |
terminal_command
|
2,355
| 2,962,628
|
TERMINAL
| 0
| 0
|
]633;E;2025-06-25 11:06:35 gs;a9a4de27-e0e0-4f7a-a81f-6ae3e98df676]633;COn branch preprocess_video\r\nYour branch is up to date with 'origin/preprocess_video'.\r\n\r\nChanges to be committed:\r\n (use "git restore --staged <file>..." to unstage)\r\n\t[32mmodified: utils/preprocess_dataset.py[m\r\n\t[32mmodified: utils/preprocess_video_to_npy.py[m\r\n\r\nUntracked files:\r\n (use "git add <file>..." to include in what will be committed)\r\n\t[31mnotes.md[m\r\n\t[31mrequirements_franz.txt[m\r\n\t[31msample_resolution_batches.py[m\r\n\t[31mshell_scripts/[m\r\n\t[31mtrain_dynamics_single_batch.py[m\r\n\t[31mtrain_lam_single_batch.py[m\r\n\t[31mtrain_lam_tf_seeding.py[m\r\n\t[31mtrain_tokenizer_logging.py[m\r\n\t[31mtrain_tokenizer_single_batch.py[m\r\n\t[31mutils/clip_checker.py[m\r\n\t[31mutils/dataloader_seeding.py[m\r\n\r\n]0;tum_ind3695@hkn1993:~/projects/jafar]633;D;0
| null |
terminal_output
|
2,356
| 2,975,922
|
utils/preprocess_dataset.py
| 0
| 0
|
from dataclasses import dataclass\n\nimport tensorflow as tf\nimport numpy as np\nimport logging\nimport tyro\nfrom pathlib import Path\nfrom tqdm import tqdm\n\nlogging.basicConfig(level=logging.INFO)\n\n\n@dataclass\nclass Args:\n source_data_dir: str = "data/coinrun_episodes"\n output_tfrecords_dir: str = "data_tfrecords"\n num_shards: int = 50\n\n\nargs = tyro.cli(Args)\n\n\ndef _bytes_feature(value):\n if isinstance(value, type(tf.constant(0))):\n value = value.numpy()\n return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))\n\n\ndef _int64_feature(value):\n return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))\n\n\ndef create_tfrecord_example(episode_numpy_array):\n feature = {\n "height": _int64_feature(episode_numpy_array.shape[1]),\n "width": _int64_feature(episode_numpy_array.shape[2]),\n "channels": _int64_feature(episode_numpy_array.shape[3]),\n "sequence_length": _int64_feature(episode_numpy_array.shape[0]),\n "raw_video": _bytes_feature(episode_numpy_array.tobytes()),\n }\n return tf.train.Example(features=tf.train.Features(feature=feature))\n\n\ndef main_preprocess(data_dir_str, output_dir_str, num_shards):\n data_dir = Path(data_dir_str)\n output_dir = Path(output_dir_str)\n output_dir.mkdir(parents=True, exist_ok=True)\n\n metadata = np.load(data_dir / "metadata.npy", allow_pickle=True)\n episode_source_paths = [Path(item["path"]) for item in metadata]\n num_total_episodes = len(episode_source_paths)\n\n if num_shards <= 0:\n raise ValueError("num_shards must be positive.")\n if num_shards > num_total_episodes:\n logging.warning(\n f"Warning: num_shards ({num_shards}) is greater than total episodes ({num_total_episodes}). "\n f"Setting num_shards to {num_total_episodes}."\n )\n num_shards = num_total_episodes\n\n logging.info(\n f"Preparing to write {num_total_episodes} episodes to {num_shards} TFRecord shards in {output_dir}..."\n )\n\n output_filenames = [\n str(output_dir / f"shard-{i:05d}-of-{num_shards:05d}.tfrecord")\n for i in range(num_shards)\n ]\n writers = [tf.io.TFRecordWriter(filename) for filename in output_filenames]\n\n writer_idx_for_episode = 0\n try:\n for i, npy_path in tqdm(enumerate(episode_source_paths), total=num_total_episodes, desc="Processing episodes"):\n try:\n episode_data = np.load(npy_path)\n tf_example = create_tfrecord_example(episode_data)\n\n current_writer = writers[writer_idx_for_episode]\n current_writer.write(tf_example.SerializeToString())\n\n writer_idx_for_episode = (writer_idx_for_episode + 1) % num_shards\n\n except Exception as e:\n logging.error(f"Skipping {npy_path} due to error: {e}")\n finally:\n for writer in writers:\n writer.close()\n logging.info(\n f"TFRecord sharding complete. {num_shards} shards written to {output_dir}."\n )\n logging.info("Generated shard files:")\n for fname in output_filenames:\n logging.info(f" {fname}")\n\n\nif __name__ == "__main__":\n if (\n not Path(args.source_data_dir).exists()\n or not (Path(args.source_data_dir) / "metadata.npy").exists()\n ):\n logging.error(f"Please generate data in '{args.source_data_dir}' first.")\n else:\n main_preprocess(\n args.source_data_dir, args.output_tfrecords_dir, args.num_shards\n )\n
|
python
|
tab
|
2,357
| 2,975,924
|
utils/preprocess_dataset.py
| 130
| 0
| null |
python
|
selection_command
|
2,358
| 2,980,004
|
utils/preprocess_video_to_npy.py
| 0
| 0
|
import ffmpeg\nimport numpy as np\nimport os\nimport tyro\nimport multiprocessing as mp\nfrom dataclasses import dataclass\nimport json\n\n@dataclass\nclass Args:\n target_width, target_height = 160, 90\n target_fps = 10\n input_path: str = (\n "/hkfs/work/workspace/scratch/tum_ind3695-jafa_ws_shared/data/knoms/"\n )\n output_path: str = (\n "/hkfs/work/workspace/scratch/tum_ind3695-jafa_ws_shared/data/knoms_npy"\n )\n\n\ndef preprocess_video(\n idx, in_filename, output_path, target_width, target_height, target_fps\n):\n print(f"Processing video {idx}")\n \n print('filename', in_filename)\n try:\n out, _ = (\n ffmpeg.input(in_filename)\n .filter("fps", fps=target_fps, round="up")\n .filter("scale", target_width, target_height)\n .output("pipe:", format="rawvideo", pix_fmt="rgb24")\n .run(capture_stdout=True, quiet=True)\n )\n \n frame_size = target_height * target_width * 3\n n_frames = len(out) // frame_size\n \n frames = np.frombuffer(out, np.uint8).reshape(\n n_frames, target_height, target_width, 3\n )\n \n output_file = f'{output_path}/{os.path.splitext(os.path.basename(in_filename))[0]}.npy'\n if not os.path.exists(os.path.dirname(output_file)):\n os.makedirs(os.path.dirname(output_file))\n \n np.save(output_file, frames)\n print(f"Saved {n_frames} frames to {output_file} with shape {frames.shape}")\n return in_filename, True\n except Exception as e:\n print(f"Error processing video {idx} ({in_filename}): {e}")\n return in_filename, False\n\n\ndef get_meta_data(filename, directory):\n filepath = os.path.join(directory, filename)\n arr = np.load(filepath, mmap_mode="r")\n return filepath, arr.shape[0]\n\n\ndef main():\n args = tyro.cli(Args)\n\n output_path = f"{args.output_path}/{args.target_fps}fps_{args.target_width}x{args.target_height}"\n print(output_path)\n\n num_processes = mp.cpu_count()\n print(f"Number of processes: {num_processes}")\n\n print("Converting mp4 to npy files...")\n pool_args = [\n (\n idx,\n args.input_path + in_filename,\n output_path,\n args.target_width,\n args.target_height,\n args.target_fps,\n )\n for idx, in_filename in enumerate(os.listdir(args.input_path))\n if in_filename.endswith(".mp4") or in_filename.endswith(".webm")\n ]\n\n results = []\n with mp.Pool(processes=num_processes) as pool:\n for result in pool.starmap(preprocess_video, pool_args):\n results.append(result)\n print("Done converting mp4 to npy files")\n\n # count the number of failed videos\n failed_videos = [result for result in results if not result[1]]\n print(f"Number of failed videos: {len(failed_videos)}")\n print(f"Number of successful videos: {len(results) - len(failed_videos)}")\n print(f"Number of total videos: {len(results)}")\n\n json.dump(failed_videos, open(output_path + "/failed_videos.json", "w"))\n\n print("Creating metadata file...")\n metadata = []\n filenames = [\n filename\n for filename in os.listdir(output_path)\n if filename.endswith(".npy") and filename != "metadata.npy"\n ]\n pool_args = [(filename, output_path) for filename in filenames]\n\n with mp.Pool(processes=num_processes) as pool:\n results = list(pool.starmap(get_meta_data, pool_args))\n metadata = [{"path": path, "length": length} for path, length in results]\n np.save(output_path + "/metadata.npy", metadata)\n print(f"Saved {len(metadata)} videos to {output_path}")\n\n\nif __name__ == "__main__":\n main()\n
|
python
|
tab
|
2,359
| 2,980,007
|
utils/preprocess_video_to_npy.py
| 118
| 0
| null |
python
|
selection_command
|
2,360
| 2,993,349
|
utils/preprocess_video_to_npy.py
| 0
| 0
|
import ffmpeg\nimport numpy as np\nimport os\nimport tyro\nimport multiprocessing as mp\nfrom dataclasses import dataclass\n\n\n@dataclass\nclass Args:\n target_width, target_height = 160, 90\n target_fps = 10\n input_path: str = (\n "/hkfs/work/workspace/scratch/tum_ind3695-jafa_ws_shared/data/knoms/"\n )\n output_path: str = (\n "/hkfs/work/workspace/scratch/tum_ind3695-jafa_ws_shared/data/knoms_npy"\n )\n\n\ndef preprocess_video(\n idx, in_filename, output_path, target_width, target_height, target_fps\n):\n print(f"Processing video {idx}")\n\n out, _ = (\n ffmpeg.input(in_filename)\n .filter("fps", fps=target_fps, round="up")\n .filter("scale", target_width, target_height)\n .output("pipe:", format="rawvideo", pix_fmt="rgb24")\n .run(capture_stdout=True, quiet=True)\n )\n\n frame_size = target_height * target_width * 3\n n_frames = len(out) // frame_size\n\n frames = np.frombuffer(out, np.uint8).reshape(\n n_frames, target_height, target_width, 3\n )\n\n output_file = f'{output_path}/{in_filename.split("/")[-1].split(".")[0]}.npy'\n if not os.path.exists(os.path.dirname(output_file)):\n os.makedirs(os.path.dirname(output_file))\n\n np.save(output_file, frames)\n print(f"Saved {n_frames} frames to {output_file} with shape {frames.shape}")\n\n\ndef get_meta_data(filename, directory):\n filepath = os.path.join(directory, filename)\n arr = np.load(filepath, mmap_mode="r")\n return filepath, arr.shape[0]\n\n\ndef main():\n args = tyro.cli(Args)\n\n output_path = f"{args.output_path}/{args.target_fps}fps_{args.target_width}x{args.target_height}"\n print(output_path)\n\n print(f"Number of processes: {mp.cpu_count()}")\n print("Converting mp4 to npy files...")\n pool_args = [\n (\n idx,\n args.input_path + in_filename,\n output_path,\n args.target_width,\n args.target_height,\n args.target_fps,\n )\n for idx, in_filename in enumerate(os.listdir(args.input_path))\n if in_filename.endswith(".mp4") or in_filename.endswith(".webm")\n ]\n\n with mp.Pool(processes=mp.cpu_count()) as pool:\n pool.starmap(preprocess_video, pool_args)\n print("Done converting mp4 to npy files")\n\n print("Creating metadata file...")\n metadata = []\n filenames = [\n filename\n for filename in os.listdir(output_path)\n if filename.endswith(".npy") and filename != "metadata.npy"\n ]\n pool_args = [(filename, output_path) for filename in filenames]\n\n with mp.Pool(processes=mp.cpu_count()) as pool:\n results = list(pool.starmap(get_meta_data, pool_args))\n metadata = [{"path": path, "length": length} for path, length in results]\n np.save(output_path + "/metadata.npy", metadata)\n print(f"Saved {len(metadata)} videos to {output_path}")\n\n\nif __name__ == "__main__":\n main()\n
|
python
|
tab
|
2,361
| 2,993,350
|
utils/preprocess_video_to_npy.py
| 2,912
| 0
| null |
python
|
selection_mouse
|
2,362
| 3,022,968
|
utils/preprocess_video_to_npy.py
| 0
| 0
| null |
python
|
tab
|
2,363
| 3,050,319
|
utils/preprocess_video_to_npy.py
| 0
| 0
| null |
python
|
tab
|
2,364
| 3,074,575
|
TERMINAL
| 0
| 0
|
git commit -m 'feat: add error handling and logging to dataset preprocessing;\n^C
| null |
terminal_command
|
2,365
| 3,074,585
|
TERMINAL
| 0
| 0
|
^C[?2004l\r[?2004h[?2004l\r\r\n]633;E;;a9a4de27-e0e0-4f7a-a81f-6ae3e98df676]633;C]0;tum_ind3695@hkn1993:~/projects/jafar]633;D
| null |
terminal_output
|
2,366
| 3,076,456
|
TERMINAL
| 0
| 0
|
git commit -m 'feat: add error handling and logging to dataset preprocessing'
| null |
terminal_command
|
2,367
| 3,076,509
|
TERMINAL
| 0
| 0
|
]633;E;2025-06-25 11:08:29 git commit -m 'feat: add error handling and logging to dataset preprocessing';a9a4de27-e0e0-4f7a-a81f-6ae3e98df676]633;C
| null |
terminal_output
|
2,368
| 3,076,696
|
TERMINAL
| 0
| 0
|
g
| null |
terminal_output
|
2,369
| 3,076,770
|
TERMINAL
| 0
| 0
|
i
| null |
terminal_output
|
2,370
| 3,076,939
|
TERMINAL
| 0
| 0
|
t
| null |
terminal_output
|
2,371
| 3,077,067
|
TERMINAL
| 0
| 0
|
p
| null |
terminal_output
|
2,372
| 3,077,175
|
TERMINAL
| 0
| 0
|
u
| null |
terminal_output
|
2,373
| 3,077,309
|
TERMINAL
| 0
| 0
|
s
| null |
terminal_output
|
2,374
| 3,077,387
|
TERMINAL
| 0
| 0
|
h
| null |
terminal_output
|
2,375
| 3,079,616
|
TERMINAL
| 0
| 0
|
black....................................................................
| null |
terminal_output
|
2,376
| 3,082,804
|
utils/preprocess_video_to_npy.py
| 0
| 0
| null |
python
|
tab
|
2,377
| 3,083,293
|
TERMINAL
| 0
| 0
|
[41mFailed[m\r\n[2m- hook id: black[m\r\n[2m- files were modified by this hook[m\r\n\r\n[1mreformatted utils/preprocess_dataset.py[0m\r\n[1mreformatted utils/preprocess_video_to_npy.py[0m\r\n\r\n[1mAll done! ✨ 🍰 ✨[0m\r\n[34m[1m2 files [0m[1mreformatted[0m.\r\n\r\n]0;tum_ind3695@hkn1993:~/projects/jafar]633;D;1
| null |
terminal_output
|
2,378
| 3,085,795
|
TERMINAL
| 0
| 0
|
git pushgs^C
| null |
terminal_command
|
2,379
| 3,085,807
|
TERMINAL
| 0
| 0
|
^C[?2004l\r[?2004h[?2004l\r\r\n]633;E;;a9a4de27-e0e0-4f7a-a81f-6ae3e98df676]633;C]0;tum_ind3695@hkn1993:~/projects/jafar]633;D
| null |
terminal_output
|
2,380
| 3,086,264
|
TERMINAL
| 0
| 0
|
gs
| null |
terminal_command
|
2,381
| 3,086,293
|
TERMINAL
| 0
| 0
|
]633;E;2025-06-25 11:08:39 gs;a9a4de27-e0e0-4f7a-a81f-6ae3e98df676]633;COn branch preprocess_video\r\nYour branch is up to date with 'origin/preprocess_video'.\r\n\r\nChanges to be committed:\r\n (use "git restore --staged <file>..." to unstage)\r\n\t[32mmodified: utils/preprocess_dataset.py[m\r\n\t[32mmodified: utils/preprocess_video_to_npy.py[m\r\n\r\nChanges not staged for commit:\r\n (use "git add <file>..." to update what will be committed)\r\n (use "git restore <file>..." to discard changes in working directory)\r\n\t[31mmodified: utils/preprocess_dataset.py[m\r\n\t[31mmodified: utils/preprocess_video_to_npy.py[m\r\n\r\nUntracked files:\r\n (use "git add <file>..." to include in what will be committed)\r\n\t[31mnotes.md[m\r\n\t[31mrequirements_franz.txt[m\r\n\t[31msample_resolution_batches.py[m\r\n\t[31mshell_scripts/[m\r\n\t[31mtrain_dynamics_single_batch.py[m\r\n\t[31mtrain_lam_single_batch.py[m\r\n\t[31mtrain_lam_tf_seeding.py[m\r\n\t[31mtrain_tokenizer_logging.py[m\r\n\t[31mtrain_tokenizer_single_batch.py[m\r\n\t[31mutils/clip_checker.py[m\r\n\t[31mutils/dataloader_seeding.py[m\r\n\r\n]0;tum_ind3695@hkn1993:~/projects/jafar]633;D;0
| null |
terminal_output
|
2,382
| 3,092,633
|
utils/preprocess_dataset.py
| 0
| 0
| null |
python
|
tab
|
2,383
| 3,092,636
|
utils/preprocess_dataset.py
| 2,267
| 0
| null |
python
|
selection_command
|
2,384
| 3,094,733
|
utils/preprocess_video_to_npy.py
| 0
| 0
| null |
python
|
tab
|
2,385
| 3,094,735
|
utils/preprocess_video_to_npy.py
| 130
| 0
| null |
python
|
selection_command
|
2,386
| 3,102,392
|
TERMINAL
| 0
| 0
|
git add utils/preprocess_*
| null |
terminal_command
|
2,387
| 3,102,419
|
TERMINAL
| 0
| 0
|
]633;E;2025-06-25 11:08:55 git add utils/preprocess_*;a9a4de27-e0e0-4f7a-a81f-6ae3e98df676]633;C]0;tum_ind3695@hkn1993:~/projects/jafar]633;D;0
| null |
terminal_output
|
2,388
| 3,104,322
|
TERMINAL
| 0
| 0
|
gs
| null |
terminal_command
|
2,389
| 3,104,374
|
TERMINAL
| 0
| 0
|
]633;E;2025-06-25 11:08:57 gs;a9a4de27-e0e0-4f7a-a81f-6ae3e98df676]633;COn branch preprocess_video\r\nYour branch is up to date with 'origin/preprocess_video'.\r\n\r\nChanges to be committed:\r\n (use "git restore --staged <file>..." to unstage)\r\n\t[32mmodified: utils/preprocess_dataset.py[m\r\n\t[32mmodified: utils/preprocess_video_to_npy.py[m\r\n\r\nUntracked files:\r\n (use "git add <file>..." to include in what will be committed)\r\n\t[31mnotes.md[m\r\n\t[31mrequirements_franz.txt[m\r\n\t[31msample_resolution_batches.py[m\r\n\t[31mshell_scripts/[m\r\n\t[31mtrain_dynamics_single_batch.py[m\r\n\t[31mtrain_lam_single_batch.py[m\r\n\t[31mtrain_lam_tf_seeding.py[m\r\n\t[31mtrain_tokenizer_logging.py[m\r\n\t[31mtrain_tokenizer_single_batch.py[m\r\n\t[31mutils/clip_checker.py[m\r\n\t[31mutils/dataloader_seeding.py[m\r\n\r\n]0;tum_ind3695@hkn1993:~/projects/jafar]633;D;0
| null |
terminal_output
|
2,390
| 3,107,451
|
TERMINAL
| 0
| 0
|
git commit -m 'feat: add error handling and logging to dataset preprocessing'
| null |
terminal_command
|
2,391
| 3,107,501
|
TERMINAL
| 0
| 0
|
]633;E;2025-06-25 11:09:00 git commit -m 'feat: add error handling and logging to dataset preprocessing';a9a4de27-e0e0-4f7a-a81f-6ae3e98df676]633;C
| null |
terminal_output
|
2,392
| 3,108,178
|
TERMINAL
| 0
| 0
|
black....................................................................
| null |
terminal_output
|
2,393
| 3,108,578
|
TERMINAL
| 0
| 0
|
[42mPassed[m\r\n
| null |
terminal_output
|
2,394
| 3,108,769
|
TERMINAL
| 0
| 0
|
[preprocess_video 4dc91c0] feat: add error handling and logging to dataset preprocessing\r\n 2 files changed, 48 insertions(+), 24 deletions(-)\r\n]0;tum_ind3695@hkn1993:~/projects/jafar]633;D;0
| null |
terminal_output
|
2,395
| 3,110,105
|
TERMINAL
| 0
| 0
|
git push
| null |
terminal_command
|
2,396
| 3,110,123
|
TERMINAL
| 0
| 0
|
]633;E;2025-06-25 11:09:03 git push;a9a4de27-e0e0-4f7a-a81f-6ae3e98df676]633;C
| null |
terminal_output
|
2,397
| 3,111,427
|
TERMINAL
| 0
| 0
|
Enumerating objects: 9, done.\r\nCounting objects: 11% (1/9)\rCounting objects: 22% (2/9)\rCounting objects: 33% (3/9)\rCounting objects: 44% (4/9)\rCounting objects: 55% (5/9)\rCounting objects: 66% (6/9)\rCounting objects: 77% (7/9)\rCounting objects: 88% (8/9)\rCounting objects: 100% (9/9)\rCounting objects: 100% (9/9), done.\r\nDelta compression using up to 152 threads\r\nCompressing objects: 20% (1/5)\rCompressing objects: 40% (2/5)\rCompressing objects: 60% (3/5)\rCompressing objects: 80% (4/5)\rCompressing objects: 100% (5/5)\rCompressing objects: 100% (5/5), done.\r\nWriting objects: 20% (1/5)\rWriting objects: 40% (2/5)\rWriting objects: 60% (3/5)\rWriting objects: 80% (4/5)\rWriting objects: 100% (5/5)\rWriting objects: 100% (5/5), 1.02 KiB | 524.00 KiB/s, done.\r\nTotal 5 (delta 4), reused 0 (delta 0), pack-reused 0\r\n
| null |
terminal_output
|
2,398
| 3,111,528
|
TERMINAL
| 0
| 0
|
remote: Resolving deltas: 0% (0/4)[K\rremote: Resolving deltas: 25% (1/4)[K\rremote: Resolving deltas: 50% (2/4)[K\rremote: Resolving deltas: 75% (3/4)[K\rremote: Resolving deltas: 100% (4/4)[K\rremote: Resolving deltas: 100% (4/4), completed with 4 local objects.[K\r\n
| null |
terminal_output
|
2,399
| 3,111,716
|
TERMINAL
| 0
| 0
|
To github.com:p-doom/jafar.git\r\n 6936ce1..4dc91c0 preprocess_video -> preprocess_video\r\n]0;tum_ind3695@hkn1993:~/projects/jafar]633;D;0
| null |
terminal_output
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.