from google.colab import auth

auth.authenticate_user()TARGET_ROOT_DIR = "cifar10"
TARGET_TRAIN_DIR = TARGET_ROOT_DIR + "/span-1/train"
TARGET_TEST_DIR = TARGET_ROOT_DIR + "/span-1/test"

!mkdir -p {TARGET_TRAIN_DIR}
!mkdir -p {TARGET_TEST_DIR}import tensorflow_datasets as tfds

# Generate TFRecords with TFDS
builder = tfds.builder("cifar10")
builder.download_and_prepare()#@title GCS
#@markdown You should change these values as per your preferences. The copy operation can take ~5 minutes. 
BUCKET_PATH = "gs://cifar10-csp-public2" #@param {type:"string"}
REGION = "us-central1" #@param {type:"string"}

!gsutil mb -l {REGION} {BUCKET_PATH}
!gsutil -m cp -r {TARGET_ROOT_DIR}/* {BUCKET_PATH}from tfx import v1 as tfx
from tfx.components.example_gen import utilsfrom tfx.proto import example_gen_pb2

_DATA_PATH = "gs://cifar10-csp-public"

splits = [
    example_gen_pb2.Input.Split(name="train", pattern="span-{SPAN}/train/*"),
    example_gen_pb2.Input.Split(name="val", pattern="span-{SPAN}/test/*"),
]

_, span, version = utils.calculate_splits_fingerprint_span_and_version(
    _DATA_PATH, splits
)span, version