magenta / magenta-demos

Demonstrations of Magenta Models
Apache License 2.0
1.32k stars 419 forks source link

Nsynth generate.py "operands could not be broadcast together with shapes" #87

Closed jeffkile closed 4 years ago

jeffkile commented 4 years ago

I'm getting this error when running the generate.py script

Interpolating embeddings between instruments at each pitch...
generate.py:80: DeprecationWarning: object of type <class 'float'> cannot be safely interpreted as an integer.
  x, y = np.meshgrid(np.linspace(0, grid_size, res+1), np.linspace(0, grid_size, res+1))
Traceback (most recent call last):
  File "generate.py", line 279, in <module>
    interpolate_embeddings()
  File "generate.py", line 124, in interpolate_embeddings
    interp = (embeddings.T * weights).T.sum(axis=0)
  File "~/Coding/nsynth/VIRTUAL/lib/python3.7/site-packages/numpy/core/_methods.py", line 36, in _sum
    return umr_sum(a, axis, dtype, out, keepdims, initial)
ValueError: operands could not be broadcast together with shapes (116,16) (125,16)

This is my settings.json

{
        "instruments": [
                ["harp","guitar"],
                ["flute", "trumpet"]
        ],
        "checkpoint_dir":"~/Downloads/wavenet-ckpt",
        "pitches":      [24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68],
        "resolution":              9,
        "final_length":            64000,
        "gpus":                    1,
        "batch_size_embeddings":   32,
        "batch_size_generate":     256,
        "name":         "test_1"
}

I'm using: python 3.7.6 numpy 1.16.0 tensorflow 1.15.3 magenta 1.3.1

adarob commented 4 years ago

@JCBrouwer PTAL