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

Trying to build docs with a new notebook I have created but getting AttributeError from the audio.ipynb tutorial #1082

Open
mturk24 opened this issue Apr 4, 2024 · 1 comment
Labels
bug Something isn't working help-wanted We need your help to add this, but it may be more challenging than a "good first issue"

Comments

@mturk24
Copy link
Contributor

mturk24 commented Apr 4, 2024

When trying to build the docs in the following way in the cleanlab dir:

sphinx-build docs/source cleanlab-docs

I get the error shown below for the tutorial audio.ipynb

Stack trace

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[7], line 2
      1 wav_file_name_example = "spoken_digits/free-spoken-digit-dataset-1.0.9/recordings/7_jackson_43.wav"  # change this to hear other examples
----> 2 display_example(wav_file_name_example)

Cell In[6], line 19, in display_example(wav_file_name, audio_rate)
     17 def display_example(wav_file_name, audio_rate=16000):
     18     """Allows us to listen to any wav file and displays its given label in the dataset."""
---> 19     wav_file_example = load_wav_16k_mono(wav_file_name)
     20     label = Path(wav_file_name).parts[-1].split("_")[0]
     21     print(f"Given label for this example: {label}")

File ~/mturk-work/mturk-env/lib/python3.11/site-packages/tensorflow/python/util/traceback_utils.py:153, in filter_traceback.<locals>.error_handler(*args, **kwargs)
    151 except Exception as e:
    152   filtered_tb = _process_traceback_frames(e.__traceback__)
--> 153   raise e.with_traceback(filtered_tb) from None
    154 finally:
    155   del filtered_tb

File /var/folders/9h/mkx7lrxd0xl_61j26qb0jlh00000gn/T/__autograph_generated_file6qlzt11q.py:15, in outer_factory.<locals>.inner_factory.<locals>.tf__load_wav_16k_mono(filename)
     13 wav = ag__.converted_call(ag__.ld(tf).squeeze, (ag__.ld(wav),), dict(axis=-1), fscope)
     14 sample_rate = ag__.converted_call(ag__.ld(tf).cast, (ag__.ld(sample_rate),), dict(dtype=ag__.ld(tf).int64), fscope)
---> 15 wav = ag__.converted_call(ag__.ld(tfio).audio.resample, (ag__.ld(wav),), dict(rate_in=ag__.ld(sample_rate), rate_out=16000), fscope)
     16 try:
     17     do_return = True

File /var/folders/9h/mkx7lrxd0xl_61j26qb0jlh00000gn/T/__autograph_generated_filem70jb8tp.py:77, in outer_factory.<locals>.inner_factory.<locals>.tf__resample(input, rate_in, rate_out, name)
     75             raise
     76         return fscope_4.ret(retval__4, do_return_4)
---> 77 value = ag__.converted_call(ag__.ld(tf).vectorized_map, (ag__.ld(f), ag__.ld(input)), None, fscope)
     79 @ag__.autograph_artifact
     80 def g1():
     81     with ag__.FunctionScope('g1', 'fscope_5', ag__.STD) as fscope_5:

File /var/folders/9h/mkx7lrxd0xl_61j26qb0jlh00000gn/T/__autograph_generated_filem70jb8tp.py:72, in outer_factory.<locals>.inner_factory.<locals>.tf__resample.<locals>.f(i)
     70 try:
     71     do_return_4 = True
---> 72     retval__4 = ag__.converted_call(ag__.ld(core_ops).io_audio_resample, (ag__.ld(i),), dict(rate_in=ag__.ld(rate_in), rate_out=ag__.ld(rate_out), name=ag__.ld(name)), fscope_4)
     73 except:
     74     do_return_4 = False

File ~/mturk-work/mturk-env/lib/python3.11/site-packages/tensorflow_io/python/ops/__init__.py:88, in LazyLoader.__getattr__(self, attrb)
     87 def __getattr__(self, attrb):
---> 88     return getattr(self._load(), attrb)

AttributeError: in user code:

    File "/var/folders/9h/mkx7lrxd0xl_61j26qb0jlh00000gn/T/ipykernel_30954/1909591269.py", line 13, in load_wav_16k_mono  *
        wav = tfio.audio.resample(wav, rate_in=sample_rate, rate_out=16000)
    File "/Users/mturk/mturk-work/mturk-env/lib/python3.11/site-packages/tensorflow_io/python/ops/audio_ops.py", line 466, in f  *
        i, rate_in=rate_in, rate_out=rate_out, name=name
    File "/Users/mturk/mturk-work/mturk-env/lib/python3.11/site-packages/tensorflow_io/python/ops/__init__.py", line 88, in __getattr__
        return getattr(self._load(), attrb)

    AttributeError: module '77ab628d7ad4acaa62f6bde524b9d631895821c9' has no attribute 'io_audio_resample'


Steps to reproduce

You can try to build the docs - I also tried to make sure the tensorflow-io package was up-to-date and it already was.

pip install --upgrade tensorflow-io

I also have previously seen a fix for this involves ignoring notebooks when building docs:

export SKIP_NOTEBOOKS=1

However I actually want to build all of the notebooks this time.

Additional information

My cleanlab version is 2.6.1

@jwmueller
Copy link
Member

@mturk24 you can temporarily just delete this broken notebook from your local git (just don't accidentally commit the deleted file) and should be able to build the rest of the docs without this notebook

@jwmueller jwmueller added the help-wanted We need your help to add this, but it may be more challenging than a "good first issue" label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help-wanted We need your help to add this, but it may be more challenging than a "good first issue"
Projects
None yet
Development

No branches or pull requests

2 participants