File tree Expand file tree Collapse file tree
src/diffusers/modular_pipelines Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1058,6 +1058,7 @@ def from_custom_block(
10581058 inputs = []
10591059 model_inputs = []
10601060 outputs = []
1061+ required_inputs = []
10611062
10621063 # Process block inputs
10631064 for input_param in block .inputs :
@@ -1066,7 +1067,8 @@ def from_custom_block(
10661067 if input_param .name in input_types :
10671068 input_param = copy .copy (input_param )
10681069 input_param .metadata = {"mellon" : input_types [input_param .name ]}
1069- print (f" processing input: { input_param .name } , metadata: { input_param .metadata } " )
1070+ if input_param .required :
1071+ required_inputs .append (input_param .name )
10701072 inputs .append (input_param_to_mellon_param (input_param ))
10711073
10721074 # Process block outputs
@@ -1090,7 +1092,7 @@ def from_custom_block(
10901092 "inputs" : inputs ,
10911093 "model_inputs" : model_inputs ,
10921094 "outputs" : outputs ,
1093- "required_inputs" : [] ,
1095+ "required_inputs" : required_inputs ,
10941096 "required_model_inputs" : [],
10951097 "block_name" : "custom" ,
10961098 }
Original file line number Diff line number Diff line change @@ -230,6 +230,17 @@ def test_custom_block_supported_components(self):
230230 assert len (pipe .components ) == 1
231231 assert pipe .component_names [0 ] == "transformer"
232232
233+ def test_custom_block_mellon_config_preserves_required_inputs (self ):
234+ from diffusers .modular_pipelines .mellon_node_utils import MellonPipelineConfig
235+
236+ custom_block = DummyCustomBlockSimple ()
237+
238+ mellon_config = MellonPipelineConfig .from_custom_block (custom_block )
239+ custom_node = mellon_config .node_params ["custom" ]
240+
241+ assert mellon_config .node_specs ["custom" ]["required_inputs" ] == ["prompt" ]
242+ assert custom_node ["params" ]["prompt" ]["label" ].endswith (" *" )
243+
233244 def test_trust_remote_code_not_propagated_to_external_repo (self ):
234245 """When a modular pipeline repo references a component from an external repo that has custom
235246 code (auto_map in config), calling load_components(trust_remote_code=True) should NOT
You can’t perform that action at this time.
0 commit comments