MCPcopy
hub / github.com/stas00/ml-engineering / dump_example_shapes

Function dump_example_shapes

debug/tiny-scripts/general-pmd-ds-unpack.py:82–94  ·  view source on GitHub ↗

dump the row stats

(idx, row)

Source from the content-addressed store, hash-verified

80 fh.write(item)
81
82def dump_example_shapes(idx, row):
83 """ dump the row stats """
84 shapes = {}
85
86 img = row["image"]
87 shapes["image"] = 0 if img is None else "x".join(map(str, img.size))
88
89 for col in ['meta', 'source', 'text']:
90 item = row[col]
91 shapes[col] = 0 if item is None else len(item)
92
93 summary = ", ".join([f"{k}: {v:>9}" for k,v in shapes.items()])
94 print(f"rec{idx:>6}: {summary}")
95
96
97ids_range = list2range(args.ids)

Callers 1

Calls 1

printFunction · 0.85

Tested by

no test coverage detected