feat: 优化工厂模式的实现
This commit is contained in:
@@ -10,7 +10,7 @@ import torch.nn.functional as F
|
||||
from torch import Tensor
|
||||
from torch.nn.parallel import DistributedDataParallel as DDP
|
||||
|
||||
from astrai.core.factory import BaseFactory
|
||||
from astrai.factory import BaseFactory
|
||||
|
||||
|
||||
def unwrap_model(model: nn.Module) -> nn.Module:
|
||||
@@ -122,8 +122,6 @@ class StrategyFactory(BaseFactory["BaseStrategy"]):
|
||||
strategy = StrategyFactory.create("custom", model, device)
|
||||
"""
|
||||
|
||||
_registry: Dict[str, type] = {}
|
||||
|
||||
@classmethod
|
||||
def _validate_component(cls, strategy_cls: type) -> None:
|
||||
"""Validate that the strategy class inherits from BaseStrategy."""
|
||||
|
||||
Reference in New Issue
Block a user