From 94eeaffbf4f28c98998c9a87b715bc03b27de47f Mon Sep 17 00:00:00 2001 From: chenxujun Date: Mon, 10 Apr 2023 10:16:59 +0800 Subject: [PATCH] Fix some words (#261) --- modelscope/cli/download.py | 2 +- modelscope/cli/modelcard.py | 2 +- modelscope/cli/pipeline.py | 2 +- modelscope/cli/plugins.py | 2 +- modelscope/cli/template/template.tpl | 4 ++-- .../nlp/model_for_token_classification_exporter.py | 2 +- modelscope/models/audio/kws/farfield/fsmn_sele_v2.py | 2 +- modelscope/models/audio/kws/nearfield/fsmn.py | 2 +- modelscope/models/audio/kws/nearfield/model.py | 8 ++++---- .../temporal_patch_shift_transformer.py | 2 +- .../body_3d_keypoints/cannonical_pose/body_3d_pose.py | 2 +- .../cv/body_3d_keypoints/hdformer/directed_graph.py | 10 +++++----- modelscope/models/cv/cartoon/facelib/facer.py | 11 +++++------ 13 files changed, 25 insertions(+), 26 deletions(-) diff --git a/modelscope/cli/download.py b/modelscope/cli/download.py index 7ad63615..e6d316a2 100644 --- a/modelscope/cli/download.py +++ b/modelscope/cli/download.py @@ -7,7 +7,7 @@ from modelscope.hub.snapshot_download import snapshot_download def subparser_func(args): - """ Fuction which will be called for a specific sub parser. + """ Function which will be called for a specific sub parser. """ return DownloadCMD(args) diff --git a/modelscope/cli/modelcard.py b/modelscope/cli/modelcard.py index 72372894..6c28d2de 100644 --- a/modelscope/cli/modelcard.py +++ b/modelscope/cli/modelcard.py @@ -18,7 +18,7 @@ template_path = os.path.join(curren_path, 'template') def subparser_func(args): - """ Fuction which will be called for a specific sub parser. + """ Function which will be called for a specific sub parser. """ return ModelCardCMD(args) diff --git a/modelscope/cli/pipeline.py b/modelscope/cli/pipeline.py index 59cabdf9..2f34b786 100644 --- a/modelscope/cli/pipeline.py +++ b/modelscope/cli/pipeline.py @@ -13,7 +13,7 @@ template_path = os.path.join(curren_path, 'template') def subparser_func(args): - """ Fuction which will be called for a specific sub parser. + """ Function which will be called for a specific sub parser. """ return PipelineCMD(args) diff --git a/modelscope/cli/plugins.py b/modelscope/cli/plugins.py index e40457df..bcf8f0ef 100644 --- a/modelscope/cli/plugins.py +++ b/modelscope/cli/plugins.py @@ -9,7 +9,7 @@ plugins_manager = PluginsManager() def subparser_func(args): - """ Fuction which will be called for a specific sub parser. + """ Function which will be called for a specific sub parser. """ return PluginsCMD(args) diff --git a/modelscope/cli/template/template.tpl b/modelscope/cli/template/template.tpl index d24f1b71..0c09a925 100644 --- a/modelscope/cli/template/template.tpl +++ b/modelscope/cli/template/template.tpl @@ -24,7 +24,7 @@ class ${model_name}(TorchModel): def init_model(self, **kwargs): """Provide default implementation based on TorchModel and user can reimplement it. include init model and load ckpt from the model_dir, maybe include preprocessor - if nothing to do, then return lambdx x: x + if nothing to do, then return lambda x: x """ return lambda x: x @@ -41,7 +41,7 @@ class ${preprocessor_name}(Preprocessor): def init_preprocessor(self, **kwarg): """ Provide default implementation based on preprocess_cfg and user can reimplement it. - if nothing to do, then return lambdx x: x + if nothing to do, then return lambda x: x """ return lambda x: x diff --git a/modelscope/exporters/nlp/model_for_token_classification_exporter.py b/modelscope/exporters/nlp/model_for_token_classification_exporter.py index 676615c0..daa33ea9 100644 --- a/modelscope/exporters/nlp/model_for_token_classification_exporter.py +++ b/modelscope/exporters/nlp/model_for_token_classification_exporter.py @@ -89,7 +89,7 @@ class ModelForSequenceClassificationExporter(TorchModelExporter): outputs_origin = list(numpify_tensor_nested(outputs_origin)) outputs_origin = [outputs_origin[0] - ] # keeo `predictions`, drop other outputs + ] # keep `predictions`, drop other outputs np_dummy_inputs = numpify_tensor_nested(dummy_inputs) np_dummy_inputs['label_mask'] = np_dummy_inputs['label_mask'].astype( diff --git a/modelscope/models/audio/kws/farfield/fsmn_sele_v2.py b/modelscope/models/audio/kws/farfield/fsmn_sele_v2.py index 8af16cc9..a258e004 100644 --- a/modelscope/models/audio/kws/farfield/fsmn_sele_v2.py +++ b/modelscope/models/audio/kws/farfield/fsmn_sele_v2.py @@ -18,7 +18,7 @@ class FSMNUnit(nn.Module): Args: dimlinear: input / output dimension dimproj: fsmn input / output dimension - lorder: left ofder + lorder: left order rorder: right order """ super(FSMNUnit, self).__init__() diff --git a/modelscope/models/audio/kws/nearfield/fsmn.py b/modelscope/models/audio/kws/nearfield/fsmn.py index 85c82a5a..094dacd2 100644 --- a/modelscope/models/audio/kws/nearfield/fsmn.py +++ b/modelscope/models/audio/kws/nearfield/fsmn.py @@ -435,7 +435,7 @@ class FSMN(nn.Module): """ Args: input (torch.Tensor): Input tensor (B, T, D) - in_cache(torhc.Tensor): (B, D, C), C is the accumulated cache size + in_cache(torch.Tensor): (B, D, C), C is the accumulated cache size """ # print("FSMN forward!!!!") diff --git a/modelscope/models/audio/kws/nearfield/model.py b/modelscope/models/audio/kws/nearfield/model.py index 7bf55c8b..023d5011 100644 --- a/modelscope/models/audio/kws/nearfield/model.py +++ b/modelscope/models/audio/kws/nearfield/model.py @@ -39,8 +39,8 @@ class FSMNDecorator(TorchModel): model_dir (str): the model path. cmvn_file (str): cmvn file backbone (dict): params related to backbone - input_dim (int): input dimention of network - output_dim (int): output dimention of network + input_dim (int): input dimension of network + output_dim (int): output dimension of network training (bool): training or inference mode """ super().__init__(model_dir, *args, **kwargs) @@ -108,7 +108,7 @@ class FSMNDecorator(TorchModel): class KWSModel(nn.Module): """Our model consists of four parts: 1. global_cmvn: Optional, (idim, idim) - 2. preprocessing: feature dimention projection, (idim, hdim) + 2. preprocessing: feature dimension projection, (idim, hdim) 3. backbone: backbone or feature extractor of the whole network, (hdim, hdim) 4. classifier: output layer or classifier of KWS model, (hdim, odim) 5. activation: @@ -133,7 +133,7 @@ class KWSModel(nn.Module): odim (int): output dimension of network hdim (int): hidden dimension of network global_cmvn (nn.Module): cmvn for input feature, (idim, idim) - preprocessing (nn.Module): feature dimention projection, (idim, hdim) + preprocessing (nn.Module): feature dimension projection, (idim, hdim) backbone (nn.Module): backbone or feature extractor of the whole network, (hdim, hdim) classifier (nn.Module): output layer or classifier of KWS model, (hdim, odim) activation (nn.Module): nn.Identity for training, nn.Sigmoid for inference diff --git a/modelscope/models/cv/action_recognition/temporal_patch_shift_transformer.py b/modelscope/models/cv/action_recognition/temporal_patch_shift_transformer.py index 35c57d37..6abe3025 100644 --- a/modelscope/models/cv/action_recognition/temporal_patch_shift_transformer.py +++ b/modelscope/models/cv/action_recognition/temporal_patch_shift_transformer.py @@ -871,7 +871,7 @@ class SwinTransformer2D_TPS(nn.Module): Args: logger (logging.Logger): The logger used to print - debugging infomation. + debugging information. """ checkpoint = torch.load(self.pretrained, map_location='cpu') state_dict = checkpoint['model'] diff --git a/modelscope/models/cv/body_3d_keypoints/cannonical_pose/body_3d_pose.py b/modelscope/models/cv/body_3d_keypoints/cannonical_pose/body_3d_pose.py index 3205ee95..e9c08395 100644 --- a/modelscope/models/cv/body_3d_keypoints/cannonical_pose/body_3d_pose.py +++ b/modelscope/models/cv/body_3d_keypoints/cannonical_pose/body_3d_pose.py @@ -181,7 +181,7 @@ class BodyKeypointsDetection3D(TorchModel): "camera_pose": Tensor, [1, NUM_FRAME, OUT_NUM_JOINTS, OUT_3D_FEATURE_DIM], 3D human pose keypoints in camera frame. "camera_traj": Tensor, [1, NUM_FRAME, 1, 3], - root keypoints coordinates in camere frame. + root keypoints coordinates in camera frame. """ inputs_2d = input['inputs_2d'] pose2d_rr = input['pose2d_rr'] diff --git a/modelscope/models/cv/body_3d_keypoints/hdformer/directed_graph.py b/modelscope/models/cv/body_3d_keypoints/hdformer/directed_graph.py index 3127cf1c..9fe61d7f 100644 --- a/modelscope/models/cv/body_3d_keypoints/hdformer/directed_graph.py +++ b/modelscope/models/cv/body_3d_keypoints/hdformer/directed_graph.py @@ -46,14 +46,14 @@ class DiGraph(): super().__init__() self.num_nodes = len(skeleton.parents()) self.directed_edges_hop1 = [ - (parrent, child) - for child, parrent in enumerate(skeleton.parents()) if parrent >= 0 + (parent, child) for child, parent in enumerate(skeleton.parents()) + if parent >= 0 ] self.directed_edges_hop2 = [(0, 1, 2), (0, 4, 5), (0, 7, 8), (1, 2, 3), (4, 5, 6), (7, 8, 9), (7, 8, 11), (7, 8, 14), (8, 9, 10), (8, 11, 12), (8, 14, 15), (11, 12, 13), - (14, 15, 16)] # (parrent, child) + (14, 15, 16)] # (parent, child) self.directed_edges_hop3 = [(0, 1, 2, 3), (0, 4, 5, 6), (0, 7, 8, 9), (7, 8, 9, 10), (7, 8, 11, 12), (7, 8, 14, 15), (8, 11, 12, 13), @@ -112,8 +112,8 @@ class Graph(): # edge is a list of [child, parent] paris self.num_node = len(skeleton.parents()) self_link = [(i, i) for i in range(self.num_node)] - neighbor_link = [(child, parrent) - for child, parrent in enumerate(skeleton.parents())] + neighbor_link = [(child, parent) + for child, parent in enumerate(skeleton.parents())] self.self_link = self_link self.neighbor_link = neighbor_link self.edge = self_link + neighbor_link diff --git a/modelscope/models/cv/cartoon/facelib/facer.py b/modelscope/models/cv/cartoon/facelib/facer.py index c6f34e9c..7e312cf3 100644 --- a/modelscope/models/cv/cartoon/facelib/facer.py +++ b/modelscope/models/cv/cartoon/facelib/facer.py @@ -94,7 +94,7 @@ class FaceAna(): sorted_bboxes = [bboxes[x] for x in picked] return np.array(sorted_bboxes) - def judge_boxs(self, previuous_bboxs, now_bboxs): + def judge_boxs(self, previous_bboxs, now_bboxs): def iou(rec1, rec2): @@ -116,17 +116,16 @@ class FaceAna(): return intersect / (sum_area - intersect) - if previuous_bboxs is None: + if previous_bboxs is None: return now_bboxs result = [] for i in range(now_bboxs.shape[0]): contain = False - for j in range(previuous_bboxs.shape[0]): - if iou(now_bboxs[i], previuous_bboxs[j]) > self.iou_thres: - result.append( - self.smooth(now_bboxs[i], previuous_bboxs[j])) + for j in range(previous_bboxs.shape[0]): + if iou(now_bboxs[i], previous_bboxs[j]) > self.iou_thres: + result.append(self.smooth(now_bboxs[i], previous_bboxs[j])) contain = True break if not contain: