Skip to content

Commit

Permalink
Update usage examples
Browse files Browse the repository at this point in the history
  • Loading branch information
luozhouyang committed Dec 21, 2020
1 parent f0b1c40 commit 9c02e11
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ from transformers_keras import Bert
# Used to predict directly
model = Bert.from_pretrained('/path/to/pretrained/bert/model')
# segment_ids and mask inputs are optional
model.predict(inputs=(input_ids, segment_ids, mask))
model.predict((input_ids, segment_ids, mask))
# or
model(inputs=(input_ids, segment_ids, mask))

# Used to fine-tuning
def build_bert_classify_model(trainable=True):
Expand Down Expand Up @@ -70,7 +72,9 @@ from transformers_keras import Albert
# Used to predict directly
model = Bert.from_pretrained('/path/to/pretrained/albert/model')
# segment_ids and mask inputs are optional
model(model.dummy_inputs())
model.predict((input_ids, segment_ids, mask))
# or
model(inputs=(input_ids, segment_ids, mask))

# Used to fine-tuning
def build_albert_classify_model(trainable=True):
Expand Down

0 comments on commit 9c02e11

Please sign in to comment.