Skip to content

Commit

Permalink
Remove file level docstrings (#1222)
Browse files Browse the repository at this point in the history
Pet peeve. These are inconsistent, usually just a rephrase of the file
itself, and keras-core isn't doing them.

Who doesn't like less code?

We can keep out class/function docstrings as the place to focus on.
  • Loading branch information
mattdangerw authored Aug 21, 2023
1 parent 22e21af commit e08ad58
Show file tree
Hide file tree
Showing 232 changed files with 21 additions and 313 deletions.
1 change: 1 addition & 0 deletions keras_nlp/backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import os

Expand Down
1 change: 1 addition & 0 deletions keras_nlp/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os

import pytest
Expand Down
1 change: 0 additions & 1 deletion keras_nlp/layers/modeling/cached_multi_head_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Cached MHA layer based on `keras.layers.MultiHeadAttention`."""

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for CachedMultiHeadAttention."""

from keras_nlp.backend import ops
from keras_nlp.layers.modeling.cached_multi_head_attention import (
Expand Down
3 changes: 0 additions & 3 deletions keras_nlp/layers/modeling/f_net_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""FNet encoder block implementation based on `keras.layers.Layer`."""


from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.backend import ops
Expand Down
1 change: 0 additions & 1 deletion keras_nlp/layers/modeling/f_net_encoder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for FNet Encoder."""

import os

Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/layers/modeling/masked_lm_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Masked Language Model (MaskedLM) head."""

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.backend import ops
Expand Down
1 change: 0 additions & 1 deletion keras_nlp/layers/modeling/masked_lm_head_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for Transformer Encoder."""

import os

Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/layers/modeling/position_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Position embedding implementation based on `keras.layers.Layer`."""

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.backend import ops
Expand Down
1 change: 0 additions & 1 deletion keras_nlp/layers/modeling/position_embedding_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for position embedding layer."""

import os

Expand Down
1 change: 1 addition & 0 deletions keras_nlp/layers/modeling/reversible_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import numpy as np

from keras_nlp.api_export import keras_nlp_export
Expand Down
1 change: 1 addition & 0 deletions keras_nlp/layers/modeling/reversible_embedding_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions keras_nlp/layers/modeling/rotary_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.backend import ops
Expand Down
1 change: 1 addition & 0 deletions keras_nlp/layers/modeling/rotary_embedding_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from keras_nlp.backend import keras
from keras_nlp.backend import ops
from keras_nlp.layers.modeling.rotary_embedding import RotaryEmbedding
Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/layers/modeling/sine_position_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Sinusoidal position embedding layer."""

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.backend import ops
Expand Down
1 change: 0 additions & 1 deletion keras_nlp/layers/modeling/sine_position_encoding_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for Sinusoidal Positional encoding."""

from keras_nlp.backend import keras
from keras_nlp.backend import ops
Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/layers/modeling/token_and_position_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Creates an Embedding Layer and adds Positional Embeddings"""

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.layers.modeling.position_embedding import PositionEmbedding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for TokenAndPositionEmbedding"""

import os

Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/layers/modeling/transformer_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Transformer decoder block implementation based on `keras.layers.Layer`."""

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.backend import ops
Expand Down
1 change: 0 additions & 1 deletion keras_nlp/layers/modeling/transformer_decoder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for Transformer Decoder."""

import os

Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/layers/modeling/transformer_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Transformer encoder block implementation based on `keras.layers.Layer`."""

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.utils.keras_utils import clone_initializer
Expand Down
1 change: 0 additions & 1 deletion keras_nlp/layers/modeling/transformer_encoder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for Transformer Encoder."""

import os

Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/layers/modeling/transformer_layer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

""" Utility functions for `TransformerEncoder` and `TransformerDecoder`."""

from absl import logging

from keras_nlp.backend import ops
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for multi-segment packing."""

import numpy as np

Expand Down
1 change: 1 addition & 0 deletions keras_nlp/layers/preprocessing/random_deletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import random

import tensorflow as tf
Expand Down
1 change: 0 additions & 1 deletion keras_nlp/layers/preprocessing/random_deletion_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for RandomDeletion Layer."""

import tensorflow as tf

Expand Down
1 change: 1 addition & 0 deletions keras_nlp/layers/preprocessing/random_swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import random

import tensorflow as tf
Expand Down
1 change: 0 additions & 1 deletion keras_nlp/layers/preprocessing/random_swap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for RandomSwaps Layer."""

import tensorflow as tf

Expand Down
3 changes: 0 additions & 3 deletions keras_nlp/layers/preprocessing/start_end_packer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for Start End Packer layer."""


import tensorflow as tf

from keras_nlp.layers.preprocessing.start_end_packer import StartEndPacker
Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/metrics/bleu.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""BLEU metric implementation."""

import collections
import math

Expand Down
1 change: 0 additions & 1 deletion keras_nlp/metrics/bleu_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for Bleu."""
import pytest
import tensorflow as tf

Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/metrics/edit_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Edit Distance metric."""

import tensorflow as tf

from keras_nlp.api_export import keras_nlp_export
Expand Down
1 change: 0 additions & 1 deletion keras_nlp/metrics/edit_distance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for EditDistance."""
import pytest
import tensorflow as tf

Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/metrics/perplexity.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Perplexity metric."""

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.backend import ops
Expand Down
1 change: 0 additions & 1 deletion keras_nlp/metrics/perplexity_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for Perplexity."""
from keras_nlp.backend import ops
from keras_nlp.metrics.perplexity import Perplexity
from keras_nlp.tests.test_case import TestCase
Expand Down
3 changes: 0 additions & 3 deletions keras_nlp/metrics/rouge_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""ROUGE metric."""


import tensorflow as tf

from keras_nlp.backend import keras
Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/metrics/rouge_l.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""ROUGE-L metric."""

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.metrics.rouge_base import RougeBase

Expand Down
1 change: 0 additions & 1 deletion keras_nlp/metrics/rouge_l_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for RougeL."""
import tensorflow as tf

from keras_nlp.metrics.rouge_l import RougeL
Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/metrics/rouge_n.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""ROUGE-N metric."""

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.metrics.rouge_base import RougeBase

Expand Down
1 change: 0 additions & 1 deletion keras_nlp/metrics/rouge_n_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for RougeN."""
import pytest
import tensorflow as tf

Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/models/albert/albert_backbone.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""ALBERT backbone model."""

import copy

from keras_nlp.api_export import keras_nlp_export
Expand Down
1 change: 0 additions & 1 deletion keras_nlp/models/albert/albert_backbone_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Test for ALBERT backbone model."""

import os

Expand Down
1 change: 0 additions & 1 deletion keras_nlp/models/albert/albert_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""ALBERT classification model."""

import copy

Expand Down
1 change: 0 additions & 1 deletion keras_nlp/models/albert/albert_classifier_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for ALBERT classification model."""

import io
import os
Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/models/albert/albert_masked_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""ALBERT masked LM model."""

import copy

from keras_nlp.api_export import keras_nlp_export
Expand Down
2 changes: 0 additions & 2 deletions keras_nlp/models/albert/albert_masked_lm_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""ALBERT masked language model preprocessor layer."""

from absl import logging

from keras_nlp.api_export import keras_nlp_export
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for ALBERT masked language model preprocessor layer."""

import io

Expand Down
Loading

0 comments on commit e08ad58

Please sign in to comment.