faceswap-GAN icon indicating copy to clipboard operation
faceswap-GAN copied to clipboard

faceswap error regularizers is not defined

Open Alkatraz91 opened this issue 5 years ago • 5 comments

hello i got this error an not understand what it means

NameError Traceback (most recent call last) in () ----> 1 model = FaceswapGANModel(**arch_config)

2 frames /content/faceswap-GAN/networks/nn_blocks.py in conv_block(input_tensor, f, use_norm, strides, w_l2, norm) 126 def conv_block(input_tensor, f, use_norm=False, strides=2, w_l2=w_l2, norm='none'): 127 x = input_tensor --> 128 x = Conv2D(f, kernel_size=3, strides=strides, kernel_regularizer=regularizers.l2(w_l2),
129 kernel_initializer=conv_init, use_bias=False, padding="same")(x) 130 x = Activation("relu")(x)

NameError: name 'regularizers' is not defined

Alkatraz91 avatar Dec 06 '19 13:12 Alkatraz91

Create a new cell and write the following code from keras import regularizers It will solve issue. If it doesn't then write the same code in /networks/nn_blocks.py file

hafizas101 avatar Dec 06 '19 16:12 hafizas101

i not know were t oadd that line. today i w trying again but i got a different error: NameError Traceback (most recent call last) in () ----> 1 model = FaceswapGANModel(**arch_config)

2 frames /content/faceswap-GAN/networks/nn_blocks.py in conv_block(input_tensor, f, use_norm, strides, w_l2, norm) 126 def conv_block(input_tensor, f, use_norm=False, strides=2, w_l2=w_l2, norm='none'): 127 x = input_tensor --> 128 x = Conv2D(f, kernel_size=3, strides=strides, kernel_regularizer=regularizers.l2(w_l2),
129 kernel_initializer=conv_init, use_bias=False, padding="same")(x) 130 x = Activation("relu")(x)

NameError: name 'regularizers' is not defined

after the code :model = FaceswapGANModel(**arch_config)

i hav put the code u gave me right before that code but still nothing.i not know how to do the second method. edit: i think i hve done the second method too but still got the same error not know wht to do

Alkatraz91 avatar Dec 07 '19 09:12 Alkatraz91

I am able to get the colab notebook to see the from keras import regularizers by restarting the runtime. Not the best solution but after restarting, the colab sees the new import

interactivetech avatar Feb 11 '20 19:02 interactivetech

make sure you are using tensorflow1.8.0 and install tensorflow-gpu1.8.0 , and downgrade cuda to 9.0 .

wiki-lai avatar May 16 '20 12:05 wiki-lai

downgrade keras

CL791 avatar Apr 28 '21 09:04 CL791