show the actual dataset size in error message (#7557)

This commit is contained in:
chenyu
2024-11-05 09:16:30 -05:00
committed by GitHub
parent 934fb73994
commit 7581a57aac

View File

@@ -28,7 +28,7 @@ from tinygrad.helpers import dedup
def load_worlds(filter_reduce=True, filter_noimage=True, filter_novariable=True):
fn = Path(__file__).parent.parent / "datasets/sops.gz"
ast_strs = dedup(gzip.open(fn).read().decode('utf-8').strip().split("\n"))
assert len(ast_strs) > 5000, "dataset size too small"
assert len(ast_strs) > 5000, f"dataset size = {len(ast_strs)} is too small"
if filter_reduce: ast_strs = [x for x in ast_strs if "REDUCE_AXIS" in x]
if filter_noimage: ast_strs = [x for x in ast_strs if "dtypes.image" not in x]
if filter_novariable: ast_strs = [x for x in ast_strs if "Variable" not in x]