You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, Liyuan, I encountered the following problem while running train_w.py,
Traceback (most recent call last):
File "/workspace/train.py", line 117, in
shrink_to_corpus=args.shrink_embedding)
File "/workspace/models/utils.py", line 457, in load_embedding_wlm
embedding_tensor_1 = torch.FloatTensor(pretrained_weight)
TypeError: can't convert np.ndarray of type numpy.object_. The only supported types are: double, float, float16, int64, int32, and uint8.
And ,at the line 457, my coding as follows:
(1)
if not shrink_to_corpus:
pretrained_weight = np.asarray(outdoc_embedding_array)
embedding_tensor_1 = torch.from_numpy(pretrained_weight)
word_emb_len = embedding_tensor_0.size(1)
assert(word_emb_len == emb_len)
(2)
if not shrink_to_corpus:
embedding_tensor_1 = torch.Tensor(np.asarray(outdoc_embedding_array))
word_emb_len = embedding_tensor_0.size(1)
assert(word_emb_len == emb_len)
The text was updated successfully, but these errors were encountered:
I have encountered this problem before, but I just changed the embedding file.
The first line of the original embedding file shows vocab size and dimension, and the replaced file does not.
I don't know if this will help you.
Hi, Liyuan, I encountered the following problem while running train_w.py,
Traceback (most recent call last):
File "/workspace/train.py", line 117, in
shrink_to_corpus=args.shrink_embedding)
File "/workspace/models/utils.py", line 457, in load_embedding_wlm
embedding_tensor_1 = torch.FloatTensor(pretrained_weight)
TypeError: can't convert np.ndarray of type numpy.object_. The only supported types are: double, float, float16, int64, int32, and uint8.
And ,at the line 457, my coding as follows:
(1)
if not shrink_to_corpus:
pretrained_weight = np.asarray(outdoc_embedding_array)
embedding_tensor_1 = torch.from_numpy(pretrained_weight)
word_emb_len = embedding_tensor_0.size(1)
assert(word_emb_len == emb_len)
(2)
if not shrink_to_corpus:
embedding_tensor_1 = torch.Tensor(np.asarray(outdoc_embedding_array))
word_emb_len = embedding_tensor_0.size(1)
assert(word_emb_len == emb_len)
The text was updated successfully, but these errors were encountered: