unitorch.cli.models.diffusers
StableProcessor
Tip
core/process/diffusion/stable
is the section for configuration of BartProcessor.
Bases: StableProcessor
Source code in src/unitorch/cli/models/diffusers/processing_stable.py
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 | def __init__(
self,
vocab_path: str,
merge_path: str,
vae_config_path: str,
max_seq_length: Optional[int] = 77,
position_start_id: Optional[int] = 0,
pad_token: Optional[str] = "<|endoftext|>",
image_size: Optional[Tuple[int, int]] = None,
center_crop: Optional[bool] = False,
random_flip: Optional[bool] = False,
):
super().__init__(
vocab_path=vocab_path,
merge_path=merge_path,
vae_config_path=vae_config_path,
max_seq_length=max_seq_length,
position_start_id=position_start_id,
pad_token=pad_token,
image_size=image_size,
center_crop=center_crop,
random_flip=random_flip,
)
|
StableForText2ImageGeneration
Tip
core/model/diffusers/text2image/stable
is the section for configuration of StableForText2ImageGeneration.
Bases: StableForText2ImageGeneration
Source code in src/unitorch/cli/models/diffusers/modeling_stable.py
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 | def __init__(
self,
config_path: str,
text_config_path: str,
vae_config_path: str,
scheduler_config_path: str,
quant_config_path: Optional[str] = None,
image_size: Optional[int] = None,
in_channels: Optional[int] = None,
out_channels: Optional[int] = None,
num_train_timesteps: Optional[int] = 1000,
num_infer_timesteps: Optional[int] = 50,
freeze_vae_encoder: Optional[bool] = True,
freeze_text_encoder: Optional[bool] = True,
snr_gamma: Optional[float] = 5.0,
seed: Optional[int] = 1123,
):
super().__init__(
config_path=config_path,
text_config_path=text_config_path,
vae_config_path=vae_config_path,
scheduler_config_path=scheduler_config_path,
quant_config_path=quant_config_path,
image_size=image_size,
in_channels=in_channels,
out_channels=out_channels,
num_train_timesteps=num_train_timesteps,
num_infer_timesteps=num_infer_timesteps,
freeze_vae_encoder=freeze_vae_encoder,
freeze_text_encoder=freeze_text_encoder,
snr_gamma=snr_gamma,
seed=seed,
)
|
StableForImage2ImageGeneration
Tip
core/model/diffusers/image2image/stable
is the section for configuration of StableForImage2ImageGeneration.
Bases: StableForImage2ImageGeneration
Source code in src/unitorch/cli/models/diffusers/modeling_stable.py
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
254 | def __init__(
self,
config_path: str,
text_config_path: str,
vae_config_path: str,
scheduler_config_path: str,
quant_config_path: Optional[str] = None,
image_size: Optional[int] = None,
in_channels: Optional[int] = None,
out_channels: Optional[int] = None,
num_train_timesteps: Optional[int] = 1000,
num_infer_timesteps: Optional[int] = 50,
freeze_vae_encoder: Optional[bool] = True,
freeze_text_encoder: Optional[bool] = True,
snr_gamma: Optional[float] = 5.0,
seed: Optional[int] = 1123,
):
super().__init__(
config_path=config_path,
text_config_path=text_config_path,
vae_config_path=vae_config_path,
scheduler_config_path=scheduler_config_path,
quant_config_path=quant_config_path,
image_size=image_size,
in_channels=in_channels,
out_channels=out_channels,
num_train_timesteps=num_train_timesteps,
num_infer_timesteps=num_infer_timesteps,
freeze_vae_encoder=freeze_vae_encoder,
freeze_text_encoder=freeze_text_encoder,
snr_gamma=snr_gamma,
seed=seed,
)
|
StableForImageInpainting
Tip
core/model/diffusers/inpainting/stable
is the section for configuration of StableForImageInpainting.
Bases: StableForImageInpainting
Source code in src/unitorch/cli/models/diffusers/modeling_stable.py
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434 | def __init__(
self,
config_path: str,
text_config_path: str,
vae_config_path: str,
scheduler_config_path: str,
quant_config_path: Optional[str] = None,
image_size: Optional[int] = None,
in_channels: Optional[int] = None,
out_channels: Optional[int] = None,
num_train_timesteps: Optional[int] = 1000,
num_infer_timesteps: Optional[int] = 50,
freeze_vae_encoder: Optional[bool] = True,
freeze_text_encoder: Optional[bool] = True,
snr_gamma: Optional[float] = 5.0,
seed: Optional[int] = 1123,
):
super().__init__(
config_path=config_path,
text_config_path=text_config_path,
vae_config_path=vae_config_path,
scheduler_config_path=scheduler_config_path,
quant_config_path=quant_config_path,
image_size=image_size,
in_channels=in_channels,
out_channels=out_channels,
num_train_timesteps=num_train_timesteps,
num_infer_timesteps=num_infer_timesteps,
freeze_vae_encoder=freeze_vae_encoder,
freeze_text_encoder=freeze_text_encoder,
snr_gamma=snr_gamma,
seed=seed,
)
|
StableForImageResolution
Tip
core/model/diffusers/resolution/stable
is the section for configuration of StableForImageResolution.
Bases: StableForImageResolution
Source code in src/unitorch/cli/models/diffusers/modeling_stable.py
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625 | def __init__(
self,
config_path: str,
text_config_path: str,
vae_config_path: str,
scheduler_config_path: str,
quant_config_path: Optional[str] = None,
image_size: Optional[int] = None,
in_channels: Optional[int] = None,
out_channels: Optional[int] = None,
num_train_timesteps: Optional[int] = 1000,
num_infer_timesteps: Optional[int] = 50,
freeze_vae_encoder: Optional[bool] = True,
freeze_text_encoder: Optional[bool] = True,
snr_gamma: Optional[float] = 5.0,
seed: Optional[int] = 1123,
):
super().__init__(
config_path=config_path,
text_config_path=text_config_path,
vae_config_path=vae_config_path,
scheduler_config_path=scheduler_config_path,
quant_config_path=quant_config_path,
image_size=image_size,
in_channels=in_channels,
out_channels=out_channels,
num_train_timesteps=num_train_timesteps,
num_infer_timesteps=num_infer_timesteps,
freeze_vae_encoder=freeze_vae_encoder,
freeze_text_encoder=freeze_text_encoder,
snr_gamma=snr_gamma,
seed=seed,
)
|
StableXLProcessor
Tip
core/process/diffusion/stable_xl
is the section for configuration of StableXLProcessor.
Bases: StableXLProcessor
Source code in src/unitorch/cli/models/diffusers/processing_stable_xl.py
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 | def __init__(
self,
vocab_path: str,
merge_path: str,
vocab2_path: str,
merge2_path: str,
vae_config_path: str,
max_seq_length: Optional[int] = 77,
position_start_id: Optional[int] = 0,
pad_token: Optional[str] = "<|endoftext|>",
pad_token2: Optional[str] = "!",
image_size: Optional[Tuple[int, int]] = None,
center_crop: Optional[bool] = False,
random_flip: Optional[bool] = False,
):
super().__init__(
vocab_path=vocab_path,
merge_path=merge_path,
vocab2_path=vocab2_path,
merge2_path=merge2_path,
vae_config_path=vae_config_path,
max_seq_length=max_seq_length,
position_start_id=position_start_id,
pad_token=pad_token,
pad_token2=pad_token2,
image_size=image_size,
center_crop=center_crop,
random_flip=random_flip,
)
|
StableXLForText2ImageGeneration
Tip
core/model/diffusers/text2image/stable_xl
is the section for configuration of StableXLForText2ImageGeneration.
Bases: StableXLForText2ImageGeneration
Source code in src/unitorch/cli/models/diffusers/modeling_stable_xl.py
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 | def __init__(
self,
config_path: str,
text_config_path: str,
text2_config_path: str,
vae_config_path: str,
scheduler_config_path: str,
quant_config_path: Optional[str] = None,
image_size: Optional[int] = None,
in_channels: Optional[int] = None,
out_channels: Optional[int] = None,
num_train_timesteps: Optional[int] = 1000,
num_infer_timesteps: Optional[int] = 50,
freeze_vae_encoder: Optional[bool] = True,
freeze_text_encoder: Optional[bool] = True,
snr_gamma: Optional[float] = 5.0,
seed: Optional[int] = 1123,
use_fp16: Optional[bool] = True,
use_bf16: Optional[bool] = False,
):
super().__init__(
config_path=config_path,
text_config_path=text_config_path,
text2_config_path=text2_config_path,
vae_config_path=vae_config_path,
scheduler_config_path=scheduler_config_path,
quant_config_path=quant_config_path,
image_size=image_size,
in_channels=in_channels,
out_channels=out_channels,
num_train_timesteps=num_train_timesteps,
num_infer_timesteps=num_infer_timesteps,
freeze_vae_encoder=freeze_vae_encoder,
freeze_text_encoder=freeze_text_encoder,
snr_gamma=snr_gamma,
seed=seed,
)
self.use_dtype = torch.float16 if use_fp16 else torch.float32
self.use_dtype = (
torch.bfloat16
if use_bf16 and torch.cuda.is_bf16_supported()
else self.use_dtype
)
|
StableXLForImage2ImageGeneration
Tip
core/model/diffusers/image2image/stable_xl
is the section for configuration of StableXLForImage2ImageGeneration.
Bases: StableXLForImage2ImageGeneration
Source code in src/unitorch/cli/models/diffusers/modeling_stable_xl.py
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314 | def __init__(
self,
config_path: str,
text_config_path: str,
text2_config_path: str,
vae_config_path: str,
scheduler_config_path: str,
quant_config_path: Optional[str] = None,
image_size: Optional[int] = None,
in_channels: Optional[int] = None,
out_channels: Optional[int] = None,
num_train_timesteps: Optional[int] = 1000,
num_infer_timesteps: Optional[int] = 50,
freeze_vae_encoder: Optional[bool] = True,
freeze_text_encoder: Optional[bool] = True,
snr_gamma: Optional[float] = 5.0,
seed: Optional[int] = 1123,
use_fp16: Optional[bool] = True,
use_bf16: Optional[bool] = False,
):
super().__init__(
config_path=config_path,
text_config_path=text_config_path,
text2_config_path=text2_config_path,
vae_config_path=vae_config_path,
scheduler_config_path=scheduler_config_path,
quant_config_path=quant_config_path,
image_size=image_size,
in_channels=in_channels,
out_channels=out_channels,
num_train_timesteps=num_train_timesteps,
num_infer_timesteps=num_infer_timesteps,
freeze_vae_encoder=freeze_vae_encoder,
freeze_text_encoder=freeze_text_encoder,
snr_gamma=snr_gamma,
seed=seed,
)
self.use_dtype = torch.float16 if use_fp16 else torch.float32
self.use_dtype = (
torch.bfloat16
if use_bf16 and torch.cuda.is_bf16_supported()
else self.use_dtype
)
|
StableXLForImageInpainting
Tip
core/model/diffusers/inpainting/stable_xl
is the section for configuration of StableXLForImageInpainting.
Bases: StableXLForImageInpainting
Source code in src/unitorch/cli/models/diffusers/modeling_stable_xl.py
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537 | def __init__(
self,
config_path: str,
text_config_path: str,
text2_config_path: str,
vae_config_path: str,
scheduler_config_path: str,
quant_config_path: Optional[str] = None,
image_size: Optional[int] = None,
in_channels: Optional[int] = None,
out_channels: Optional[int] = None,
num_train_timesteps: Optional[int] = 1000,
num_infer_timesteps: Optional[int] = 50,
freeze_vae_encoder: Optional[bool] = True,
freeze_text_encoder: Optional[bool] = True,
snr_gamma: Optional[float] = 5.0,
seed: Optional[int] = 1123,
use_fp16: Optional[bool] = True,
use_bf16: Optional[bool] = False,
):
super().__init__(
config_path=config_path,
text_config_path=text_config_path,
text2_config_path=text2_config_path,
vae_config_path=vae_config_path,
scheduler_config_path=scheduler_config_path,
quant_config_path=quant_config_path,
image_size=image_size,
in_channels=in_channels,
out_channels=out_channels,
num_train_timesteps=num_train_timesteps,
num_infer_timesteps=num_infer_timesteps,
freeze_vae_encoder=freeze_vae_encoder,
freeze_text_encoder=freeze_text_encoder,
snr_gamma=snr_gamma,
seed=seed,
)
self.use_dtype = torch.float16 if use_fp16 else torch.float32
self.use_dtype = (
torch.bfloat16
if use_bf16 and torch.cuda.is_bf16_supported()
else self.use_dtype
)
|
ControlNetProcessor
Tip
core/process/diffusion/controlnet
is the section for configuration of ControlNetProcessor.
Bases: StableProcessor
Source code in src/unitorch/cli/models/diffusers/processing_controlnet.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 | def __init__(
self,
vocab_path: str,
merge_path: str,
vae_config_path: str,
max_seq_length: Optional[int] = 77,
position_start_id: Optional[int] = 0,
pad_token: Optional[str] = "<|endoftext|>",
image_size: Optional[Tuple[int, int]] = None,
center_crop: Optional[bool] = False,
random_flip: Optional[bool] = False,
):
super().__init__(
vocab_path=vocab_path,
merge_path=merge_path,
vae_config_path=vae_config_path,
max_seq_length=max_seq_length,
position_start_id=position_start_id,
pad_token=pad_token,
image_size=image_size,
center_crop=center_crop,
random_flip=random_flip,
)
|
ControlNetForText2ImageGeneration
Tip
core/model/diffusers/text2image/controlnet
is the section for configuration of ControlNetForText2ImageGeneration.
Bases: ControlNetForText2ImageGeneration
Source code in src/unitorch/cli/models/diffusers/modeling_controlnet.py
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 | def __init__(
self,
config_path: str,
text_config_path: str,
vae_config_path: str,
controlnet_configs_path: Union[str, List[str]],
scheduler_config_path: str,
quant_config_path: Optional[str] = None,
image_size: Optional[int] = None,
in_channels: Optional[int] = None,
out_channels: Optional[int] = None,
num_train_timesteps: Optional[int] = 1000,
num_infer_timesteps: Optional[int] = 50,
freeze_vae_encoder: Optional[bool] = True,
freeze_text_encoder: Optional[bool] = True,
freeze_unet_encoder: Optional[bool] = True,
snr_gamma: Optional[float] = 5.0,
seed: Optional[int] = 1123,
):
super().__init__(
config_path=config_path,
text_config_path=text_config_path,
vae_config_path=vae_config_path,
controlnet_configs_path=controlnet_configs_path,
scheduler_config_path=scheduler_config_path,
quant_config_path=quant_config_path,
image_size=image_size,
in_channels=in_channels,
out_channels=out_channels,
num_train_timesteps=num_train_timesteps,
num_infer_timesteps=num_infer_timesteps,
freeze_vae_encoder=freeze_vae_encoder,
freeze_text_encoder=freeze_text_encoder,
freeze_unet_encoder=freeze_unet_encoder,
snr_gamma=snr_gamma,
seed=seed,
)
|
ControlNetForImage2ImageGeneration
Tip
core/model/diffusers/image2image/controlnet
is the section for configuration of ControlNetForImage2ImageGeneration.
Bases: ControlNetForImage2ImageGeneration
Source code in src/unitorch/cli/models/diffusers/modeling_controlnet.py
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323 | def __init__(
self,
config_path: str,
text_config_path: str,
vae_config_path: str,
controlnet_configs_path: Union[str, List[str]],
scheduler_config_path: str,
quant_config_path: Optional[str] = None,
image_size: Optional[int] = None,
in_channels: Optional[int] = None,
out_channels: Optional[int] = None,
num_train_timesteps: Optional[int] = 1000,
num_infer_timesteps: Optional[int] = 50,
freeze_vae_encoder: Optional[bool] = True,
freeze_text_encoder: Optional[bool] = True,
freeze_unet_encoder: Optional[bool] = True,
snr_gamma: Optional[float] = 5.0,
seed: Optional[int] = 1123,
):
super().__init__(
config_path=config_path,
text_config_path=text_config_path,
vae_config_path=vae_config_path,
controlnet_configs_path=controlnet_configs_path,
scheduler_config_path=scheduler_config_path,
quant_config_path=quant_config_path,
image_size=image_size,
in_channels=in_channels,
out_channels=out_channels,
num_train_timesteps=num_train_timesteps,
num_infer_timesteps=num_infer_timesteps,
freeze_vae_encoder=freeze_vae_encoder,
freeze_text_encoder=freeze_text_encoder,
freeze_unet_encoder=freeze_unet_encoder,
snr_gamma=snr_gamma,
seed=seed,
)
|
ControlNetForImageInpainting
Tip
core/model/diffusers/inpainting/controlnet
is the section for configuration of ControlNetForImageInpainting.
Bases: ControlNetForImageInpainting
Source code in src/unitorch/cli/models/diffusers/modeling_controlnet.py
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563 | def __init__(
self,
config_path: str,
text_config_path: str,
vae_config_path: str,
scheduler_config_path: str,
controlnet_configs_path: Union[str, List[str]] = None,
inpainting_controlnet_config_path: Union[str] = None,
quant_config_path: Optional[str] = None,
image_size: Optional[int] = None,
in_channels: Optional[int] = None,
out_channels: Optional[int] = None,
num_train_timesteps: Optional[int] = 1000,
num_infer_timesteps: Optional[int] = 50,
freeze_vae_encoder: Optional[bool] = True,
freeze_text_encoder: Optional[bool] = True,
freeze_unet_encoder: Optional[bool] = True,
snr_gamma: Optional[float] = 5.0,
seed: Optional[int] = 1123,
):
super().__init__(
config_path=config_path,
text_config_path=text_config_path,
vae_config_path=vae_config_path,
scheduler_config_path=scheduler_config_path,
controlnet_configs_path=controlnet_configs_path,
inpainting_controlnet_config_path=inpainting_controlnet_config_path,
quant_config_path=quant_config_path,
image_size=image_size,
in_channels=in_channels,
out_channels=out_channels,
num_train_timesteps=num_train_timesteps,
num_infer_timesteps=num_infer_timesteps,
freeze_vae_encoder=freeze_vae_encoder,
freeze_text_encoder=freeze_text_encoder,
freeze_unet_encoder=freeze_unet_encoder,
snr_gamma=snr_gamma,
seed=seed,
)
|