File size: 980 Bytes
ea17a8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# YiYi Notes: use this to generate mellon config
# TODO: 
# 1. the whole process to create a custom node should be automated with something like `node.push_to_hub()`
# 2. should be able to edit mellon_config.json


from diffusers.modular_pipelines.node_utils import ModularNode
from diffusers.modular_pipelines import ModularPipelineMixin
diffdiff = ModularPipelineMixin.from_pretrained("YiYiXu/modular-diffdiff", trust_remote_code=True)

# this is the complete pipeline
node = ModularNode(diffdiff)
node.save_mellon_config("diffdiff_mellon_config.json")


# this is the denoise pipeline, to be used in the modular setting, 
# remove the text_encoder, decode, and ip_adapter blocks since we already have these nodes in official modular diffusers mellon
diffdiff.blocks.pop("text_encoder")
diffdiff.blocks.pop("decode")
diffdiff.blocks.pop("ip_adapter")

node = ModularNode(diffdiff, label = "DiffDiffDenoiseBlocks")
node.save_mellon_config("diffdiff_denoise_mellon_config.json")