|
613 | 613 | "name": "stdout", |
614 | 614 | "output_type": "stream", |
615 | 615 | "text": [ |
616 | | - "Instructions: Answer the following question about drug properties.\n", |
| 616 | + "Instructions: Answer the following question about drug properties.\n", |
617 | 617 | "Context: As a membrane separating circulating blood and brain extracellular fluid, the blood-brain barrier (BBB) is the protection layer that blocks most foreign drugs. Thus the ability of a drug to penetrate the barrier to deliver to the site of action forms a crucial challenge in development of drugs for central nervous system.\n", |
618 | 618 | "Question: Given a drug SMILES string, predict whether it\n", |
619 | 619 | "(A) does not cross the BBB (B) crosses the BBB\n", |
|
636 | 636 | "def txgemma_predict(prompt):\n", |
637 | 637 | " input_ids = predict_tokenizer(prompt, return_tensors=\"pt\").to(\"cuda\")\n", |
638 | 638 | " outputs = predict_model.generate(**input_ids, max_new_tokens=8)\n", |
639 | | - " return predict_tokenizer.decode(outputs[0][len(input_ids[0]):], skip_special_tokens=True)\n", |
| 639 | + " return predict_tokenizer.decode(outputs[0][len(input_ids[0]):], skip_special_tokens=True)\n", |
640 | 640 | "\n", |
641 | 641 | "def txgemma_chat(prompt):\n", |
642 | | - " messages = [{\"role\": \"user\", \"content\": prompt}]\n", |
643 | | - " inputs = chat_tokenizer.apply_chat_template(\n", |
644 | | - " messages, tokenize=True, add_generation_prompt=True, return_tensors=\"pt\"\n", |
645 | | - " ).to(\"cuda\")\n", |
| 642 | + " messages = [{\"role\": \"user\", \"content\": prompt}]\n", |
| 643 | + " inputs = chat_tokenizer.apply_chat_template(\n", |
| 644 | + " messages, tokenize=True, add_generation_prompt=True, return_tensors=\"pt\"\n", |
| 645 | + " ).to(\"cuda\")\n", |
646 | 646 | " outputs = chat_model.generate(input_ids=inputs, max_new_tokens=200)\n", |
647 | 647 | " return chat_tokenizer.decode(outputs[0, len(inputs[0]):], skip_special_tokens=True)\n", |
648 | 648 | "\n", |
649 | | - "print(TDC_PROMPT)\n", |
| 649 | + "print(TDC_PROMPT)\n", |
650 | 650 | "print(f\"\\nPrediction model response: {txgemma_predict(TDC_PROMPT)}\")\n", |
651 | 651 | "if USE_CHAT: print(f\"\\nChat model response: {txgemma_chat(TDC_PROMPT)}\")" |
652 | 652 | ] |
|
1251 | 1251 | "**Conclusion:**\n", |
1252 | 1252 | "\n", |
1253 | 1253 | "For a drug to be considered for broad development, a favorable safety and toxicity profile is paramount. **Aspirin (Drug 1)** has a demonstrably superior safety profile compared to Vorinostat (Drug 2). Its wide range of proven therapeutic benefits and lower toxicity make it the unequivocally preferred candidate for further development over a compound with predicted toxicity and a more niche, high-risk therapeutic application.\n" |
1254 | | - ] |
| 1254 | + ] |
1255 | 1255 | } |
1256 | 1256 | ], |
1257 | 1257 | "source": [ |
|
0 commit comments