-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathrandom_model_clip_vae.py
37 lines (32 loc) · 1.43 KB
/
random_model_clip_vae.py
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
import random
import json
class RandomModelClipVae:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"number_of_inputs": ("INT", {"default": 2, "min": 2, "max": 10, "step": 1}),
"model_1": ("MODEL", {"forceInput": True}),
"clip_1": ("CLIP", {"forceInput": True}),
"vae_1": ("VAE", {"forceInput": True}),
"model_2": ("MODEL", {"forceInput": True}),
"clip_2": ("CLIP", {"forceInput": True}),
"vae_2": ("VAE", {"forceInput": True}),
"seed": ("INT", {"default": 0}),
},
"hidden": {
**{f"model_{i}": ("MODEL", {"forceInput": True}) for i in range(3, 11)},
**{f"clip_{i}": ("CLIP", {"forceInput": True}) for i in range(3, 11)},
**{f"vae_{i}": ("VAE", {"forceInput": True}) for i in range(3, 11)},
}
}
RETURN_TYPES = ("MODEL", "CLIP", "VAE")
FUNCTION = "random_select"
CATEGORY = "Bjornulf"
def random_select(self, number_of_inputs, **kwargs):
random.seed(kwargs.get('seed', 0))
selected_index = random.randint(1, number_of_inputs)
selected_model = kwargs[f"model_{selected_index}"]
selected_clip = kwargs[f"clip_{selected_index}"]
selected_vae = kwargs[f"vae_{selected_index}"]
return (selected_model, selected_clip, selected_vae)