google-colaboratory

AttributeError: EagerTensor object has no attribute 'astype'

AttributeError: EagerTensor object has no attribute 'astype' Question: I am trying to do a GradCAM Heatmap in Google Colab like so: import tensorflow as tf from tensorflow.keras import backend as K from tf_keras_vis.activation_maximization import ActivationMaximization from tf_keras_vis.utils.callbacks import Print def model_modifier(m): m.layers[-1].activation = tf.keras.activations.linear activation_maximization = ActivationMaximization(model, model_modifier) loss = lambda x: K.mean(x[:, 1]) activation …

Total answers: 1

How to Remove IndentationError: expected an indented block: except ValueError: in Google Colab

How to Remove IndentationError: expected an indented block: except ValueError: in Google Colab Question: Given a dataset I was asked to perform 5 machine learning models on the dataset. Here is my code: standard_scaler = StandardScaler() try: X_train=standard_scaler.fit_transform(X_train) X_test=standard_scaler.fit_transform(X_test) except ValueError: I keep getting except ValueError: ^ IndentationError: expected an indented block Can someone please …

Total answers: 1

Failure to install old versions of transformers in colab

Failure to install old versions of transformers in colab Question: I recently had a problem installing Transformer version 2.9.0 in colab. Asked By: hana || Source Answers: Colab has recently upgraded to Python 3.9. There is a temporary mechanism for users to run Python 3.8 runtime (Linux-5.10.147+-x86_64-with-glibc2.29 platform). This is available from the Command Palette …

Total answers: 2

How to assign drive links with loop in colab

How to assign drive links with loop in colab Question: I want to assign these links in a loop. But I don’t know what to use. I tried dictionary but i couldn’t do it from google.colab import drive drive.mount(‘/content/drive’) video_1 = "/content/drive/MyDrive/outputs_1" video_2 = "/content/drive/MyDrive/outputs_2" video_3 = "/content/drive/MyDrive/outputs_3" video_4 = "/content/drive/MyDrive/outputs_4" video_5 = "/content/drive/MyDrive/outputs_5" video_6 …

Total answers: 2

Read txt files in google colab using google drive

Read txt files in google colab using google drive Question: I would like to read txt files using google drive. In my google drive I have a dataset into this folder ‘/content/gdrive/My Drive/DATASETS/DOXES/*.txt’ the data looks like this 1) For some reason I cannot see in the ending of names the txt, is that a …

Total answers: 1

Can't update packages via pip in google colab

Can't update packages via pip in google colab Question: I’m trying to run a python deep learning model with google colab, and I’m still after installing tflite-model-maker and tflite-support with this codeĀ  !pip install -q tflite-model-maker !pip install -q tflite-support this error: ERROR: pip’s dependency resolver does not currently take into account all the packages …

Total answers: 1

Custom module not found error on google colab

Custom module not found error on google colab Question: I am trying to run a pytorch code in google colab. The github repository is: GitHub – BrightXiaoHan/FaceDetector: A re-implementation of mtcnn. Joint training, tutorial and deployment together. There is a custom module in google colab notebook. To build the module I have run python setup.py …

Total answers: 1

Why is the parallel version of my code slower than the serial one?

Why is the parallel version of my code slower than the serial one? Question: I am trying to run a model multiple times. As a result it is time consuming. As a solution I try to make it parallel. However, it ends up to be slower. Parallel is 40 seconds while serial is 34 seconds. …

Total answers: 1