TypeError: 'module' object is not subscriptable

how to fix this issues?


swers to questions.

this is my code


You haven’t called the hub module correctly.

From their tutorial:

!pip install --upgrade tensorflow_hub

  import tensorflow_hub as hub

  model = hub.KerasLayer("https://tfhub.dev/google/nnlm-en-dim128/2")
  embeddings = model(["The rain in Spain.", "falls",
                      "mainly", "In the plain!"])

  print(embeddings.shape)  #(4,128)

‘hub’ doesn’t take a subscription.

1 Like