chrisdonahue / wavegan

WaveGAN: Learn to synthesize raw audio with generative adversarial networks
MIT License
1.32k stars 283 forks source link

Error generating audio ("The operation, 'G_z_spec', does not exist in the graph.") #46

Closed jwb95 closed 5 years ago

jwb95 commented 5 years ago

Hi @chrisdonahue,

when trying to generate audio from my modell using the code from the 'wavegan_generate.ipynb' I run into the following: KeyError: "The name 'G_z_spec:0' refers to a Tensor which does not exist. The operation, 'G_z_spec', does not exist in the graph."

I proceeded like this:

# Load the model
import numpy as np
import tensorflow as tf

tf.reset_default_graph()
saver = tf.train.import_meta_graph('train/infer/infer.meta')
graph = tf.get_default_graph()
sess = tf.InteractiveSession()
saver.restore(sess, 'train/model.ckpt-9925')

which went fine: INFO:tensorflow:Restoring parameters from train/model.ckpt-9925

So I continued:

ngenerate = 64
ndisplay = 4
import PIL.Image
from IPython.display import display, Audio
import time as time

# Sample latent vectors
_z = (np.random.rand(ngenerate, 100) * 2.) - 1.

# Generate
z = graph.get_tensor_by_name('z:0')
G_z = graph.get_tensor_by_name('G_z:0')[:, :, 0]
G_z_spec = graph.get_tensor_by_name('G_z_spec:0')

At the last line it throws the cited error.

Thanks, Joscha

jwb95 commented 5 years ago

Trying this in Jupyter Notebook worked for me now while I still have the same problem on ubuntu.

jwb95 commented 4 years ago

As you can read i was able to ship around it on a mac, but not on ubuntu. I wrote some custom code to do that. Sorry i can't further help from here.