Skip to content

ADDED- A command to move mini_speech_commands directory so that the simple_audio.ipynb runs #2375

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ya0002
Copy link

@ya0002 ya0002 commented Apr 22, 2025

The current notebook doesn't work after

DATASET_PATH = 'data/mini_speech_commands'

data_dir = pathlib.Path(DATASET_PATH)
if not data_dir.exists():
  tf.keras.utils.get_file(
      'mini_speech_commands.zip',
      origin="http://storage.googleapis.com/download.tensorflow.org/data/mini_speech_commands.zip",
      extract=True,
      cache_dir='.', cache_subdir='data')

The snippet

commands = np.array(tf.io.gfile.listdir(str(data_dir)))
commands = commands[(commands != 'README.md') & (commands != '.DS_Store')]
print('Commands:', commands)

gives the error

---------------------------------------------------------------------------
NotFoundError                             Traceback (most recent call last)
[<ipython-input-5-5c3ad82a2720>](https://localhost:8080/#) in <cell line: 0>()
----> 1 commands = np.array(tf.io.gfile.listdir(str(data_dir)))
      2 commands = commands[(commands != 'README.md') & (commands != '.DS_Store')]
      3 print('Commands:', commands)

[/usr/local/lib/python3.11/dist-packages/tensorflow/python/lib/io/file_io.py](https://localhost:8080/#) in list_directory_v2(path)
    766   """
    767   if not is_directory(path):
--> 768     raise errors.NotFoundError(
    769         node_def=None,
    770         op=None,

NotFoundError: Could not find directory data/mini_speech_commands

This fix moves the mini_speech_commands dir from /content/data/mini_speech_commands_extracted/mini_speech_commands to /content/data/mini_speech_commands.

@ya0002 ya0002 requested a review from a team as a code owner April 22, 2025 11:23
Copy link

Preview

Preview and run these notebook edits with Google Colab: Rendered notebook diffs available on ReviewNB.com.

Format and style

Use the TensorFlow docs notebook tools to format for consistent source diffs and lint for style:
$ python3 -m pip install -U --user git+https://github.com/tensorflow/docs

$ python3 -m tensorflow_docs.tools.nbfmt notebook.ipynb
$ python3 -m tensorflow_docs.tools.nblint --arg=repo:tensorflow/docs notebook.ipynb
If commits are added to the pull request, synchronize your local branch: git pull origin Fix-simple_audio-tutorial-notebook-dataset-dir

@ya0002 ya0002 changed the title ADDED- A command to move mini_speech_commands so that the notebook runs ADDED- A command to move mini_speech_commands directory so that the simple_audio.ipynb runs Apr 22, 2025
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

Successfully merging this pull request may close these issues.

1 participant