This commit is contained in:
suluyan
2022-06-23 12:53:42 +08:00
parent e6bb781c6d
commit 102943923e
3 changed files with 5 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ class Models(object):
bert = 'bert'
palm = 'palm-v2'
structbert = 'structbert'
veco = 'veco'
# audio models
sambert_hifi_16k = 'sambert-hifi-16k'

View File

@@ -2,7 +2,8 @@ from typing import Any, Dict, Optional, Union
import numpy as np
from ...utils.constant import Tasks
from modelscope.metainfo import Models
from modelscope.utils.constant import Tasks
from ..base import Model, Tensor
from ..builder import MODELS
@@ -36,14 +37,14 @@ class AliceMindBaseForMaskedLM(Model):
return {'logits': rst['logits'], 'input_ids': inputs['input_ids']}
@MODELS.register_module(Tasks.fill_mask, module_name=r'sbert')
@MODELS.register_module(Tasks.fill_mask, module_name=Models.structbert)
class StructBertForMaskedLM(AliceMindBaseForMaskedLM):
# The StructBert for MaskedLM uses the same underlying model structure
# as the base model class.
pass
@MODELS.register_module(Tasks.fill_mask, module_name=r'veco')
@MODELS.register_module(Tasks.fill_mask, module_name=Models.veco)
class VecoForMaskedLM(AliceMindBaseForMaskedLM):
# The Veco for MaskedLM uses the same underlying model structure
# as the base model class.

View File

@@ -10,7 +10,6 @@ from modelscope.models.nlp import StructBertForMaskedLM, VecoForMaskedLM
from modelscope.pipelines import FillMaskPipeline, pipeline
from modelscope.preprocessors import FillMaskPreprocessor
from modelscope.utils.constant import Tasks
from modelscope.utils.hub import get_model_cache_dir
from modelscope.utils.test_utils import test_level