forked from Nerogar/OneTrainer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseModelSampler.py
More file actions
34 lines (27 loc) · 941 Bytes
/
Copy pathBaseModelSampler.py
File metadata and controls
34 lines (27 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from abc import ABCMeta, abstractmethod
from typing import Callable
import torch
from PIL.Image import Image
from modules.util.enum.ImageFormat import ImageFormat
from modules.util.config.SampleConfig import SampleConfig
class BaseModelSampler(metaclass=ABCMeta):
def __init__(
self,
train_device: torch.device,
temp_device: torch.device,
):
super(BaseModelSampler, self).__init__()
self.train_device = train_device
self.temp_device = temp_device
@abstractmethod
def sample(
self,
sample_params: SampleConfig,
destination: str,
image_format: ImageFormat,
text_encoder_layer_skip: int,
force_last_timestep: bool = False,
on_sample: Callable[[Image], None] = lambda _: None,
on_update_progress: Callable[[int, int], None] = lambda _, __: None,
):
pass