Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.

Commit a2bdd5f

Browse files
committed
Fix lint
1 parent 2ca1538 commit a2bdd5f

5 files changed

Lines changed: 6 additions & 10 deletions

File tree

gluonnlp/data/candidate_sampler.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@
2424
import numpy as np
2525

2626
try:
27-
from numba import njit, prange
27+
from numba import njit
2828
numba_njit = njit(nogil=True)
2929
except ImportError:
30-
# Define numba shims
31-
prange = range
3230

3331
def numba_njit(func):
3432
return func

scripts/word_embeddings/train_fasttext.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# specific language governing permissions and limitations
1818
# under the License.
1919

20-
# pylint: disable=global-variable-undefined
20+
# pylint: disable=global-variable-undefined,wrong-import-position
2121
"""Fasttext embedding model
2222
===========================
2323
@@ -330,7 +330,7 @@ def train(args):
330330
if args.no_deduplicate_words:
331331
subwords, subwords_mask = \
332332
indices_to_subwordindices_mask(word_context,
333-
idx_to_subwordidxs)
333+
idx_to_subwordidxs)
334334
else:
335335
unique, inverse_unique_indices = np.unique(
336336
word_context.asnumpy(), return_inverse=True)
@@ -460,8 +460,7 @@ def train(args):
460460
mx.nd.waitall()
461461
with print_time('evaluate'):
462462
evaluate(args, embedding, vocab, num_update,
463-
eval_analogy=(epoch == args.epochs - 1
464-
and not args.no_eval_analogy))
463+
eval_analogy=not args.no_eval_analogy)
465464

466465
# Save params
467466
with print_time('save parameters'):

scripts/word_embeddings/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import random
2828

2929
import mxnet as mx
30-
import numpy as np
3130

3231
try:
3332
from numba import njit

tests/unittest/test_sampler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ def test_context_sampler():
7373

7474
center, context, mask = next(iter(sampler))
7575

76-
assert center.asnumpy().tolist() == [0, 1]
76+
assert center.asnumpy().tolist() == [[0, 1]]
7777
assert context.asnumpy().tolist() == [[1, 0], [0, 2]]
7878
assert mask.asnumpy().tolist() == [[1, 0], [1, 1]]

tests/unittest/test_vocab_embed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,5 +952,5 @@ def test_subword_function_ngramhashes():
952952

953953
assert [8.0, 195.0, 271.0, 500.0, 201.0, 445.0, 379.0, 831.0, 617.0, 851.0] == \
954954
sf([u'test'])[0].asnumpy().tolist()
955-
assert [253.0, 801.0, 557.0, 966.0, 63.0, 874.0, 313.0, 188.0, 588.0, 86.0] == \
955+
assert [429.0, 793.0, 101.0, 334.0, 295.0, 474.0, 145.0, 524.0, 388.0, 790.0] == \
956956
sf([u'τεστ'])[0].asnumpy().tolist()

0 commit comments

Comments
 (0)