I am trying to load swin transformer from tfhub as follows but on loading the model I get an error.
def load_model(): model_url = "https://tfhub.dev/google/swin_transformer/base_patch4_window7_224/1"
model = hub.KerasLayer(model_url, input_shape=(224, 224, 3)) return model
model = load_model()
Error I get is:
ReadError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/tensorflow_hub/resolver.py in download_and_uncompress(self, fileobj, dst_path) 191 try: --> 192 file_utils.extract_tarfile_to_destination( 193 fileobj, dst_path, log_function=self._log_progress)
12 frames
ReadError: invalid header
During handling of the above exception, another exception occurred:
OSError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/tensorflow_hub/resolver.py in download_and_uncompress(self, fileobj, dst_path) 198 flush=True) 199 except tarfile.ReadError: --> 200 raise IOError("%s does not appear to be a valid module." % self._url) 201 202
OSError: https://tfhub.dev/google/swin_transformer/base_patch4_window7_224/1 does not appear to be a valid module.