print(f"Checking {len(parquet_files)} parquet files...") for file insorted(parquet_files): try: # read_table forces PyArrow to read and decompress all row groups pq.read_table(file) print(f"β OK: {file.split('/')[-1]}") except Exception as e: print(f"β CORRUPT: {file.split('/')[-1]}") print(f" Error: {e}") corrupt_files.append(file)
print("-" * 40) if corrupt_files: print(f"π¨ Found {len(corrupt_files)} corrupt file(s). Please redownload:") for f in corrupt_files: print(f" - {f}") sys.exit(1) else: print("β All parquet files are healthy!")
defcheck_safetensors_basic(path): print(f"Checking {path}...") try: # Opening it forces the safetensors library to parse the JSON header # and validate the byte offsets of the tensors. with safe_open(path, framework="pt") as f: keys = list(f.keys()) print(f"β safetensors file structure is healthy.") print(f"β Found {len(keys)} tensors.") returnTrue except Exception as e: print("β safetensors file is corrupted or incomplete.") print("Error details:", e) returnFalse