Files
modelscope-scepter/scepter/modules/model/tuner/base_tuner.py
T

26 lines
742 B
Python

# -*- coding: utf-8 -*-
# Copyright (c) Alibaba, Inc. and its affiliates.
from abc import ABCMeta
from scepter.modules.model.base_model import BaseModel
from scepter.modules.model.registry import TUNERS
from scepter.modules.utils.config import dict_to_yaml
@TUNERS.register_class()
class BaseTuner(BaseModel, metaclass=ABCMeta):
para_dict = {}
def __init__(self, cfg, logger=None):
super().__init__(cfg, logger=logger)
def forward(self, *args, **kwargs):
raise NotImplementedError
@staticmethod
def get_config_template():
return dict_to_yaml('TUNERS',
__class__.__name__,
BaseTuner.para_dict,
set_name=True)