Phil Glau
Phil Glau

Reputation: 439

Anaconda install of Tensorflow missing 'audio_ops' from contrib framework

I'm trying to follow along the Audio Recognition Network tutorial.

I've created an Anaconda environment with python 3.6 and followed the install instruction accordingly for installing the GPU whl.

I can run the 'hello world' TF example.

When I go to run 'train.py' in the Audio Recognition Network tutorial/example, I get:

Traceback (most recent call last):
  File "train.py", line 79, in <module>
    import input_data
  File "/home/philglau/speech_commands/input_data.py", line 35, in <module>
    from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
ImportError: cannot import name 'audio_ops'

The code in the tutorial that fails is:

from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio

I then backed up that chain until I could import some part of it:

import tensorflow.contrib.framework as test ==> works
import tensorflow.contrib.framework.python as test --> fail: 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow.contrib.framework' has no attribute 'python'

Not sure where I'm going wrong on my install.

Details:

Ubuntu 16.04
Anaconda env with python 3.6
Followed the 'anaconda' instruction on the TF install page. (GPU version)

I also tried using a python 2.7 env for anaconda but got the same results.

Upvotes: 7

Views: 3931

Answers (2)

Cameron
Cameron

Reputation: 931

It looks like they're releasing the audio_ops modules in version 1.4 (https://github.com/tensorflow/tensorflow/issues/11339#issuecomment-327879009).

Until v1.4 is released, an easy way around this is to install the nightly tensorflow build

pip install tf-nightly

or with the docker image linked in the issue comment.

Upvotes: 7

J.Laffitte
J.Laffitte

Reputation: 21

The short answer: The framework is missing the "audio_ops.py" and the example wont work until the file is released. Or you code the wrappers.

More on this: If you go to the: tensorflow.contrib.framework.python.ops local folder you can find other *_ops.py files but not the "audio_ops.py".

If you get it from the Master at: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/framework/python/ops

You will find the file is almost empty and with import labels wrong: "audio_ops" vs "gen_audio_ops". With almost empty I mean that: decode_wav, encode_wav, audio_spectrogram , mfcc are not implemented/wrapped.

So, no working example and no fun. We need to check again when "audio_ops.py" is released.

Here: https://github.com/tensorflow/tensorflow/issues/11339 You can find a Developer saying: "we don't actually want to make them public / supported yet. I'm sorry this decision wasn't better documented"

Upvotes: 2

Related Questions