comdoleger commited on
Commit
556e709
·
verified ·
1 Parent(s): cf4db3d

Upload extensions_built_in/sd_trainer/__init__.py with huggingface_hub

Browse files
extensions_built_in/sd_trainer/__init__.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This is an example extension for custom training. It is great for experimenting with new ideas.
2
+ from toolkit.extension import Extension
3
+
4
+
5
+ # This is for generic training (LoRA, Dreambooth, FineTuning)
6
+ class SDTrainerExtension(Extension):
7
+ # uid must be unique, it is how the extension is identified
8
+ uid = "sd_trainer"
9
+
10
+ # name is the name of the extension for printing
11
+ name = "SD Trainer"
12
+
13
+ # This is where your process class is loaded
14
+ # keep your imports in here so they don't slow down the rest of the program
15
+ @classmethod
16
+ def get_process(cls):
17
+ # import your process class here so it is only loaded when needed and return it
18
+ from .SDTrainer import SDTrainer
19
+
20
+ return SDTrainer
21
+
22
+
23
+ # This is for generic training (LoRA, Dreambooth, FineTuning)
24
+ class UITrainerExtension(Extension):
25
+ # uid must be unique, it is how the extension is identified
26
+ uid = "ui_trainer"
27
+
28
+ # name is the name of the extension for printing
29
+ name = "UI Trainer"
30
+
31
+ # This is where your process class is loaded
32
+ # keep your imports in here so they don't slow down the rest of the program
33
+ @classmethod
34
+ def get_process(cls):
35
+ # import your process class here so it is only loaded when needed and return it
36
+ from .UITrainer import UITrainer
37
+
38
+ return UITrainer
39
+
40
+
41
+ # This is a universal trainer that can be from ui or api
42
+ class DiffusionTrainerExtension(Extension):
43
+ # uid must be unique, it is how the extension is identified
44
+ uid = "diffusion_trainer"
45
+
46
+ # name is the name of the extension for printing
47
+ name = "Diffusion Trainer"
48
+
49
+ # This is where your process class is loaded
50
+ # keep your imports in here so they don't slow down the rest of the program
51
+ @classmethod
52
+ def get_process(cls):
53
+ # import your process class here so it is only loaded when needed and return it
54
+ from .DiffusionTrainer import DiffusionTrainer
55
+
56
+ return DiffusionTrainer
57
+
58
+
59
+ # for backwards compatability
60
+ class TextualInversionTrainer(SDTrainerExtension):
61
+ uid = "textual_inversion_trainer"
62
+
63
+
64
+ AI_TOOLKIT_EXTENSIONS = [
65
+ # you can put a list of extensions here
66
+ SDTrainerExtension,
67
+ TextualInversionTrainer,
68
+ UITrainerExtension,
69
+ DiffusionTrainerExtension,
70
+ ]