print head for txt files and shuffle when sample (#603)

This commit is contained in:
Tim
2025-02-17 18:44:26 +08:00
committed by GitHub
parent d9576706cd
commit 73cfa26d33
2 changed files with 3 additions and 1 deletions
@@ -4,6 +4,7 @@ import shutil
from collections import Counter, defaultdict
from pathlib import Path
import numpy as np
import pandas as pd
from tqdm import tqdm
@@ -287,6 +288,7 @@ def create_debug_data(
# Use a greedy strategy to select groups so that the total number of files is as close as possible to num_to_keep
total_files = 0
np.random.shuffle(not_used_files)
for nf in not_used_files:
if total_files > num_to_keep:
break
@@ -179,7 +179,7 @@ def describe_data_folder(folder_path, indent=0, max_files=2, partial_expand_subf
# Print the folder and its contents
for file_type, count in files_count.items():
if count > max_files and file_type not in ["csv", "md"]:
if count > max_files and file_type not in ["csv", "md", "txt"]:
result.append(" " * indent + f"{count} {file_type}s:")
for file, size, path in files_details[file_type]:
result.append(" " * (indent + 2) + f"- {file} ({size} bytes)")