sumuzhao / CycleGAN-Music-Style-Transfer-Refactorization

Symbolic Music Genre Transfer with CycleGAN - Refactorization
MIT License
34 stars 16 forks source link

Unable to run due to use of Lambda layers #3

Closed callistachang closed 3 years ago

callistachang commented 3 years ago

I am using Tensorflow 2.3.1. When I run python tf2_main.py --dataset_A_dir='JC_J' --dataset_B_dir='JC_C' --type='cyclegan' --sigma_d=1 --phase='train', the following error occurs.

ValueError: 
The following Variables were created within a Lambda layer (IN_1)
but are not tracked by said layer:
  <tf.Variable 'IN_1/SCALE:0' shape=(64,) dtype=float32>
  <tf.Variable 'IN_1/OFFSET:0' shape=(64,) dtype=float32>
The layer cannot safely ensure proper Variable reuse across multiple
calls, and consquently this behavior is disallowed for safety. Lambda
layers are not well suited to stateful computation; instead, writing a
subclassed Layer is the recommend way to define layers with
Variables.

I have created custom layers to replace the instance_norm and resnet_block functions on my local machine. If you are interested, I'd be keen to contribute a pull request for this issue!

sumuzhao commented 3 years ago

Hi, it's nice if you'd like to make a pull request. I refactored the codes when TF2.0 was just out, so there should be some bugs or inelegent codes. Also a good way for me to learn something new ~