Giter Site home page Giter Site logo

Comments (2)

aaarrti avatar aaarrti commented on June 6, 2024 1

Afaik, colab TPUs are using TPU-node architecture, which means they are running on a different host, than the VM, which serves colab runtime, so TPU can't read the local file-system of colab VM (seems logical). One workaround you can do is:

  • create google cloud project
  • Add this one top of your notebook
!gcloud auth login
!gcloud config set project [PROJECT-id]

from google.colab import auth
auth.authenticate_user()
  • Create GCS bucket
resource "google_storage_bucket" "data_bucket" {
  name                        = var.bucket-name
  location                    = var.region
  storage_class               = "STANDARD"
  uniform_bucket_level_access = true
  force_destroy               = true
}
  • Then you initialize TPU cluster following way
tf.distribute.cluster_resolver.TPUClusterResolver(tpu='grpc://' + os.environ['COLAB_TPU_ADDR'])
  • At this point, you can try to load dataset from your bucket, and you will get a similar error
{
  "code": 403,
  "message": "service-<id>@cloud-tpu.iam.gserviceaccount.com does not have storage.objects.list access to the Google Cloud Storage bucket. Permission 'storage.objects.list' denied on resource (or it may not exist).",
}
  • Then you go, and add IAM role bindings for TPUs service account
resource "google_storage_bucket_iam_member" "TPU_ROLE_1" {
  bucket     = var.bucket-name
  role       = "roles/storage.objectViewer"
  member     = var.tpu_sa
  depends_on = [google_storage_bucket.data_bucket]
}

resource "google_storage_bucket_iam_member" "TPU_ROLE_2" {
  bucket     = var.bucket-name
  role       = "roles/storage.legacyBucketReader"
  member     = var.tpu_sa
  depends_on = [google_storage_bucket.data_bucket]
}

resource "google_storage_bucket_iam_member" "TPU_ROLE_3" {
  bucket     = var.bucket-name
  role       = "roles/storage.objectCreator"
  member     = var.tpu_sa
  depends_on = [google_storage_bucket.data_bucket]
}

resource "google_storage_bucket_iam_member" "TPU_ROLE_4" {
  bucket     = var.bucket-name
  role       = "roles/storage.legacyBucketWriter"
  member     = var.tpu_sa
  depends_on = [google_storage_bucket.data_bucket]
}

where var.tpu_sa is "serviceAccount:service-<id>@cloud-tpu.iam.gserviceaccount.com"

  • Then finally, your colab TPU should be able to access GCS bucket.

Alternatively, you could use Kaggle Notebooks, since they provide TPU VMs, so you can read the local file-system when running those.

To sum up, this is not a keras-tuner bug 🙈 , but rather an environment misconfiguration.

from keras-tuner.

h4ck4l1 avatar h4ck4l1 commented on June 6, 2024

Thank you very much for clarifying. I didnt say this was a bug, initially i wrote it on discussion forum as i couldn't figure out why this was happening and i thought i was doing some mistake. but seeing the replies in discussion were way too slow i had to raise issue.
Again thanks for clarifying, i thought i could find other routes than creating a bucket. yea i will try and get back if i get any error

from keras-tuner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.