Browse Source

update travis

tags/v0.6.0
yh_cc 4 years ago
parent
commit
ba2304556c
2 changed files with 6 additions and 0 deletions
  1. +4
    -0
      .travis.yml
  2. +2
    -0
      fastNLP/embeddings/static_embedding.py

+ 4
- 0
.travis.yml View File

@@ -1,6 +1,10 @@
language: python language: python
python: python:
- "3.6" - "3.6"

env:
- TRAVIS=1

# command to install dependencies # command to install dependencies
install: install:
- pip install --quiet -r requirements.txt - pip install --quiet -r requirements.txt


+ 2
- 0
fastNLP/embeddings/static_embedding.py View File

@@ -280,6 +280,8 @@ class StaticEmbedding(TokenEmbedding):
found_unknown = True found_unknown = True
if word in vocab: if word in vocab:
index = vocab.to_index(word) 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)) matrix[index] = torch.from_numpy(np.fromstring(' '.join(nums), sep=' ', dtype=dtype, count=dim))
if self.only_norm_found_vector: if self.only_norm_found_vector:
matrix[index] = matrix[index] / np.linalg.norm(matrix[index]) matrix[index] = matrix[index] / np.linalg.norm(matrix[index])


Loading…
Cancel
Save