Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError when importing #37

Open
katrin-ibrahim opened this issue May 22, 2022 · 1 comment
Open

ModuleNotFoundError when importing #37

katrin-ibrahim opened this issue May 22, 2022 · 1 comment

Comments

@katrin-ibrahim
Copy link

ModuleNotFoundError Traceback (most recent call last)
in ()
32 import librosa, librosa.display
33 from audiomentations import Compose, AddGaussianNoise, FrequencyMask, TimeStretch, PitchShift, Shift
---> 34 from specAugment import spec_augment_tensorflow
35 import IPython
36 import soundfile as sf

/usr/local/lib/python3.7/dist-packages/specAugment/spec_augment_tensorflow.py in ()
39 import librosa.display
40 import tensorflow as tf
---> 41 from tensorflow.contrib.image import sparse_image_warp
42 import numpy as np
43 import random

ModuleNotFoundError: No module named 'tensorflow.contrib'

@rockamondo
Copy link

rockamondo commented Jun 16, 2022

this code is using an older version of tensorflow, here are some edits i made to spec_augment_tensorflow.py to make it compatible with tensorflow 2.9.1:

change line 40 import statement "import tensorflow as tf" to "import tensorflow.compat.v1 as tf"
change line 41 import statement "from tensorflow.contrib.image import sparse_image_warp" to "from tensorflow_addons.image import sparse_image_warp"

This still threw an error about "eager execution" wrt the "placeholder" function when trying to run the "spec_augment" function. I fixed it by inserting the command "tf.disable_eager_execution" on line 75 before the call of the placeholder function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants