maoli
maoli

Reputation: 1

ResourceExhaustedError: OOM when allocating tensor with shape[973771,128] and type float on /job:localhost/replica:0/task:0/

https://tensorflow.google.cn/hub/tf2_saved_model

import tensorflow as tf
import tensorflow_hub as hub
hub_url = "https://hub.tensorflow.google.cn/google/tf2-preview/nnlm-en-dim128/1"
embed = hub.KerasLayer(hub_url)
embeddings = embed(["A long sentence.", "single-word", "http://example.com"])
print(embeddings.shape, embeddings.dtype)

ResourceExhaustedError: OOM when allocating tensor with shape[973771,128] and type float on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu [Op:RestoreV2]

Please tell me how to solve, Thanks

Upvotes: 0

Views: 1878

Answers (1)

arnoegw
arnoegw

Reputation: 1238

Looks like you are out of memory when trying to allocate the embedding matrix of the NNLM module. It needs almost 476 MB of RAM.

Upvotes: 1

Related Questions