From ba2304556c2d1fbd9b742b78c43da7665354e68b Mon Sep 17 00:00:00 2001 From: yh_cc Date: Mon, 12 Oct 2020 13:56:58 +0800 Subject: [PATCH] update travis --- .travis.yml | 4 ++++ fastNLP/embeddings/static_embedding.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0ba0af5a..85bac41e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,10 @@ language: python python: - "3.6" + +env: + - TRAVIS=1 + # command to install dependencies install: - pip install --quiet -r requirements.txt diff --git a/fastNLP/embeddings/static_embedding.py b/fastNLP/embeddings/static_embedding.py index cdea7cfb..5f0e8eb0 100644 --- a/fastNLP/embeddings/static_embedding.py +++ b/fastNLP/embeddings/static_embedding.py @@ -280,6 +280,8 @@ class StaticEmbedding(TokenEmbedding): found_unknown = True if word in vocab: index = vocab.to_index(word) + if index in matrix: + warnings.warn(f"Word:{word} occurs again in line:{idx}(starts from 0)") matrix[index] = torch.from_numpy(np.fromstring(' '.join(nums), sep=' ', dtype=dtype, count=dim)) if self.only_norm_found_vector: matrix[index] = matrix[index] / np.linalg.norm(matrix[index])