text icon indicating copy to clipboard operation
text copied to clipboard

wordvec of unk token

Open ruotianluo opened this issue 8 years ago • 3 comments

https://github.com/pytorch/text/blob/master/torchtext/vocab.py#L242

When the word is in the dictionary, the returned is a one-dim vector, while unk vector is a two-dim vector.

I assume this is not expected, right?

ruotianluo avatar Apr 11 '18 02:04 ruotianluo

@jekbradbury What would be preferred out of those two? I could make a PR for this.

domaala avatar Apr 28 '18 11:04 domaala

Probably the one-dim vector. Does nothing else in the codebase currently rely on this __getitem__ method?

jekbradbury avatar Apr 30 '18 00:04 jekbradbury

@jekbradbury I've been searching through the codebase, but I wasn't able to find anything. It seems that after the vectors are finally loaded, it's up to user's model to deal with it. I'll see whether something breaks when I change this.

domaala avatar May 02 '18 08:05 domaala