from transformers import T5Tokenizer, T5ForConditionalGeneration
defadd_prefix_to_amino_acids(protein_sequence):
amino_acids = list(protein_sequence)
prefixed_amino_acids = ['<p>' + aa for aa in amino_acids]
new_sequence = ''.join(prefixed_amino_acids)
return new_sequence
tokenizer = T5Tokenizer.from_pretrained("QizhiPei/biot5-base-dti-human", model_max_length=512)
model = T5ForConditionalGeneration.from_pretrained('QizhiPei/biot5-base-dti-human')
task_definition = 'Definition: Drug target interaction prediction task (a binary classification task) for the human dataset. If the given molecule and protein can interact with each other, indicate via "Yes". Otherwise, response via "No".\n\n'
selfies_input = '[C][/C][=C][Branch1][C][\\C][C][=Branch1][C][=O][O]'
protein_input = 'MQALRVSQALIRSFSSTARNRFQNRVREKQKLFQEDNDIPLYLKGGIVDNILYRVTMTLCLGGTVYSLYSLGWASFPRN'
protein_input = add_prefix_to_amino_acids(protein_input)
task_input = f'Now complete the following example -\nInput: Molecule: <bom>{selfies_input}<eom>\nProtein: <bop>{protein_input}<eop>\nOutput: '
model_input = task_definition + task_input
input_ids = tokenizer(model_input, return_tensors="pt").input_ids
generation_config = model.generation_config
generation_config.max_length = 8
generation_config.num_beams = 1
outputs = model.generate(input_ids, generation_config=generation_config)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
References
For more information, please refer to our paper and GitHub repository.
biot5-base-dti-human huggingface.co is an AI model on huggingface.co that provides biot5-base-dti-human's model effect (), which can be used instantly with this QizhiPei biot5-base-dti-human model. huggingface.co supports a free trial of the biot5-base-dti-human model, and also provides paid use of the biot5-base-dti-human. Support call biot5-base-dti-human model through api, including Node.js, Python, http.
biot5-base-dti-human huggingface.co is an online trial and call api platform, which integrates biot5-base-dti-human's modeling effects, including api services, and provides a free online trial of biot5-base-dti-human, you can try biot5-base-dti-human online for free by clicking the link below.
QizhiPei biot5-base-dti-human online free url in huggingface.co:
biot5-base-dti-human is an open source model from GitHub that offers a free installation service, and any user can find biot5-base-dti-human on GitHub to install. At the same time, huggingface.co provides the effect of biot5-base-dti-human install, users can directly use biot5-base-dti-human installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
biot5-base-dti-human install url in huggingface.co: