Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default name of Bert instance to "backbone" #397

Merged
merged 4 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions keras_nlp/models/bert/bert_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def __init__(
dropout=0.1,
max_sequence_length=512,
num_segments=2,
name="encoder",
jbischof marked this conversation as resolved.
Show resolved Hide resolved
**kwargs,
):

Expand Down Expand Up @@ -183,6 +184,7 @@ def __init__(
"sequence_output": sequence_output,
"pooled_output": pooled_output,
},
name=name,
**kwargs,
)
# All references to `self` below this line
Expand Down
3 changes: 1 addition & 2 deletions keras_nlp/models/bert/bert_models_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def setUp(self):
hidden_dim=64,
intermediate_dim=128,
max_sequence_length=128,
name="encoder",
)
self.batch_size = 8
self.input_batch = {
Expand All @@ -52,6 +51,7 @@ def setUp(self):

def test_valid_call_bert(self):
self.model(self.input_batch)
# Check default name passed through
self.assertEqual(self.model.name, "encoder")

def test_variable_sequence_length_call_bert(self):
Expand Down Expand Up @@ -95,7 +95,6 @@ def test_unknown_preset_error(self):
Bert.from_preset(
"bert_base_uncased_clowntown",
load_weights=False,
name="encoder",
)

def test_preset_mutability(self):
Expand Down