I am new to using local runtime on colab, but was able to import and run all other kernels except for the one that specifies a keras sequential model. Here's the code:
keras.backend.clear_session()
model = keras.Sequential()
I receive this message when it crashes:
Your session crashed for an unknown reason.
When I try to access runtime logs, I get the following:
Could not fetch /var/colab/app.log from backend
Could not fetch resource at : 404 Not Found
FetchError: Could not fetch resource at : 404 Not Found
at XB.$A [as constructor] (https://ssl.gstatic.com/colaboratory-static/common/0c687632c6df07e69ab0173b89376c36/external_polymer_binary.js:1408:2530)
at new XB (https://ssl.gstatic.com/colaboratory-static/common/0c687632c6df07e69ab0173b89376c36/external_polymer_binary.js:1429:190)
at xa.program_ (https://ssl.gstatic.com/colaboratory-static/common/0c687632c6df07e69ab0173b89376c36/external_polymer_binary.js:6276:129)
at za (https://ssl.gstatic.com/colaboratory-static/common/0c687632c6df07e69ab0173b89376c36/external_polymer_binary.js:20:336)
at xa.next_ (https://ssl.gstatic.com/colaboratory-static/common/0c687632c6df07e69ab0173b89376c36/external_polymer_binary.js:18:508)
at Aa.next (https://ssl.gstatic.com/colaboratory-static/common/0c687632c6df07e69ab0173b89376c36/external_polymer_binary.js:21:206)
at b (https://ssl.gstatic.com/colaboratory-static/common/0c687632c6df07e69ab0173b89376c36/external_polymer_binary.js:21:468)
I believe I haven't set up local runtime correctly, as when I switch to hosted runtime, it runs just fine. Any help would be much appreciated! I am running this on a Mac M1 Pro, Monterey 12.5.
% conda list tensorflow
#
# Name Version Build Channel
tensorflow-deps 2.9.0 0 apple
tensorflow-estimator 2.9.0 pypi_0 pypi
tensorflow-macos 2.9.0 pypi_0 pypi
tensorflow-metal 0.6.0 pypi_0 pypi
% conda list keras
#
# Name Version Build Channel
keras 2.9.0 pypi_0 pypi
keras-preprocessing 1.1.2 pypi_0 pypi
Related
I'm developing a project based on yolov7, but I started facing this error where torch recognizes my GPU but torchvision throws an Not Implemented Error.
This is the error
NotImplementedError: Could not run 'torchvision::nms' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'torchvision::nms' is only available for these backends: [CPU, QuantizedCPU, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, Tracer, AutocastCPU, AutocastCUDA, FuncTorchBatched, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PythonDispatcher].
I tried installing torchvision with cuda built-in but that gave me the same error, also tried reinstalling pytorch , that didn't work either
the version of torch vision installed in my env was not equipped with cuda as it was a common install with pip with pip install torchvision whereas for torchvision to function with cuda it has to be equipped with cuda in-order for it to function with an Nvidia GPU to do so install torch with the following command conda install pytorch torchvision torchaudio pytorch-cuda={CUDA version} -c pytorch -c nvidia
Here is the Google Colab notebook dropped on github
As explained in the notebook, my purpose is to to experiment Deeplab v2 with Caffe (not with Tensorflow -With Tensorflow lib, I've managed to run an implementation of Deeplab in Google Colab).
Python does not fetch the link to the lib. As you'll notice in notebook, instruction import caffe throws an error when executed.
I have also tried straight forward install of the package using !apt install caffe-cuda in a different notebook but this does not work and everywhere I read like here, it suggests to build Caffe from source.
OS: Ubuntu 18.04.5 LTS
Python: Python 3.7.12
Cuda: Cuda compilation tools, release 11.1, V11.1.105
openCV: 4.1.2
I have a project I'm trying to work on but it's based on code that's a few years old and for whatever reason this code tends to fail if Tensorflow or NumPy aren't the correct versions (which means everything I'm using has to be old). This has meant that I've needed to dual-install an older version of Python to then be able to install the correct versions of the dependencies.
I'm running:
Python 3.7.5
NumPy 1.17.4
Pandas 0.25.3
pyyaml 5.1.2
more_itertools 7.2.0
keras 2.3.1
tensorflow 2.0.1
CUDA 10.0
CuDNN 7.4.1
I'm particularly interested in the keras and tensorflow versions. From my research, it seems they should work with GPU (as is?) according to this:
https://www.tensorflow.org/install/source (towards the bottom under tested build configurations for GPU).
However, when I try to detect GPU devices on my build with
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
I get
2022-03-22 19:34:53.410102: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 1722158755601489749
]
Which seems like it isn't recognising my GPU.
Is there something I'm missing in the setup process that I need to enable GPU support? As far as I can tell my versions of Tensorflow and Keras are compatible with GPU processing and have compatible versions of CUDA and CuDNN installed.
Would you help me to achieve reproducible results with Tensorflow 1.15 without restarting Python kernel. And why the output results in TF 2.0 and TF 1.5 are different with absolutely identical parameters and dataset? Is it possible to achieve identical output?
More details:
I tried to interpret model results in TF 2.0 by:
import shap
background = df3.iloc[np.random.choice(df3.shape[0], 100, replace=False)]
explainer = shap.DeepExplainer(model, background)
I recieved an error:
`get_session` is not available when using TensorFlow 2.0.`get_session` is not available when using TensorFlow 2.0.
According to the SO topic, I tried to setup TF 2.0 compatibility with TF 1 by using in the front of my code:
import tensorflow.compat.v1 as tf
But the error appeared again.
Following advice by many users, I downgraded TF2 to TF 1.15 it solved the problem, and shap module interprets the results but:
1) to make results reproducible now I have to change tf.random.set_seed(7) on tf.random.set_random_seed(7) and restart the Python kernel every time! In TF2 I didn't have to restart the kernel.
2) prediction results has been changed, especially, Economical efficiency (that is, TF1.5. wrongly classifies more important samples than TF2.0).
TF 2:
Accuracy: 94.95%, Economical efficiency = 64%
TF 1:
Accuracy: 94.85%, Economical efficiency = 56%
The code of the model is here
First, results differ from each other not only in TF1 and TF2 versions, but also in TF2.0 and TF2.2 versions. Probably, it depends on diffenent internal parameters in the packages.
Second, TensorFlow2 works with DeepExplainer in the following versions:
import tensorflow
import pandas as pd
import keras
import xgboost
import numpy
import shap
print(tensorflow.__version__)
print(pd.__version__)
print(keras.__version__)
print(xgboost.__version__)
print(numpy.__version__)
print(shap.__version__)
output:
2.2.0
0.24.2
2.3.1
0.90
1.17.5
0.35.0
But you will face some difficulties in updating the libraries.
In Python 3.5, running TF2.2, you will face the error 'DLL load failed: The specified module could not be found'.
It 100% can be solved by installing newer C++ package. See this:https://github.com/tensorflow/tensorflow/issues/22794#issuecomment-573297027
Link to download the package:https://support.microsoft.com/ru-ru/help/2977003/the-latest-supported-visual-c-downloads
In Python 3.7 you will not find the shap 0.35.0 version with whl extention. Only tar.gz extension which gives the error: "Install visual c++ package". But installation doesn't help.
Then download shap 0.35.0 for Python 3.7 here: https://anaconda.org/conda-forge/shap/files. Run Anaconda shell. Type: conda install -c conda-forge C:\shap-0.35.0-py37h3bbf574_0.tar.bz2.
Nothing seems to work when I try to identify the version of an imported package:
What is creating this problem? What can I do about it?
I am using Python 3.7, Anaconda3 (2019) and Windows 10.
If I try it in notebooks.azure.com then everything works just fine:
import tensorflow
tensorflow.__version__
'1.12.2'
You can also try:
!pip show tensorflow
Name: tensorflow
Version: 1.12.2
Summary: TensorFlow is an open source machine learning framework for everyone.
/..../