Skip to content

Commit

Permalink
Unexport models that are not in the 0.6 release (#1125)
Browse files Browse the repository at this point in the history
This change will not affect the master branch, where they will
continued to be exported. For the release branch we will not yet
export or document these models.

Though all of these models are coming soon!
  • Loading branch information
mattdangerw authored Jul 10, 2023
1 parent 03668b8 commit a6b43a1
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 30 deletions.
3 changes: 1 addition & 2 deletions keras_nlp/models/bart/bart_backbone.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import copy

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.layers.modeling.position_embedding import PositionEmbedding
from keras_nlp.layers.modeling.transformer_decoder import TransformerDecoder
Expand All @@ -30,7 +29,7 @@ def bart_kernel_initializer(stddev=0.02):
return keras.initializers.TruncatedNormal(stddev=stddev)


@keras_nlp_export("keras_nlp.models.BartBackbone")
@keras.saving.register_keras_serializable(package="keras_nlp")
class BartBackbone(Backbone):
"""BART encoder-decoder network.
Expand Down
4 changes: 2 additions & 2 deletions keras_nlp/models/bart/bart_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import copy

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.layers.preprocessing.start_end_packer import StartEndPacker
from keras_nlp.models.bart.bart_presets import backbone_presets
from keras_nlp.models.bart.bart_tokenizer import BartTokenizer
Expand All @@ -27,7 +27,7 @@
from keras_nlp.utils.python_utils import classproperty


@keras_nlp_export("keras_nlp.models.BartPreprocessor")
@keras.saving.register_keras_serializable(package="keras_nlp")
class BartPreprocessor(Preprocessor):
"""A BART preprocessing layer which tokenizes and packs inputs.
Expand Down
3 changes: 1 addition & 2 deletions keras_nlp/models/bart/bart_seq_2_seq_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import copy

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.backend import ops
from keras_nlp.models.bart.bart_backbone import BartBackbone
Expand All @@ -41,7 +40,7 @@ def compute_output_shape(self, input_shape):
return (input_shape[0],) + (self.embedding.embeddings.shape[0],)


@keras_nlp_export("keras_nlp.models.BartSeq2SeqLM")
@keras.saving.register_keras_serializable(package="keras_nlp")
class BartSeq2SeqLM(GenerativeTask):
"""An end-to-end BART model for seq2seq language modeling.
Expand Down
4 changes: 2 additions & 2 deletions keras_nlp/models/bart/bart_seq_2_seq_lm_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import tensorflow as tf
from absl import logging

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.backend import ops
from keras_nlp.models.bart.bart_preprocessor import BartPreprocessor
from keras_nlp.models.bart.bart_presets import backbone_presets
Expand All @@ -30,7 +30,7 @@
from keras_nlp.utils.python_utils import classproperty


@keras_nlp_export("keras_nlp.models.BartSeq2SeqLMPreprocessor")
@keras.saving.register_keras_serializable(package="keras_nlp")
class BartSeq2SeqLMPreprocessor(BartPreprocessor):
"""BART Seq2Seq LM preprocessor.
Expand Down
4 changes: 2 additions & 2 deletions keras_nlp/models/bart/bart_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

import copy

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.models.bart.bart_presets import backbone_presets
from keras_nlp.tokenizers.byte_pair_tokenizer import BytePairTokenizer
from keras_nlp.utils.python_utils import classproperty


@keras_nlp_export("keras_nlp.models.BartTokenizer")
@keras.saving.register_keras_serializable(package="keras_nlp")
class BartTokenizer(BytePairTokenizer):
"""A BART tokenizer using Byte-Pair Encoding subword segmentation.
Expand Down
3 changes: 1 addition & 2 deletions keras_nlp/models/gpt_neo_x/gpt_neo_x_backbone.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.
from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.models.backbone import Backbone
from keras_nlp.models.gpt_neo_x.gpt_neo_x_decoder import GPTNeoXDecoder
Expand All @@ -22,7 +21,7 @@ def _gpt_neo_x_kernel_initializer(stddev=0.02):
return keras.initializers.RandomNormal(stddev=stddev)


@keras_nlp_export("keras_nlp.models.GPTNeoXBackbone")
@keras.saving.register_keras_serializable(package="keras_nlp")
class GPTNeoXBackbone(Backbone):
"""GPT-NeoX core network with hyperparameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import tensorflow as tf
from absl import logging

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.backend import ops
from keras_nlp.models.gpt_neo_x.gpt_neo_x_preprocessor import (
GPTNeoXPreprocessor,
Expand All @@ -28,7 +28,7 @@
from keras_nlp.utils.keras_utils import pack_x_y_sample_weight


@keras_nlp_export("keras_nlp.models.GPTNeoXCausalLMPreprocessor")
@keras.saving.register_keras_serializable(package="keras_nlp")
class GPTNeoXCausalLMPreprocessor(GPTNeoXPreprocessor):
"""GPTNeoX Causal LM preprocessor.
Expand Down
4 changes: 2 additions & 2 deletions keras_nlp/models/gpt_neo_x/gpt_neo_x_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

"""GPTNeoX preprocessor layer."""
from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.layers.preprocessing.start_end_packer import StartEndPacker
from keras_nlp.models.gpt_neo_x.gpt_neo_x_tokenizer import GPTNeoXTokenizer
from keras_nlp.models.preprocessor import Preprocessor
Expand All @@ -24,7 +24,7 @@
from keras_nlp.utils.python_utils import classproperty


@keras_nlp_export("keras_nlp.models.GPTNeoXPreprocessor")
@keras.saving.register_keras_serializable(package="keras_nlp")
class GPTNeoXPreprocessor(Preprocessor):
"""GPTNeoX preprocessing layer which tokenizes and packs inputs.
Expand Down
4 changes: 2 additions & 2 deletions keras_nlp/models/gpt_neo_x/gpt_neo_x_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
# limitations under the License.
"""GptNeoX tokenizer"""

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.tokenizers.byte_pair_tokenizer import BytePairTokenizer


@keras_nlp_export("keras_nlp.models.GPTNeoXTokenizer")
@keras.saving.register_keras_serializable(package="keras_nlp")
class GPTNeoXTokenizer(BytePairTokenizer):
"""A GPTNeoX tokenizer using Byte-Pair Encoding subword segmentation.
Expand Down
3 changes: 1 addition & 2 deletions keras_nlp/models/t5/t5_backbone.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

"""T5 backbone model."""

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.models.backbone import Backbone
from keras_nlp.models.t5.t5_layer_norm import T5LayerNorm
Expand All @@ -23,7 +22,7 @@
from keras_nlp.utils.tensor_utils import assert_tf_backend


@keras_nlp_export("keras_nlp.models.T5Backbone")
@keras.saving.register_keras_serializable(package="keras_nlp")
class T5Backbone(Backbone):
"""T5 encoder-decoder backbone model.
Expand Down
4 changes: 2 additions & 2 deletions keras_nlp/models/t5/t5_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

"""T5 tokenizer."""

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.tokenizers.sentence_piece_tokenizer import SentencePieceTokenizer


@keras_nlp_export("keras_nlp.models.T5Tokenizer")
@keras.saving.register_keras_serializable(package="keras_nlp")
class T5Tokenizer(SentencePieceTokenizer):
"""T5 tokenizer layer based on SentencePiece.
Expand Down
3 changes: 1 addition & 2 deletions keras_nlp/models/whisper/whisper_audio_feature_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@
import numpy as np
import tensorflow as tf

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.models.whisper.whisper_presets import backbone_presets
from keras_nlp.utils.python_utils import classproperty
from keras_nlp.utils.python_utils import format_docstring


@keras_nlp_export("keras_nlp.models.WhisperAudioFeatureExtractor")
@keras.saving.register_keras_serializable(package="keras_nlp")
class WhisperAudioFeatureExtractor(keras.layers.Layer):
"""
Whisper audio feature extractor layer.
Expand Down
3 changes: 1 addition & 2 deletions keras_nlp/models/whisper/whisper_backbone.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import copy

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.backend import ops
from keras_nlp.layers.modeling.position_embedding import PositionEmbedding
Expand All @@ -39,7 +38,7 @@ def call(self, x):
return ops.pad(x, [[0, 0], [1, 1], [0, 0]])


@keras_nlp_export("keras_nlp.models.WhisperBackbone")
@keras.saving.register_keras_serializable(package="keras_nlp")
class WhisperBackbone(Backbone):
"""A Whisper encoder-decoder network for speech.
Expand Down
3 changes: 1 addition & 2 deletions keras_nlp/models/whisper/whisper_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import tensorflow as tf
from absl import logging

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.layers.preprocessing.start_end_packer import StartEndPacker
from keras_nlp.models.preprocessor import Preprocessor
Expand All @@ -35,7 +34,7 @@
from keras_nlp.utils.python_utils import format_docstring


@keras_nlp_export("keras_nlp.models.WhisperPreprocessor")
@keras.saving.register_keras_serializable(package="keras_nlp")
class WhisperPreprocessor(Preprocessor):
"""A Whisper preprocessing layer which handles audio and text input.
Expand Down
4 changes: 2 additions & 2 deletions keras_nlp/models/whisper/whisper_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import copy
import json

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import keras
from keras_nlp.models.whisper.whisper_presets import backbone_presets
from keras_nlp.tokenizers.byte_pair_tokenizer import BytePairTokenizer
from keras_nlp.utils.python_utils import classproperty
Expand All @@ -29,7 +29,7 @@ def _load_dict(dict_or_path):
return dict_or_path


@keras_nlp_export("keras_nlp.models.WhisperTokenizer")
@keras.saving.register_keras_serializable(package="keras_nlp")
class WhisperTokenizer(BytePairTokenizer):
"""Whisper text tokenizer using Byte-Pair Encoding subword segmentation.
Expand Down

0 comments on commit a6b43a1

Please sign in to comment.