mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2026-04-26 09:42:27 +00:00
* set optimizer to optional in execute_pipeline * arrange device and mixed precision in booster init * fix execute_pipeline in booster.py
22 lines
647 B
Python
22 lines
647 B
Python
from abc import abstractmethod
|
|
from typing import Any, Callable, Iterator, Optional
|
|
|
|
import torch
|
|
|
|
from colossalai.interface import ModelWrapper, OptimizerWrapper
|
|
|
|
from .plugin_base import Plugin
|
|
|
|
|
|
class PipelinePluginBase(Plugin):
|
|
|
|
@abstractmethod
|
|
def execute_pipeline(self,
|
|
data_iter: Iterator,
|
|
model: ModelWrapper,
|
|
criterion: Callable[[Any, Any], torch.Tensor],
|
|
optimizer: Optional[OptimizerWrapper] = None,
|
|
return_loss: bool = True,
|
|
return_outputs: bool = False) -> dict:
|
|
pass
|