<jupyter_start><jupyter_text><jupyter_code>!pip uninstall -y tensorflow
!pip install transformers
from transformers import pipeline

fill_mask = pipeline("fill-mask", 
                     model="/content/drive/My Drive/Project De Novo/output_dir",
                     tokenizer="/content/drive/My Drive/Project De Novo/output_dir"
)


# Mask Language Modelling --> We can test whether the model trained will by tokenizing and generating predictions off a sequnece with a masked token.

# The masked input is the SMILES string representation of Remdesivir (ebola antiviral). Lets see whether the model predicts the final 'C1' branch:

# SMILES original string: CCC(CC)COC(=O)[C@H](C)N[P@](=O)(OC[C@H]1O[C@](C#N)([C@H](O)[C@@H]1O)C1=CC=C2N1N=CN=C2N)OC1=CC=CC=C1 

result = fill_mask("CCC(CC)COC(=O)[C@H](C)N[P@](=O)(OC[C@H]1O[C@](C#N)([C@H](O)[C@@H]1O)C1=CC=C2N1N=CN=C2N)OC1=CC=CC=<mask>1")
print (result)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16042780748663102, 'fraction_numerical': 0.01818181818181818, 'mean_word_length': 5.36734693877551, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '470343', 'license': 'MIT', 'n_tokens_mistral': 379, 'n_tokens_neox': 362, 'n_words': 74, 'path': 'chemberta/masked-lm/HuggingFace_RoBERTa_pretrained.ipynb', 'repo_name': 'BogdanDidenko/bert-loves-chemistry', 'size': '935'}