Skip to content

Commit

Permalink
Merge branch 'keras-team:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
hamidriasat authored Jun 18, 2023
2 parents 4fee4db + d0569ec commit f396cc9
Show file tree
Hide file tree
Showing 150 changed files with 9,844 additions and 4,369 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/stale-issues-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Awaiting response issues
uses: actions/stale@v5
with:
days-before-issue-stale: 14
days-before-issue-close: 14
stale-issue-label: "stale"
close-issue-reason: completed
only-labels: "stat:awaiting response from contributor"
stale-issue-message: >
This issue is stale because it has been open for 14 days with no activity.
It will be closed if no further activity occurs. Thank you.
close-issue-message: >
This issue was closed because it has been inactive for 28 days.
Please reopen if you'd like to work on this further.
days-before-pr-stale: 14
days-before-pr-close: 14
stale-pr-message: "This PR is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you."
close-pr-message: "This PR was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further."
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Contribution issues
uses: actions/stale@v5
with:
days-before-issue-stale: 180
days-before-issue-close: 365
stale-issue-label: "stale"
# reason for closed the issue default value is not_planned
close-issue-reason: not_planned
any-of-labels: "stat:contributions welcome,good first issue"
stale-issue-message: >
This issue is stale because it has been open for 180 days with no activity.
It will be closed if no further activity occurs. Thank you.
close-issue-message: >
This issue was closed because it has been inactive for more than 1 year.
repo-token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Author: (could be `Authors`: as well, and may contain markdown links)
Date created: (date in yyyy/mm/dd format)
Last modified: (date in yyyy/mm/dd format)
Description: (one-line text description)
Accelerator: (could be GPU, TPU, or None)
```

To see examples of tutobooks, you can check out any `.py` file in `examples/` or `guides/`.
Expand Down
2 changes: 1 addition & 1 deletion examples/audio/ctc_asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def encode_single_sample(wav_file, label):
"""

batch_size = 32
# Define the trainig dataset
# Define the training dataset
train_dataset = tf.data.Dataset.from_tensor_slices(
(list(df_train["file_name"]), list(df_train["normalized_transcription"]))
)
Expand Down
4 changes: 2 additions & 2 deletions examples/audio/ipynb/ctc_asr.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
"outputs": [],
"source": [
"batch_size = 32\n",
"# Define the trainig dataset\n",
"# Define the training dataset\n",
"train_dataset = tf.data.Dataset.from_tensor_slices(\n",
" (list(df_train[\"file_name\"]), list(df_train[\"normalized_transcription\"]))\n",
")\n",
Expand Down Expand Up @@ -675,4 +675,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
6 changes: 3 additions & 3 deletions examples/audio/ipynb/melgan_spectrogram_inversion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"source": [
"We create a `tf.data.Dataset` to load and process the audio files on the fly.\n",
"The `preprocess()` function takes the file path as input and returns two instances of the\n",
"wave, one for input and one as the ground truth for comparsion. The input wave will be\n",
"wave, one for input and one as the ground truth for comparison. The input wave will be\n",
"mapped to a spectrogram using the custom `MelSpec` layer as shown later in this example."
]
},
Expand Down Expand Up @@ -287,7 +287,7 @@
" \"\"\"Convolutional residual stack with weight normalization.\n",
"\n",
" Args:\n",
" filter: int, determines filter size for the residual stack.\n",
" filters: int, determines filter size for the residual stack.\n",
"\n",
" Returns:\n",
" Residual stack output.\n",
Expand Down Expand Up @@ -860,4 +860,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
8 changes: 4 additions & 4 deletions examples/audio/ipynb/speaker_recognition_using_cnn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
"SHUFFLE_SEED = 43\n",
"\n",
"# The sampling rate to use.\n",
"# This is the one used in all of the audio samples.\n",
"# We will resample all of the noise to this sampling rate.\n",
"# This is the one used in all the audio samples.\n",
"# We will resample all the noise to this sampling rate.\n",
"# This will also be the output size of the audio wave samples\n",
"# (since all samples are of 1 second long)\n",
"SAMPLING_RATE = 16000\n",
Expand Down Expand Up @@ -214,7 +214,7 @@
"In this section:\n",
"\n",
"- We load all noise samples (which should have been resampled to 16000)\n",
"- We split those noise samples to chuncks of 16000 samples which\n",
"- We split those noise samples to chunks of 16000 samples which\n",
"correspond to 1 second duration each"
]
},
Expand Down Expand Up @@ -647,4 +647,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
6 changes: 3 additions & 3 deletions examples/audio/ipynb/transformer_asr.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"position embeddings and token embeddings.\n",
"\n",
"When processing audio features, we apply convolutional layers to downsample\n",
"them (via convolution stides) and process local relationships."
"them (via convolution strides) and process local relationships."
]
},
{
Expand Down Expand Up @@ -610,7 +610,7 @@
" self.lr_after_warmup\n",
" - (epoch - self.warmup_epochs)\n",
" * (self.lr_after_warmup - self.final_lr)\n",
" / (self.decay_epochs),\n",
" / self.decay_epochs,\n",
" )\n",
" return tf.math.minimum(warmup_lr, decay_lr)\n",
"\n",
Expand Down Expand Up @@ -720,4 +720,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
9 changes: 4 additions & 5 deletions examples/audio/ipynb/uk_ireland_accent_recognition.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"# We see that there are 2 compressed files for each accent (except Irish):\n",
"# - One for male speakers\n",
"# - One for female speakers\n",
"# However, we will using a gender agnostic dataset.\n",
"# However, we will be using a gender agnostic dataset.\n",
"\n",
"# List of gender agnostic categories\n",
"gender_agnostic_categories = [\n",
Expand Down Expand Up @@ -145,7 +145,6 @@
"import os\n",
"import io\n",
"import csv\n",
"import random\n",
"import numpy as np\n",
"import pandas as pd\n",
"import tensorflow as tf\n",
Expand Down Expand Up @@ -211,7 +210,7 @@
"[Crowdsourced high-quality UK and Ireland English Dialect speech data set](https://openslr.org/83/)\n",
"which consists of a total of 17,877 high-quality audio wav files.\n",
"\n",
"This dataset includes over 31 hours of recording from 120 vounteers who self-identify as\n",
"This dataset includes over 31 hours of recording from 120 volunteers who self-identify as\n",
"native speakers of Southern England, Midlands, Northern England, Wales, Scotland and Ireland.\n",
"\n",
"For more info, please refer to the above link or to the following paper:\n",
Expand Down Expand Up @@ -243,7 +242,7 @@
" fname=\"line_index_file\", origin=URL_PATH + \"line_index_all.csv\"\n",
")\n",
"\n",
"# Download the list of compressed files that contains the audio wav files\n",
"# Download the list of compressed files that contain the audio wav files\n",
"for i in zip_files:\n",
" fname = zip_files[i].split(\".\")[0]\n",
" url = URL_PATH + zip_files[i]\n",
Expand Down Expand Up @@ -1060,4 +1059,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
12 changes: 6 additions & 6 deletions examples/audio/ipynb/wav2vec2_audiocls.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,16 @@
"source": [
"Before we can feed the audio utterance samples to our model, we need to\n",
"pre-process them. This is done by a Hugging Face Transformers \"Feature Extractor\"\n",
"which will (as the name indicates) re-sample your the inputs to sampling rate\n",
"the the model expects (in-case they exist with a different sampling rate), as well\n",
"which will (as the name indicates) re-sample your inputs to the sampling rate\n",
"the model expects (in-case they exist with a different sampling rate), as well\n",
"as generate the other inputs that model requires.\n",
"\n",
"To do all of this, we instantiate our `Feature Extractor` with the\n",
"`AutoFeatureExtractor.from_pretrained`, which will ensure:\n",
"\n",
"We get a `Feature Extractor` that corresponds to the model architecture we want to use.\n",
"We download the config that was used when pretraining this specific checkpoint.\n",
"This will be cached so it's not downloaded again the next time we run the cell.\n",
"This will be cached so that it's not downloaded again the next time we run the cell.\n",
"\n",
"The `from_pretrained()` method expects the name of a model from the Hugging Face Hub. This is\n",
"exactly similar to `MODEL_CHECKPOINT` and we just pass that.\n",
Expand Down Expand Up @@ -373,7 +373,7 @@
},
"source": [
"We now define our model. To be precise, we define a Wav2Vec 2.0 model and add a\n",
"Classification-Head on top to output a probability ditribution of all classes for each\n",
"Classification-Head on top to output a probability distribution of all classes for each\n",
"input audio sample. Since the model might get complex we first define the Wav2Vec\n",
"2.0 model with Classification-Head as a Keras layer and then build the model using that.\n",
"\n",
Expand Down Expand Up @@ -574,7 +574,7 @@
"Great! Now that we have trained our model, we predict the classes\n",
"for audio samples in the test set using the `model.predict()` method! We see\n",
"the model predictions are not that great as it has been trained on a very small\n",
"number of samples for just 1 epoch. For best results, we reccomend training on\n",
"number of samples for just 1 epoch. For best results, we recommend training on\n",
"the complete dataset for at least 5 epochs!"
]
},
Expand Down Expand Up @@ -623,7 +623,7 @@
"colab_type": "text"
},
"source": [
"Now you can push this model to Hugging Face Model Hub and also share it with with all your friends,\n",
"Now you can push this model to Hugging Face Model Hub and also share it with all your friends,\n",
"family, favorite pets: they can all load it with the identifier\n",
"`\"your-username/the-name-you-picked\"`, for instance:\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/audio/md/ctc_asr.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ appeared in the input.

```python
batch_size = 32
# Define the trainig dataset
# Define the training dataset
train_dataset = tf.data.Dataset.from_tensor_slices(
(list(df_train["file_name"]), list(df_train["normalized_transcription"]))
)
Expand Down
4 changes: 2 additions & 2 deletions examples/audio/md/melgan_spectrogram_inversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ LJSpeech-1.1.tar.bz 100%[===================>] 2.56G 68.3MB/s in 36s

We create a `tf.data.Dataset` to load and process the audio files on the fly.
The `preprocess()` function takes the file path as input and returns two instances of the
wave, one for input and one as the ground truth for comparsion. The input wave will be
wave, one for input and one as the ground truth for comparison. The input wave will be
mapped to a spectrogram using the custom `MelSpec` layer as shown later in this example.


Expand Down Expand Up @@ -240,7 +240,7 @@ def residual_stack(input, filters):
"""Convolutional residual stack with weight normalization.
Args:
filter: int, determines filter size for the residual stack.
filters: int, determines filter size for the residual stack.
Returns:
Residual stack output.
Expand Down
6 changes: 3 additions & 3 deletions examples/audio/md/speaker_recognition_using_cnn.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ VALID_SPLIT = 0.1
SHUFFLE_SEED = 43

# The sampling rate to use.
# This is the one used in all of the audio samples.
# We will resample all of the noise to this sampling rate.
# This is the one used in all the audio samples.
# We will resample all the noise to this sampling rate.
# This will also be the output size of the audio wave samples
# (since all samples are of 1 second long)
SAMPLING_RATE = 16000
Expand Down Expand Up @@ -167,7 +167,7 @@ for folder in os.listdir(DATASET_ROOT):
In this section:

- We load all noise samples (which should have been resampled to 16000)
- We split those noise samples to chuncks of 16000 samples which
- We split those noise samples to chunks of 16000 samples which
correspond to 1 second duration each


Expand Down
4 changes: 2 additions & 2 deletions examples/audio/md/transformer_asr.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ When processing past target tokens for the decoder, we compute the sum of
position embeddings and token embeddings.

When processing audio features, we apply convolutional layers to downsample
them (via convolution stides) and process local relationships.
them (via convolution strides) and process local relationships.


```python
Expand Down Expand Up @@ -511,7 +511,7 @@ class CustomSchedule(keras.optimizers.schedules.LearningRateSchedule):
self.lr_after_warmup
- (epoch - self.warmup_epochs)
* (self.lr_after_warmup - self.final_lr)
/ (self.decay_epochs),
/ self.decay_epochs,
)
return tf.math.minimum(warmup_lr, decay_lr)

Expand Down
Loading

0 comments on commit f396cc9

Please sign in to comment.