我正在尝试使用 Google Colab遵循此处的代码,但出现错误:
ValueError The passed save_path is not a valid checkpoint.
我已将 TensorFlow 模型下载到谷歌驱动器(可以在此处找到),它适用于使用以下代码的编码阶段:
import os
import numpy as np
import matplotlib.pyplot as plt
from magenta.models.nsynth import utils
from magenta.models.nsynth.wavenet import fastgen
from IPython.display import Audio
%matplotlib inline
%config InlineBackend.figure_format = 'jpg'
model_fp='/content/drive/MyDrive/Piano Samples/wavenet-ckpt/model.ckpt-200000'
fname='/content/drive/MyDrive/Piano Samples/Samples/9000ftPiano OH RT G0 3.wav'
sr=44100
audio = utils.load_audio(fname, sample_length=80000, sr=sr)
sample_length = audio.shape[0]
encoding = fastgen.encode(audio, model_fp, sample_length)
fig, axs = plt.subplots(2, 1, figsize=(10, 5))
axs[0].plot(audio);
axs[0].set_title('Audio Signal')
axs[1].plot(encoding[0]);
axs[1].set_title('NSynth Encoding')
但是,一旦我添加了解码步骤:
fastgen.synthesize(encoding, save_paths=[ '/content/drive/MyDrive/Piano Samples/gen.wav'], samples_per_save=sample_length)
我得到了错误the model checkpoint can't be found
,但除非我快疯了,否则我不得不在编码步骤中使用该模型,它工作得很好。