scheduler.py 924 Bytes
Newer Older
1
import torch
helloyongyang's avatar
helloyongyang committed
2

PengGao's avatar
PengGao committed
3
4
from ..scheduler import HunyuanScheduler

helloyongyang's avatar
helloyongyang committed
5

6
class HunyuanSchedulerTeaCaching(HunyuanScheduler):
helloyongyang's avatar
helloyongyang committed
7
8
    def __init__(self, config):
        super().__init__(config)
Dongz's avatar
Dongz committed
9

10
    def clear(self):
Yang Yong(雍洋)'s avatar
Yang Yong(雍洋) committed
11
        self.transformer_infer.clear()
helloyongyang's avatar
helloyongyang committed
12
13


14
class HunyuanSchedulerTaylorCaching(HunyuanScheduler):
helloyongyang's avatar
helloyongyang committed
15
16
    def __init__(self, config):
        super().__init__(config)
Yang Yong(雍洋)'s avatar
Yang Yong(雍洋) committed
17
18
19
20
21
22
23
24
25
26
        pattern = [True, False, False, False]
        self.caching_records = (pattern * ((config.infer_steps + 3) // 4))[: config.infer_steps]

    def clear(self):
        self.transformer_infer.clear()


class HunyuanSchedulerAdaCaching(HunyuanScheduler):
    def __init__(self, config):
        super().__init__(config)
helloyongyang's avatar
helloyongyang committed
27

Yang Yong(雍洋)'s avatar
Yang Yong(雍洋) committed
28
29
30
31
32
33
34
35
36
37
    def clear(self):
        self.transformer_infer.clear()


class HunyuanSchedulerCustomCaching(HunyuanScheduler):
    def __init__(self, config):
        super().__init__(config)

    def clear(self):
        self.transformer_infer.clear()