File size: 8,706 Bytes
2401ce9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
from dataclasses import dataclass, field
from typing import Dict, List, Optional, Union


@dataclass
class Txt2TxtPreset:
    frequency_penalty: float
    frequency_penalty_min: float
    frequency_penalty_max: float
    parameters: Optional[List[str]] = field(default_factory=list)


@dataclass
class Txt2ImgPreset:
    # FLUX1.1 has no scale or steps
    name: str
    guidance_scale: Optional[float] = None
    guidance_scale_min: Optional[float] = None
    guidance_scale_max: Optional[float] = None
    num_inference_steps: Optional[int] = None
    num_inference_steps_min: Optional[int] = None
    num_inference_steps_max: Optional[int] = None
    parameters: Optional[List[str]] = field(default_factory=list)
    kwargs: Optional[Dict[str, Union[str, int, float, bool]]] = field(default_factory=dict)


@dataclass
class Txt2TxtPresets:
    hugging_face: Txt2TxtPreset
    perplexity: Txt2TxtPreset


@dataclass
class Txt2ImgPresets:
    # bfl
    flux_1_1_pro_bfl: Txt2ImgPreset
    flux_dev_bfl: Txt2ImgPreset
    flux_pro_bfl: Txt2ImgPreset
    # fal
    aura_flow: Txt2ImgPreset
    flux_1_1_pro_fal: Txt2ImgPreset
    flux_dev_fal: Txt2ImgPreset
    flux_pro_fal: Txt2ImgPreset
    flux_schnell_fal: Txt2ImgPreset
    fooocus: Txt2ImgPreset
    kolors: Txt2ImgPreset
    stable_diffusion_3: Txt2ImgPreset
    # hf
    flux_dev_hf: Txt2ImgPreset
    flux_schnell_hf: Txt2ImgPreset
    stable_diffusion_xl: Txt2ImgPreset
    # together
    flux_schnell_free_together: Txt2ImgPreset


@dataclass
class Preset:
    txt2txt: Txt2TxtPresets
    txt2img: Txt2ImgPresets


preset = Preset(
    txt2txt=Txt2TxtPresets(
        # Every service has model and system messages
        hugging_face=Txt2TxtPreset(
            frequency_penalty=0.0,
            frequency_penalty_min=-2.0,
            frequency_penalty_max=2.0,
            parameters=["max_tokens", "temperature", "frequency_penalty", "seed"],
        ),
        perplexity=Txt2TxtPreset(
            frequency_penalty=1.0,
            frequency_penalty_min=1.0,
            frequency_penalty_max=2.0,
            parameters=["max_tokens", "temperature", "frequency_penalty"],
        ),
    ),
    txt2img=Txt2ImgPresets(
        aura_flow=Txt2ImgPreset(
            "AuraFlow",
            guidance_scale=3.5,
            guidance_scale_min=1.0,
            guidance_scale_max=10.0,
            num_inference_steps=28,
            num_inference_steps_min=10,
            num_inference_steps_max=50,
            parameters=["seed", "num_inference_steps", "guidance_scale", "expand_prompt"],
            kwargs={"num_images": 1, "sync_mode": False},
        ),
        flux_1_1_pro_bfl=Txt2ImgPreset(
            "FLUX1.1 Pro",
            parameters=["seed", "width", "height", "prompt_upsampling"],
            kwargs={"safety_tolerance": 6},
        ),
        flux_pro_bfl=Txt2ImgPreset(
            "FLUX.1 Pro",
            guidance_scale=2.5,
            guidance_scale_min=1.5,
            guidance_scale_max=5.0,
            num_inference_steps=40,
            num_inference_steps_min=10,
            num_inference_steps_max=50,
            parameters=["seed", "width", "height", "steps", "guidance", "prompt_upsampling"],
            kwargs={"safety_tolerance": 6, "interval": 1},
        ),
        flux_dev_bfl=Txt2ImgPreset(
            "FLUX.1 Dev",
            num_inference_steps=28,
            num_inference_steps_min=10,
            num_inference_steps_max=50,
            guidance_scale=3.0,
            guidance_scale_min=1.5,
            guidance_scale_max=5.0,
            parameters=["seed", "width", "height", "steps", "guidance", "prompt_upsampling"],
            kwargs={"safety_tolerance": 6},
        ),
        flux_1_1_pro_fal=Txt2ImgPreset(
            "FLUX1.1 Pro",
            parameters=["seed", "image_size"],
            kwargs={
                "num_images": 1,
                "sync_mode": False,
                "safety_tolerance": 6,
                "enable_safety_checker": False,
            },
        ),
        flux_pro_fal=Txt2ImgPreset(
            "FLUX.1 Pro",
            guidance_scale=2.5,
            guidance_scale_min=1.5,
            guidance_scale_max=5.0,
            num_inference_steps=40,
            num_inference_steps_min=10,
            num_inference_steps_max=50,
            parameters=["seed", "image_size", "num_inference_steps", "guidance_scale"],
            kwargs={"num_images": 1, "sync_mode": False, "safety_tolerance": 6},
        ),
        flux_dev_fal=Txt2ImgPreset(
            "FLUX.1 Dev",
            num_inference_steps=28,
            num_inference_steps_min=10,
            num_inference_steps_max=50,
            guidance_scale=3.0,
            guidance_scale_min=1.5,
            guidance_scale_max=5.0,
            parameters=["seed", "image_size", "num_inference_steps", "guidance_scale"],
            kwargs={"num_images": 1, "sync_mode": False, "safety_tolerance": 6},
        ),
        flux_schnell_fal=Txt2ImgPreset(
            "FLUX.1 Schnell",
            num_inference_steps=4,
            num_inference_steps_min=1,
            num_inference_steps_max=12,
            parameters=["seed", "image_size", "num_inference_steps"],
            kwargs={"num_images": 1, "sync_mode": False, "enable_safety_checker": False},
        ),
        flux_dev_hf=Txt2ImgPreset(
            "FLUX.1 Dev",
            num_inference_steps=28,
            num_inference_steps_min=10,
            num_inference_steps_max=50,
            guidance_scale=3.0,
            guidance_scale_min=1.5,
            guidance_scale_max=5.0,
            parameters=["width", "height", "guidance_scale", "num_inference_steps"],
            kwargs={"max_sequence_length": 512},
        ),
        flux_schnell_hf=Txt2ImgPreset(
            "FLUX.1 Schnell",
            num_inference_steps=4,
            num_inference_steps_min=1,
            num_inference_steps_max=12,
            parameters=["width", "height", "num_inference_steps"],
            kwargs={"guidance_scale": 0.0, "max_sequence_length": 256},
        ),
        flux_schnell_free_together=Txt2ImgPreset(
            "FLUX.1 Schnell Free",
            num_inference_steps=4,
            num_inference_steps_min=1,
            num_inference_steps_max=12,
            parameters=["model", "seed", "width", "height", "steps"],
            kwargs={"n": 1},
        ),
        fooocus=Txt2ImgPreset(
            "Fooocus",
            guidance_scale=4.0,
            guidance_scale_min=1.0,
            guidance_scale_max=10.0,
            parameters=["seed", "negative_prompt", "aspect_ratio", "guidance_scale"],
            kwargs={
                "num_images": 1,
                "sync_mode": True,
                "enable_safety_checker": False,
                "output_format": "png",
                "sharpness": 2,
                "styles": ["Fooocus Enhance", "Fooocus V2", "Fooocus Sharp"],
                "performance": "Quality",
            },
        ),
        kolors=Txt2ImgPreset(
            "Kolors",
            guidance_scale=5.0,
            guidance_scale_min=1.0,
            guidance_scale_max=10.0,
            num_inference_steps=50,
            num_inference_steps_min=10,
            num_inference_steps_max=50,
            parameters=["seed", "negative_prompt", "image_size", "guidance_scale", "num_inference_steps"],
            kwargs={
                "num_images": 1,
                "sync_mode": True,
                "enable_safety_checker": False,
                "scheduler": "EulerDiscreteScheduler",
            },
        ),
        stable_diffusion_3=Txt2ImgPreset(
            "SD3",
            guidance_scale=5.0,
            guidance_scale_min=1.0,
            guidance_scale_max=10.0,
            num_inference_steps=28,
            num_inference_steps_min=10,
            num_inference_steps_max=50,
            parameters=[
                "seed",
                "negative_prompt",
                "image_size",
                "guidance_scale",
                "num_inference_steps",
                "prompt_expansion",
            ],
            kwargs={"num_images": 1, "sync_mode": True, "enable_safety_checker": False},
        ),
        stable_diffusion_xl=Txt2ImgPreset(
            "SDXL",
            guidance_scale=7.0,
            guidance_scale_min=1.0,
            guidance_scale_max=10.0,
            num_inference_steps=40,
            num_inference_steps_min=10,
            num_inference_steps_max=50,
            parameters=[
                "seed",
                "negative_prompt",
                "width",
                "height",
                "guidance_scale",
                "num_inference_steps",
            ],
        ),
    ),
)