Skip to content

Commit be18b9a

Browse files
Add TF-free impls of SentencePieceTokenizer, BytePairTokenizer, StartEndPacker and MultiSegmentPacker (#2557)
* TF-text free version of `SentencePieceTokenizer`, `BytePairTokenizer`, `StartEndPacker`, `MultiSegmentPacker` and `CausalLMPreprocessor`. * Fix formatting. * Address gemini-code-assist comments. * Address Gemini's comments. * Address Gemini's comments. * Address Gemini's comments.
1 parent 05e1d9f commit be18b9a

22 files changed

Lines changed: 2679 additions & 1 deletion

keras_hub/api/layers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
since your modifications would be overwritten.
55
"""
66

7+
from keras_hub.layers import v2 as v2
78
from keras_hub.src.layers.modeling.alibi_bias import AlibiBias as AlibiBias
89
from keras_hub.src.layers.modeling.anchor_generator import (
910
AnchorGenerator as AnchorGenerator,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""DO NOT EDIT.
2+
3+
This file was autogenerated. Do not edit it by hand,
4+
since your modifications would be overwritten.
5+
"""
6+
7+
from keras_hub.src.layers.preprocessing.v2.multi_segment_packer import (
8+
MultiSegmentPacker as MultiSegmentPacker,
9+
)
10+
from keras_hub.src.layers.preprocessing.v2.start_end_packer import (
11+
StartEndPacker as StartEndPacker,
12+
)

keras_hub/api/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
since your modifications would be overwritten.
55
"""
66

7+
from keras_hub.models import v2 as v2
78
from keras_hub.src.models.albert.albert_backbone import (
89
AlbertBackbone as AlbertBackbone,
910
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""DO NOT EDIT.
2+
3+
This file was autogenerated. Do not edit it by hand,
4+
since your modifications would be overwritten.
5+
"""
6+
7+
from keras_hub.src.models.v2.causal_lm_preprocessor import (
8+
CausalLMPreprocessor as CausalLMPreprocessor,
9+
)

keras_hub/api/tokenizers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,4 @@
146146
from keras_hub.src.tokenizers.word_piece_tokenizer_trainer import (
147147
compute_word_piece_vocabulary as compute_word_piece_vocabulary,
148148
)
149+
from keras_hub.tokenizers import v2 as v2
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""DO NOT EDIT.
2+
3+
This file was autogenerated. Do not edit it by hand,
4+
since your modifications would be overwritten.
5+
"""
6+
7+
from keras_hub.src.tokenizers.v2.byte_pair_tokenizer import (
8+
BytePairTokenizer as BytePairTokenizer,
9+
)
10+
from keras_hub.src.tokenizers.v2.sentence_piece_tokenizer import (
11+
SentencePieceTokenizer as SentencePieceTokenizer,
12+
)

keras_hub/src/layers/preprocessing/v2/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)