'fashion_mnist' failed to load on TPU (try_gcs=True not working)!
Hi @MegaCreater 

Based on the error message you provided earlier, it seems that the issue is not related to the specific dataset being used (MNIST vs Fashion MNIST), but rather with how the data is being accessed from the TPU. The error message “File system scheme ‘[local]’ not implemented” suggests that the code is trying to access a local file system, but this is not supported by the TPU.

TPUs are designed to work with cloud storage services such as Google Cloud Storage (GCS), and cannot directly access data stored on the local file system of the machine running the code. "If you are using TPU Nodes, you need to store all data files read by the TensorFlow Dataset in Google Cloud Storage (GCS) buckets. If you are using TPU VMs, you can store data wherever you like. For more information on TPU Nodes and TPU VMs, refer to the TPU System Architecture documentation."

You can create a TPU VM, but it is not for free. You can use it by following this tutorial: “https://colab.research.google.com/github/tensorflow/tpu/blob/master/models/experimental/mnist_jupyter/Cloud-TPU-Demo.ipynb”. If you try changing the runtime to GPU, it should work correctly.
One other approach you can try is to access data stored in a Google Cloud Storage bucket using Colab. Here is a link :"https://colab.research.google.com/github/tensorflow/tpu/blob/master/tools/colab/keras_mnist_tpu.ipynb" @MegaCreater,
It looks like model_dir is set to a local directory in /tmp/, can you double check to make sure that it is a path to a GCS bucket?
It could be possible that it's creating a directory within data_dir which is a GCS path. Both data_dir and model_dir should be set to GCS buckets.
 
You would need to have your data stored inside a GCS bucket and the Cloud TPUs should have access to that. Also  can you simply look up the IP address of your VM (something like **!curl ifconfig.me** in your Colab cell) and then look up which geolocation that IP belongs to. @medmabcf it's dataset related only .... 
```python3
# this works fine (NO ERROR)
(ds_train, ds_test), ds_info = tfds.load('mnist', split=['train', 'test'], shuffle_files=True, as_supervised=True, with_info=True, try_gcs = True)
```
```python3 
# This create error ! (ERROR)
(ds_train, ds_test), ds_info = tfds.load('fashion_mnist', split=['train', 'test'], shuffle_files=True, as_supervised=True, with_info=True,try_gcs = True)
```
"https://colab.research.google.com/github/tensorflow/tpu/blob/master/tools/colab/keras_mnist_tpu.ipynb" this example is not useful because my code works fine on 'minst' dataset.  @tilakrayal are you talking about something like this ? 

```python3
import tensorflow as tf
import tensorflow_datasets as tfds
# Set TPU address (if using Google Cloud TPU)
tpu_address = 'grpc://<tpu-ip-address>'
tpu_resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu=tpu_address)
tf.config.experimental_connect_to_cluster(tpu_resolver)
tf.tpu.experimental.initialize_tpu_system(tpu_resolver)
data_dir = 'gs://your-bucket/data'  # GCS bucket path for data
model_dir = 'gs://your-bucket/model'  # GCS bucket path for model
builder = tfds.builder('your_dataset_name', data_dir=data_dir)
builder.download_and_prepare()

# Define the training and validation datasets
train_dataset = builder.as_dataset(split='train', shuffle_files=True)
val_dataset = builder.as_dataset(split='validation', shuffle_files=True)

# Enable batching and shuffling
train_dataset = train_dataset.shuffle(1024).batch(batch_size)
val_dataset = val_dataset.batch(batch_size)
strategy = tf.distribute.experimental.TPUStrategy(tpu_resolver)
with strategy.scope():
    # Define and compile your model
    model = ...
    model.compile(...)
callbacks = [
    tf.keras.callbacks.ModelCheckpoint(
        filepath=model_dir,  # Save the model to the GCS bucket
        save_best_only=True,
        save_weights_only=True
    ),
    # Other callbacks...
]

# Train the model
model.fit(train_dataset, validation_data=val_dataset, callbacks=callbacks, ...)
```
How can I access  "gs://your-bucket/data" ? I mean how can I get my bucket address ? (what will be the "gs://your-bucket/" ?) @MegaCreater ,
You can access a bucket in the Cloud Dataprep UI by manually entering the Google Cloud Storage path. 
https://cloud.google.com/storage/docs/access-public-data
https://cloud.google.com/storage/docs/cloud-console

Thank you! @tilakrayal its not working. I don't have cloud storage. And cloud bucket. I don't have any paid or pro access to google cloud. I am not using any cloud VM. I am using google colab TPU. So, how can I do all things in colab TPU environment?  Hi @MegaCreater 

The very first answer mentions that the error is due to TPUs being able to pull data only from GCS. 

Indeed `mnist` dataset exists in `gs://tfds-data/datasets/mnist/` and hence everything works, but `fashion_mnist` is unfortunately not available through public TFDS GCS. You should create your own GCS bucket and store `fashion_mnist` there and then pull it using `tfds.load(data_dir=<your GCS bucket>)`.  @fineguy I am using **colab (Colab's TPU)**. Can I use Google drive as cloud space ?  @MegaCreater , Yes you can mount your Google Drive and import the data.

```
from google.colab import drive
drive.mount('/content/drive')
```

```
from tensorflow import keras
import os

# Path to the MNIST dataset folder in your Google Drive
mnist_path = '/content/drive/MyDrive/MNIST/'
``` This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60788">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60788">No</a>

I am trying to replicate TensorFlow `autoencoder` (Source: [Second example: Image denoising](https://www.tensorflow.org/tutorials/generative/autoencoder#second_example_image_denoising))  image cleaning example on TPU (in google colab). 

Code : 
```python3
import tensorflow as tf
import tensorflow.keras as keras
import tensorflow_datasets as tfds
from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, UpSampling2D
from tensorflow.keras.models import Model

tfds.disable_progress_bar()                                                     # disables Tqdm progress bar

# Connect to TPU
resolver = tf.distribute.cluster_resolver.TPUClusterResolver()
tf.config.experimental_connect_to_cluster(resolver)
tf.tpu.experimental.initialize_tpu_system(resolver)
strategy = tf.distribute.TPUStrategy(resolver)

# Define the autoencoder model
def build_autoencoder():
    input_img = Input(shape=(28, 28, 1))
    x = Conv2D(16, (3, 3), activation='relu', padding='same')(input_img)
    x = MaxPooling2D((2, 2), padding='same')(x)
    x = Conv2D(8, (3, 3), activation='relu', padding='same')(x)
    x = MaxPooling2D((2, 2), padding='same')(x)
    x = Conv2D(8, (3, 3), activation='relu', padding='same')(x)
    encoded = MaxPooling2D((2, 2), padding='same')(x)

    x = Conv2D(8, (3, 3), activation='relu', padding='same')(encoded)
    x = UpSampling2D((2, 2))(x)
    x = Conv2D(8, (3, 3), activation='relu', padding='same')(x)
    x = UpSampling2D((2, 2))(x)
    x = Conv2D(16, (3, 3), activation='relu')(x)
    x = UpSampling2D((2, 2))(x)
    decoded = Conv2D(1, (3, 3), activation='sigmoid', padding='same')(x)

    autoencoder = Model(input_img, decoded)
    autoencoder.compile(optimizer='adam', loss='binary_crossentropy')
    return autoencoder

# Load MNIST dataset
(ds_train, ds_test), ds_info = tfds.load('fashion_mnist', split=['train', 'test'], shuffle_files=True, as_supervised=True, with_info=True,
                                         try_gcs = True)

# This works fine !!!!!!!!!!!!!!!!!!!!!!!!! (Mean no error in code !)
#(ds_train, ds_test), ds_info = tfds.load('mnist', split=['train', 'test'], shuffle_files=True, as_supervised=True, with_info=True,
#                                         try_gcs = True)


# Define input preprocessing function
def preprocess_input(image, label,labels:tf.Tensor=None,noise_mean:float=0.0,noise_stddev:float=0.05):
    image = tf.cast(image, tf.float32) / 255.0
    image = tf.image.resize(image, (28, 28))  # Resize images to (28, 28)
    #image_noise =  tf.add(image,tf.random.normal(image.shape,mean=noise_mean,stddev=noise_stddev))
    #image_noise = tf.clip_by_value(image_noise,tf.reduce_min(image),tf.reduce_max(image))
    return image, image #image_noise

# Preprocess and batch the dataset
AUTOTUNE = tf.data.AUTOTUNE
BATCH_SIZE = 128 * strategy.num_replicas_in_sync

ds_train = ds_train.map(preprocess_input, num_parallel_calls=AUTOTUNE)
ds_train = ds_train.cache()
ds_train = ds_train.batch(BATCH_SIZE)
ds_train = ds_train.prefetch(AUTOTUNE)

ds_test = ds_test.map(preprocess_input, num_parallel_calls=AUTOTUNE)
ds_test = ds_test.cache()
ds_test = ds_test.batch(BATCH_SIZE)
ds_test = ds_test.prefetch(AUTOTUNE)

# Create a TPU model
with strategy.scope():
    autoencoder = build_autoencoder()

# Train the model
autoencoder.fit(ds_train,epochs=10,validation_data=ds_test)
``` 

Error 
```bash
UnimplementedError: 9 root error(s) found.
  (0) UNIMPLEMENTED: {{function_node __inference_train_function_145566}} File system scheme '[local]' not implemented (file: '/bufferedio/root/tensorflow_datasets/fashion_mnist/3.0.1/fashion_mnist-train.tfrecord-00000-of-00001')
	 [[{{node MultiDeviceIteratorGetNextFromShard}}]]
	 [[RemoteCall]]
	 [[IteratorGetNextAsOptional_7]]
  (1) UNIMPLEMENTED: {{function_node __inference_train_function_145566}} File system scheme '[local]' not implemented (file: '/bufferedio/root/tensorflow_datasets/fashion_mnist/3.0.1/fashion_mnist-train.tfrecord-00000-of-00001')
	 [[{{node MultiDeviceIteratorGetNextFromShard}}]]
	 [[RemoteCall]]
	 [[IteratorGetNextAsOptional_2]]
  (2) UNIMPLEMENTED: {{function_node __inference_train_function_145566}} File system scheme '[local]' not implemented (file: '/bufferedio/root/tensorflow_datasets/fashion_mnist/3.0.1/fashion_mnist-train.tfrecord-00000-of-00001')
	 [[{{node MultiDeviceIteratorGetNextFromShard}}]]
	 [[RemoteCall]]
	 [[IteratorGetNextAsOptional_1]]
  (3) UNIMPLEMENTED: {{function_node __inference_train_function_145566}} File system scheme '[local]' not implemented (file: '/bufferedio/root/tensorflow_datasets/fashion_mnist/3.0.1/fashion_mnist-train.tfrecord-00000-of-00001')
	 [[{{node MultiDeviceIteratorGetNextFromShard}}]]
	 [[RemoteCall]]
	 [[IteratorGetNextAsOptional]]
	 [[strided_slice_39/_314]]
  (4) UNIMPLEMENTED: {{function_node __inference_train_function_145566}} File system scheme '[local]' not implemented (file: '/bufferedio/root/tensorflow_datasets/fashion_mnist/3.0.1/fashion_mnist-train.tfrecord-00000-of-00001')
	 [[{{node MultiDeviceIteratorGetNextFromShard}}]]
	 [[RemoteCall]]
	 [[IteratorGetNextAsOptional]]
	 [[strided_slice_30/_296]]
  (5) UNIMPLEMENTED: {{function_node __inference_train_function_145566}} File system scheme '[local]' not implemented (file: '/bufferedio/root/tensorflow_datasets/fashion_mnist/3.0.1/fashion_mnist-train.tfrecord-00000-of-00001')
	 [[{{node MultiDeviceIteratorGetNextFromShard}}]]
	 [[RemoteCall]]
	 [[IteratorGetNextAsOptional]]
	 [[strided_slice_21/_266]]
  (6) UNIMPLEMENTED: {{function_node __inference_train_function_145566}} File system scheme '[local]' not implemented (file: '/bufferedio/root/tensorflow_datasets/fashion_mnist/3.0.1/fashion_mnist-train.tfrecord-00000-of-00001')
	 [[{{node MultiDeviceIteratorGetNextFromShard}}]]
	 [[RemoteCall]]
	 [[IteratorGetNextAsOptional]]
	 [[cond/then/_0/cond/cond_1/output/_121/_182]]
  (7) UNIMPLEMENTED: {{function_node __inference_train_function_145566}} File system scheme '[local]' not implemented (file: '/bufferedio/root/tensorflow_datasets/fashion_mnist/3.0.1/fashion_mnist-train.tfrecord-00000-of-00001')
	 [[{{node MultiDeviceIteratorGetNextFromShard}}]]
	 [[RemoteCall]]
	 [[IteratorGetNextAsOptional]]
	 [[Greater/_26]]
  (8) UNIMPLEMENTED: {{function_node __inference_train_function_145566}} File system scheme '[local]' not implemented (file: '/bufferedio/root/tensorflow_datasets/fashion_mnist/3.0.1/fashion_mnist-train.tfrecord-00000-of-00001')
	 [[{{node MultiDeviceIteratorGe ... [truncated]
```

This code works fine with MNIST dataset but shows following error on Fashion MNIST. I think this might be the problem with `try_gcs` argument in tensorflow_datasets.load . 