Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from fitbert import FitBert
- # in theory you can pass a model_name and tokenizer, but currently only
- # bert-large-uncased and BertTokenizer are available
- # 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!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement