@@ -231,8 +231,8 @@ def load_ip_adapter(
231231
232232 def set_ip_adapter_scale (self , scale_configs : Union [float , Dict , List [Union [float , Dict ]]], default_scale = 0.0 ):
233233 """
234- Set IP-Adapter scales per-transformer block. Input `scale_configs` could be a single config or a list of configs
235- for granular control over each IP-Adapter behavior. A config can be a float or a dictionary.
234+ Set IP-Adapter scales per-transformer block. Input `scale_configs` could be a single config or a list of
235+ configs for granular control over each IP-Adapter behavior. A config can be a float or a dictionary.
236236
237237 Example:
238238
@@ -243,36 +243,19 @@ def set_ip_adapter_scale(self, scale_configs: Union[float, Dict, List[Union[floa
243243
244244 # To use style block only
245245 scale_configs = {
246- "up": {
247- "block_0": [0.0, 1.0, 0.0]
248- },
246+ "up": {"block_0": [0.0, 1.0, 0.0]},
249247 }
250248 pipeline.set_ip_adapter_scale(scale_configs)
251249
252250 # To use style+layout blocks
253251 scale_configs = {
254- "down": {
255- "block_2": [0.0, 1.0]
256- },
257- "up": {
258- "block_0": [0.0, 1.0, 0.0]
259- },
252+ "down": {"block_2": [0.0, 1.0]},
253+ "up": {"block_0": [0.0, 1.0, 0.0]},
260254 }
261255 pipeline.set_ip_adapter_scale(scale_configs)
262256
263257 # To use style and layout from 2 reference images
264- scale_configs = [
265- {
266- "down": {
267- "block_2": [0.0, 1.0]
268- }
269- },
270- {
271- "up": {
272- "block_0": [0.0, 1.0, 0.0]
273- }
274- }
275- ]
258+ scale_configs = [{"down": {"block_2": [0.0, 1.0]}}, {"up": {"block_0": [0.0, 1.0, 0.0]}}]
276259 pipeline.set_ip_adapter_scale(scale_configs)
277260 ```
278261 """
@@ -288,7 +271,7 @@ def set_ip_adapter_scale(self, scale_configs: Union[float, Dict, List[Union[floa
288271 f"Cannot assign { len (scale_configs )} scale_configs to "
289272 f"{ len (attn_processor .scale )} IP-Adapter."
290273 )
291- elif len (scale_configs )== 1 :
274+ elif len (scale_configs ) == 1 :
292275 scale_configs = scale_configs * len (attn_processor .scale )
293276 for i , scale_config in enumerate (scale_configs ):
294277 if isinstance (scale_config , dict ):
0 commit comments