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
33 lines (25 loc) · 853 Bytes
/
Copy pathBaseModelSampler.py
File metadata and controls
33 lines (25 loc) · 853 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
from abc import ABCMeta, abstractmethod
from typing import Callable
from modules.util.config.SampleConfig import SampleConfig
from modules.util.enum.ImageFormat import ImageFormat
import torch
from PIL.Image import Image
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_config: SampleConfig,
destination: str,
image_format: ImageFormat,
on_sample: Callable[[Image], None] = lambda _: None,
on_update_progress: Callable[[int, int], None] = lambda _, __: None,
):
pass