mirror of https://github.com/hpcaitech/ColossalAI
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
543 B
22 lines
543 B
from abc import ABC, abstractmethod
|
|
from typing import Callable, Tuple
|
|
|
|
import torch.nn as nn
|
|
from torch.optim import Optimizer
|
|
|
|
from colossalai.interface import OptimizerWrapper
|
|
|
|
|
|
class MixedPrecision(ABC):
|
|
"""
|
|
An abstract class for mixed precision training.
|
|
"""
|
|
|
|
@abstractmethod
|
|
def configure(self,
|
|
model: nn.Module,
|
|
optimizer: Optimizer,
|
|
criterion: Callable = None) -> Tuple[nn.Module, OptimizerWrapper, Callable]:
|
|
# TODO: implement this method
|
|
pass
|