LM-LSTM-CRF
LM-LSTM-CRF copied to clipboard
train_w.py Error, TypeError: can't convert np.ndarray of type numpy.object_
Hi, Liyuan, I encountered the following problem while running train_w.py,
Traceback (most recent call last):
File "/workspace/train.py", line 117, in
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)
Have you solved this problem.
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.