Skip to content

Commit fc760d7

Browse files
committed
fix the flake8 bug
1 parent 8d0c377 commit fc760d7

File tree

4 files changed

+8
-18
lines changed

4 files changed

+8
-18
lines changed

EduNLP/I2V/i2v.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33

44
import torch
55
import json
6-
import os.path
76
from typing import List, Tuple
87
from EduNLP.constant import MODEL_DIR
98
from ..Vector import T2V, get_pretrained_t2v as get_t2v_pretrained_model
109
from ..Vector import get_pretrained_model_info, get_all_pretrained_models
1110
from longling import path_append
12-
from EduData import get_data
1311
from ..Tokenizer import Tokenizer, get_tokenizer
14-
from EduNLP.Pretrain import ElmoTokenizer, BertTokenizer, DisenQTokenizer, QuesNetTokenizer, Question
12+
from EduNLP.Pretrain import ElmoTokenizer, BertTokenizer, DisenQTokenizer, QuesNetTokenizer
1513
from EduNLP import logger
1614

1715
__all__ = ["I2V", "D2V", "W2V", "Elmo", "Bert", "DisenQ", "QuesNet", "get_pretrained_i2v"]

EduNLP/Tokenizer/tokenizer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# coding: utf-8
22
# 2021/8/1 @ tongshiwei
33

4-
from pickle import NONE
54
from typing import Iterable, Union
65
from ..SIF.segment import seg
76
from ..SIF.tokenization import tokenize

EduNLP/Vector/disenqnet/disenqnet.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def infer_tokens(self, items: dict, **kwargs) -> torch.Tensor:
4949
5050
Parameters
5151
----------
52-
items: dict, {'content_idx': tensor(),'content_len': tensor()}, the tokens about question items after tokenizer processing
52+
items: dict
53+
{'content_idx': tensor(),'content_len': tensor()}, the tokens about question after tokenizer processing
5354
5455
Returns:
5556
torch.Tensor: token embedding

EduNLP/Vector/t2v.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,13 @@ class T2V(object):
4545
4646
Examples
4747
--------
48-
>>> item = [{'ques_content':'有公式$\\FormFigureID{wrong1?}$和公式$\\FormFigureBase64{wrong2?}$,\
49-
... 如图$\\FigureID{088f15ea-8b7c-11eb-897e-b46bfc50aa29}$,若$x,y$满足约束条件$\\SIFSep$,则$z=x+7 y$的最大值为$\\SIFBlank$'}]
48+
>>> item = [{'ques_content':'有公式$\\FormFigureID{wrong1?}$和公式$\\FormFigureBase64{wrong2?}$, \
49+
... 如图$\\FigureID{088f15ea-8b7c-11eb-897e-b46bfc50aa29}$,若$x,y$满足约束条件$
50+
\\SIFSep$,则$z=x+7 y$的最大值为$\\SIFBlank$'}]
5051
>>> model_dir = "examples/test_model/d2v"
5152
>>> url, model_name, *args = get_pretrained_model_info('d2v_test_256')
5253
>>> path = get_data(url, model_dir); # doctest: +ELLIPSIS
53-
downloader, INFO http://base.ustc.edu.cn/data/model_zoo/modelhub/doc2vec_pub/1/d2v_test_256.zip is saved as examples\test_model\d2v\d2v_test_256.zip
54-
Downloading examples\test_model\d2v\d2v_test_256.zip 100.00%: 4.73MB | 4.73MB
55-
downloader, INFO examples\test_model\d2v\d2v_test_256.zip is unzip to examples\test_model\d2v\d2v_test_256
54+
downloader, INFO ...
5655
>>> path = path_append(path, os.path.basename(path) + '.bin', to_str=True)
5756
>>> t2v = T2V('d2v',filepath=path)
5857
>>> print(t2v(item))
@@ -73,24 +72,20 @@ def __call__(self, items, *args, **kwargs):
7372
def infer_vector(self, items, *args, **kwargs):
7473
"""
7574
get question embedding with T2V
76-
7775
Parameters
7876
----------
7977
items:list
80-
a list of question
81-
78+
a list of question
8279
Returns
8380
-------
8481
vector:list
8582
numpy.ndarray([dtype=float32)]
86-
8783
"""
8884
return self.i2v.infer_vector(items, *args, **kwargs)
8985

9086
def infer_tokens(self, items, *args, **kwargs):
9187
"""
9288
get token embeddings with T2V
93-
9489
NotImplemented
9590
"""
9691
return self.i2v.infer_tokens(items, *args, **kwargs)
@@ -103,7 +98,6 @@ def vector_size(self) -> int:
10398
def get_pretrained_model_info(name):
10499
"""
105100
get the pretrained model information with the given name
106-
107101
Parameters
108102
----------
109103
name:str
@@ -116,11 +110,9 @@ def get_pretrained_model_info(name):
116110
bert_taledu_768
117111
disenq_math_256
118112
quesnet_math_512
119-
120113
Returns
121114
--------
122115
list: [model url (where to download), model name]
123-
124116
"""
125117
url = MODELHUB_URL + 'getPretrainedModel'
126118
param = {'name': name}

0 commit comments

Comments
 (0)