fix:warning for diffusers>=0.27.0
This commit is contained in:
@@ -12,7 +12,14 @@ from typing import Optional, Tuple
|
||||
try:
|
||||
from diffusers.configuration_utils import ConfigMixin, register_to_config
|
||||
from diffusers.models.modeling_utils import ModelMixin
|
||||
from diffusers.models.unet_2d_blocks import UNetMidBlock2D, get_down_block, get_up_block
|
||||
from diffusers import __version__
|
||||
if __version__:
|
||||
diffusers_version = int(__version__.replace('.', ''))
|
||||
if diffusers_version < 270:
|
||||
from diffusers.models.unet_2d_blocks import UNetMidBlock2D, get_down_block, get_up_block
|
||||
else:
|
||||
from diffusers.models.unets.unet_2d_blocks import UNetMidBlock2D, get_down_block, get_up_block
|
||||
|
||||
import functools
|
||||
|
||||
def zero_module(module):
|
||||
@@ -374,8 +381,8 @@ except ImportError:
|
||||
ConfigMixin = None
|
||||
TransparentVAEDecoder = None
|
||||
calculate_weight_adjust_channel = None
|
||||
print("\33[31mModule 'diffusers' not installed. Please install it via:\033[0m")
|
||||
print("\33[31mpip install diffusers\033[0m")
|
||||
print("\33[33mModule 'diffusers' load failed. If you don't have it installed, do it:\033[0m")
|
||||
print("\33[33mpip install diffusers\033[0m")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -770,12 +770,14 @@ app.registerExtension({
|
||||
// 修复官方bug: 应该初始化修改节点的control_mode name
|
||||
if(control_mode && control_mode == 'before'){
|
||||
const controlValueRunBefore = control_mode == 'before'
|
||||
for (const w of node.widgets) {
|
||||
if (['control_before_generate','control_after_generate'].includes(w.name)) {
|
||||
await updateControlWidgetLabel(w, controlValueRunBefore);
|
||||
if (w.linkedWidgets) {
|
||||
for (const l of w.linkedWidgets) {
|
||||
await updateControlWidgetLabel(l, controlValueRunBefore);
|
||||
if(node.widgets && node.widgets.length>0) {
|
||||
for (const w of node.widgets) {
|
||||
if (['control_before_generate', 'control_after_generate'].includes(w.name)) {
|
||||
await updateControlWidgetLabel(w, controlValueRunBefore);
|
||||
if (w.linkedWidgets) {
|
||||
for (const l of w.linkedWidgets) {
|
||||
await updateControlWidgetLabel(l, controlValueRunBefore);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user