Closed pranavchat14 closed 3 years ago
Yes, the intention is for this package to work with the latest available version of TensorFlow. Could you provide the following?
The dependencies for this package are specified using pyproject.toml, which would make a requirements.txt
superfluous. TensorFlow is not specified there in order to allow people to install their preferred flavor of the package (e.g., some people still use tensorflow-gpu
or build from source).
I am using Google Colab. I am doing exactly like instructed in README.md.
I have installed vit-keras using pip. Then I go with this example code:
image_size = 224 model = vit.vit_l32( image_size=image_size, activation='sigmoid', pretrained=True, include_top=True, pretrained_top=False, classes=200 )
The details are as follows:
The version of TensorFlow that didn't work: tensorflow==2.4.1
The error message: Below
NotFoundError Traceback (most recent call last)
Ah, you've run into a compatibility problem between tensorflow_addons
and tensorflow
. Unfortunately, users have to manage the version compatibility for these two packages manually. See the tensorflow_addons
README for more information on why that's the case. Unfortunately, it's not something that vit-keras
can handle automatically.
Because Google Colab periodically updates the version of TensorFlow that ships, it's also not easy to just set a version of tensorflow_addons
to fix it. For that reason, I suggest setting a fixed version for both tensorflow
and tensorflow_addons
at the top of your notebook.
As an example, if you want to use tensorflow==2.4.1
, you can look it up on the tensorflow_addons
compatibility chart and see that it requires tensorflow_addons==0.12.1
. And so the following would work in a Google Colab notebook.
!pip install -q vit-keras tensorflow==2.4.1 tensorflow_addons==0.12.1
import vit_keras.vit as vit
image_size = 224
model = vit.vit_l32(
image_size=image_size,
activation='sigmoid',
pretrained=True,
include_top=True,
pretrained_top=False,
classes=200
)
Closing this for now but let me know if this doesn't solve your problem.
I was facing an error in loading the model. Resolved by downgrading Tensorflow version to 2.1.0. Upgrading this repo to latest version of Tensorflow would simply things a little more. Thanks for the implementation.