scheduler.py 567 Bytes
Newer Older
helloyongyang's avatar
helloyongyang committed
1
import torch
gushiqiao's avatar
gushiqiao committed
2
from lightx2v.utils.envs import *
helloyongyang's avatar
helloyongyang committed
3
4


Dongz's avatar
Dongz committed
5
class BaseScheduler:
helloyongyang's avatar
helloyongyang committed
6
7
    def __init__(self, config):
        self.config = config
helloyongyang's avatar
helloyongyang committed
8
9
        self.step_index = 0
        self.latents = None
10
11
        self.infer_steps = config.infer_steps
        self.caching_records = [True] * config.infer_steps
12
        self.flag_df = False
13
        self.transformer_infer = None
Dongz's avatar
Dongz committed
14

helloyongyang's avatar
helloyongyang committed
15
16
    def step_pre(self, step_index):
        self.step_index = step_index
gushiqiao's avatar
gushiqiao committed
17
18
        if GET_DTYPE() == "BF16":
            self.latents = self.latents.to(dtype=torch.bfloat16)
19
20
21

    def clear(self):
        pass