def webdataset_tars(tmp_path):
    """
    Creates tar file with webdataset data (.json, .txt and .jpg files in it)
    Returns path to a directory of tar file
    """
    data_path = tmp_path / "datacomp-sample"
    shards_path = data_path / "shards"

    fh = io.BytesIO()
    with tarfile.open(fileobj=fh, mode="w:gz") as tar:
        for idx, rec in enumerate(WDS_TAR_SHARDS):
            # json file
            data = json.dumps(rec).encode()
            info = tarfile.TarInfo(f"{idx}.json")
            info.size = len(data)
            tar.addfile(info, io.BytesIO(data))

            # image file
            data = b"123"  # some dummy data
            info = tarfile.TarInfo(f"{idx}.jpg")
            info.size = len(data)
            tar.addfile(info, io.BytesIO(data))

            # txt file
            data = rec["caption"].encode()
            info = tarfile.TarInfo(f"{idx}.txt")
            info.size = len(data)
            tar.addfile(info, io.BytesIO(data))

    shards_path.mkdir(parents=True, exist_ok=True)
    with open(shards_path / "00000000.tar", "wb") as f:
        f.write(fh.getvalue())

    return shards_path

    Creates tar file with webdataset data (.json, .txt and .jpg files in it)
    Returns path to a directory of tar file
    
tests/examples/test_wds_e2e.py