Skip to content

Commit 857530a

Browse files
committed
Reformat a bunch of files.
1 parent ad660cf commit 857530a

File tree

103 files changed

+123
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+123
-19
lines changed

examples/audio/speaker_recognition_using_cnn.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Accelerator: GPU
88
Converted to Keras 3 by: [Fadi Badine](https://twitter.com/fadibadine)
99
"""
10+
1011
"""
1112
## Introduction
1213

examples/audio/transformer_asr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Training a sequence-to-sequence Transformer for automatic speech recognition.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/generative/adain.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Neural Style Transfer with Adaptive Instance Normalization.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
# Introduction
1112

examples/generative/conditional_gan.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Training a GAN conditioned on class labels to generate handwritten digits.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
Generative Adversarial Networks (GANs) let us generate novel image data, video data,
1112
or audio data from a random input. Typically, the random input is sampled

examples/generative/dcgan_overriding_train_step.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: A simple DCGAN trained using `fit()` by overriding `train_step` on CelebA images.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Setup
1112
"""

examples/generative/deep_dream.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Generating Deep Dreams with Keras.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/generative/dreambooth.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Implementing DreamBooth.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/generative/finetune_stable_diffusion.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Fine-tuning Stable Diffusion using a custom image-caption dataset.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/generative/gan_ada.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Generating images from limited data using the Caltech Birds dataset.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/generative/gaugan.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Implementing a GauGAN for conditional image generation.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/generative/lstm_character_level_text_generation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Generate text from Nietzsche's writings with a character-level LSTM.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/generative/molecule_generation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Implementing a Convolutional Variational AutoEncoder (VAE) for Drug Discovery.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/generative/stylegan.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Implementation of StyleGAN for image generation.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/generative/text_generation_fnet.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: FNet transformer for text generation in Keras.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/generative/text_generation_with_miniature_gpt.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Implement a miniature version of GPT and train it to generate text.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/generative/vq_vae.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Training a VQ-VAE for image reconstruction and codebook sampling for generation.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
In this example, we develop a Vector Quantized Variational Autoencoder (VQ-VAE).
1112
VQ-VAE was proposed in

examples/graph/gat_node_classification.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: An implementation of a Graph Attention Network (GAT) for node classification.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/graph/mpnn-molecular-graphs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Implementation of an MPNN to predict blood-brain barrier permeability.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/keras_recipes/antirectifier.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Demonstration of custom layer creation.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/keras_recipes/better_knowledge_distillation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Training better student models via knowledge distillation with function matching.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/keras_recipes/reproducibility_recipes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Demonstration of random weight initialization and reproducibility in Keras models.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/keras_recipes/sklearn_metric_callbacks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: This example shows how to use Keras callbacks to evaluate and export non-TensorFlow based metrics.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/keras_recipes/subclassing_conv_layers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: This example shows how to implement custom convolution layers using the `Conv.convolution_op()` API.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/keras_recipes/tensorflow_numpy_models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Overview of how to use the TensorFlow NumPy API to write Keras models.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/keras_recipes/tfrecord.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Loading TFRecords for computer vision models.
77
Accelerator: TPU
88
"""
9+
910
"""
1011
## Introduction + Set Up
1112

examples/keras_recipes/trainer_pattern.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Guide on how to share a custom training step across multiple Keras models.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/nlp/active_learning_review_classification.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Demonstrating the advantages of active learning through review classification.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/nlp/bidirectional_lstm_imdb.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Train a 2-layer bidirectional LSTM on the IMDB movie review sentiment classification dataset.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Setup
1112
"""

examples/nlp/lstm_seq2seq.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Character-level recurrent sequence-to-sequence model.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/nlp/masked_language_modeling.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Implement a Masked Language Model (MLM) with BERT and fine-tune it on the IMDB Reviews dataset.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112
@@ -196,9 +197,9 @@ def get_masked_input_and_labels(encoded_texts):
196197
# Set input to [MASK] which is the last token for the 90% of tokens
197198
# This means leaving 10% unchanged
198199
inp_mask_2mask = inp_mask & (np.random.rand(*encoded_texts.shape) < 0.90)
199-
encoded_texts_masked[
200-
inp_mask_2mask
201-
] = mask_token_id # mask token is the last in the dict
200+
encoded_texts_masked[inp_mask_2mask] = (
201+
mask_token_id # mask token is the last in the dict
202+
)
202203

203204
# Set 10% to a random token
204205
inp_mask_2random = inp_mask_2mask & (np.random.rand(*encoded_texts.shape) < 1 / 9)
@@ -293,9 +294,11 @@ def bert_module(query, key, value, i):
293294
def get_pos_encoding_matrix(max_len, d_emb):
294295
pos_enc = np.array(
295296
[
296-
[pos / np.power(10000, 2 * (j // 2) / d_emb) for j in range(d_emb)]
297-
if pos != 0
298-
else np.zeros(d_emb)
297+
(
298+
[pos / np.power(10000, 2 * (j // 2) / d_emb) for j in range(d_emb)]
299+
if pos != 0
300+
else np.zeros(d_emb)
301+
)
299302
for pos in range(max_len)
300303
]
301304
)

examples/nlp/mlm_training_tpus.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Train a masked language model on TPUs using 🤗 Transformers.
77
Accelerator: TPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/nlp/multi_label_classification.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Implementing a large-scale multi-label text classification model.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/nlp/multimodal_entailment.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Training a multimodal model for predicting entailment.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/nlp/ner_transformers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: NER using the Transformers and data from CoNLL 2003 shared task.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/nlp/neural_machine_translation_with_transformer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Implementing a sequence-to-sequence Transformer and training it on a machine translation task.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/nlp/question_answering.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Question answering implementation using Keras and Hugging Face Transformers.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction to Question Answering
1112

examples/nlp/semantic_similarity_with_bert.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Natural Language Inference by fine-tuning BERT model on SNLI Corpus.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/nlp/text_classification_from_scratch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Text sentiment classification starting from raw text files.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/nlp/text_classification_with_transformer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Accelerator: GPU
88
Converted to Keras 3 by: [Sitam Meur](https://github.com/sitamgithub-MSIT)
99
"""
10+
1011
"""
1112
## Setup
1213
"""

examples/nlp/text_extraction_with_bert.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Fine tune pretrained BERT from HuggingFace Transformers on SQuAD.
77
Accelerator: TPU
88
"""
9+
910
"""
1011
## Introduction
1112

examples/rl/actor_critic_cartpole.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Implement Actor Critic Method in CartPole environment.
77
Accelerator: NONE
88
"""
9+
910
"""
1011
## Introduction
1112

examples/rl/ddpg_pendulum.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Implementing DDPG algorithm on the Inverted Pendulum Problem.
77
Accelerator: NONE
88
"""
9+
910
"""
1011
## Introduction
1112

examples/rl/deep_q_network_breakout.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Play Atari Breakout with a Deep Q-Network.
77
Accelerator: NONE
88
"""
9+
910
"""
1011
## Introduction
1112

examples/structured_data/classification_with_grn_and_vsn.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,12 @@
194194
)
195195
# Feature default values.
196196
COLUMN_DEFAULTS = [
197-
[0.0]
198-
if feature_name in NUMERIC_FEATURE_NAMES + [TARGET_FEATURE_NAME, WEIGHT_COLUMN_NAME]
199-
else ["NA"]
197+
(
198+
[0.0]
199+
if feature_name
200+
in NUMERIC_FEATURE_NAMES + [TARGET_FEATURE_NAME, WEIGHT_COLUMN_NAME]
201+
else ["NA"]
202+
)
200203
for feature_name in CSV_HEADER
201204
]
202205

examples/structured_data/collaborative_filtering_movielens.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Description: Recommending movies using a model trained on Movielens dataset.
77
Accelerator: GPU
88
"""
9+
910
"""
1011
## Introduction
1112

0 commit comments

Comments
 (0)