Last active
January 30, 2020 16:32
-
-
Save sam-writer/9a4f9bd17d62ac5ea05ceb86926bbbc3 to your computer and use it in GitHub Desktop.
announcing-fitbert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fitbert import FitBert | |
# currently supported models: bert-large-uncased and distilbert-base-uncased | |
# this takes a while and loads a whole big BERT into memory | |
fb = FitBert() | |
masked_string = "Why Bert, you're looking ***mask*** today!" | |
options = ['buff', 'handsome', 'strong'] | |
ranked_options = fb.rank(masked_string, options=options) | |
# >>> ['handsome', 'strong', 'buff'] | |
# or | |
filled_in = fb.fitb(masked_string, options=options) | |
# >>> "Why Bert, you're looking handsome today!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment