xei / recommender-system-tutorial

A step-by-step tutorial on developing a practical recommendation system (retrieval and ranking) using TensorFlow Recommenders and Keras.
MIT License
174 stars 41 forks source link

AttributeError: module 'tensorflow.compat.v2.tpu.experimental' has no attribute 'HardwareFeature' #4

Open Qoyyuum opened 2 years ago

Qoyyuum commented 2 years ago

I tried running this in Google Colab but it had an AttributeError.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-11-cb7752efeee8>](https://localhost:8080/#) in <module>()
      3 # We will describe ScaNN in future but it has to be installed before importing
      4 # the TFRS
----> 5 import tensorflow_recommenders as tfrs
      6 
      7 factorized_top_k_metrics = tfrs.metrics.FactorizedTopK(

7 frames
[/usr/local/lib/python3.7/dist-packages/tensorflow_recommenders/__init__.py](https://localhost:8080/#) in <module>()
     25 
     26 from tensorflow_recommenders import examples
---> 27 from tensorflow_recommenders import experimental
     28 # Internal extension library import.
     29 from tensorflow_recommenders import layers

[/usr/local/lib/python3.7/dist-packages/tensorflow_recommenders/experimental/__init__.py](https://localhost:8080/#) in <module>()
     15 """Experimental APIs."""
     16 
---> 17 from tensorflow_recommenders.experimental import layers
     18 from tensorflow_recommenders.experimental import models
     19 from tensorflow_recommenders.experimental import optimizers

[/usr/local/lib/python3.7/dist-packages/tensorflow_recommenders/experimental/layers/__init__.py](https://localhost:8080/#) in <module>()
     15 """Experimental layers APIs."""
     16 
---> 17 from tensorflow_recommenders.experimental.layers import embedding

[/usr/local/lib/python3.7/dist-packages/tensorflow_recommenders/experimental/layers/embedding/__init__.py](https://localhost:8080/#) in <module>()
     15 """Experimental embedding layers."""
     16 
---> 17 from tensorflow_recommenders.experimental.layers.embedding.partial_tpu_embedding import PartialTPUEmbedding

[/usr/local/lib/python3.7/dist-packages/tensorflow_recommenders/experimental/layers/embedding/partial_tpu_embedding.py](https://localhost:8080/#) in <module>()
     19 import tensorflow as tf
     20 
---> 21 from tensorflow_recommenders.layers.embedding.tpu_embedding_layer import TPUEmbedding
     22 
     23 Tensor = Union[tf.Tensor, tf.SparseTensor, tf.RaggedTensor]

[/usr/local/lib/python3.7/dist-packages/tensorflow_recommenders/layers/__init__.py](https://localhost:8080/#) in <module>()
     17 
     18 from tensorflow_recommenders.layers import blocks
---> 19 from tensorflow_recommenders.layers import embedding
     20 from tensorflow_recommenders.layers import factorized_top_k
     21 from tensorflow_recommenders.layers import feature_interaction

[/usr/local/lib/python3.7/dist-packages/tensorflow_recommenders/layers/embedding/__init__.py](https://localhost:8080/#) in <module>()
     15 """Embedding layers."""
     16 
---> 17 from tensorflow_recommenders.layers.embedding.tpu_embedding_layer import TPUEmbedding

[/usr/local/lib/python3.7/dist-packages/tensorflow_recommenders/layers/embedding/tpu_embedding_layer.py](https://localhost:8080/#) in <module>()
     54 _DUMMY_NAME = "tpu_embedding_helper_dummy"
     55 
---> 56 _EMBEDDING_V2 = tf.tpu.experimental.HardwareFeature.EmbeddingFeature.V2
     57 _EMBEDDING_V1 = tf.tpu.experimental.HardwareFeature.EmbeddingFeature.V1
     58 _EMBEDDING_UNSUPPORTED = tf.tpu.experimental.HardwareFeature.EmbeddingFeature.UNSUPPORTED

AttributeError: module 'tensorflow.compat.v2.tpu.experimental' has no attribute 'HardwareFeature'