Skip to content

Commit

Permalink
Doc fixes (keras-team#1530)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdangerw authored and abuelnasr0 committed Apr 2, 2024
1 parent f8aba3c commit db831d7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion keras_nlp/models/backbone.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def from_config(cls, config):

@classproperty
def presets(cls):
"""List builtin presets for a `Task` subclass."""
"""List built-in presets for a `Task` subclass."""
presets = list_presets(cls)
for subclass in list_subclasses(cls):
presets.update(subclass.presets)
Expand Down
4 changes: 3 additions & 1 deletion keras_nlp/models/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class Preprocessor(PreprocessingLayer):
`(x, y, sample_weight)` tuples. Where `x` contains token id sequences with
some
This class can be subclassed to implement
This class can be subclassed similar to any `keras.layers.Layer`, by
defining `build()`, `call()` and `get_config()` methods. All subclasses
should set the `tokenizer` property on construction.
"""

tokenizer_cls = None
Expand Down
2 changes: 1 addition & 1 deletion keras_nlp/models/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def from_config(cls, config):

@classproperty
def presets(cls):
"""List builtin presets for a `Task` subclass."""
"""List built-in presets for a `Task` subclass."""
presets = list_presets(cls)
# We can also load backbone presets.
if cls.backbone_cls is not None:
Expand Down
2 changes: 1 addition & 1 deletion keras_nlp/tokenizers/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def call(self, inputs, *args, training=None, **kwargs):

@classproperty
def presets(cls):
"""List builtin presets for a `Task` subclass."""
"""List built-in presets for a `Task` subclass."""
presets = list_presets(cls)
for subclass in list_subclasses(cls):
presets.update(subclass.presets)
Expand Down
7 changes: 6 additions & 1 deletion keras_nlp/utils/preset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,19 @@


def register_presets(presets, classes):
"""Register built-in presets for a set of classes.
Note that this is intended only for models and presets shipped in the
library itself.
"""
for preset in presets:
BUILTIN_PRESETS[preset] = presets[preset]
for cls in classes:
BUILTIN_PRESETS_FOR_CLASS[cls][preset] = presets[preset]


def list_presets(cls):
"""Find all registered builtin presets for a class."""
"""Find all registered built-in presets for a class."""
return dict(BUILTIN_PRESETS_FOR_CLASS[cls])


Expand Down

0 comments on commit db831d7

Please sign in to comment.