Skip to content

Instantly share code, notes, and snippets.

@f0ster
Last active February 15, 2024 20:32
Show Gist options
  • Save f0ster/79e2e0705300e3184d2f02a4d7e87c41 to your computer and use it in GitHub Desktop.
Save f0ster/79e2e0705300e3184d2f02a4d7e87c41 to your computer and use it in GitHub Desktop.
comfyUI-llama basic LLM worfklow
{
"last_node_id": 3,
"last_link_id": 2,
"nodes": [
{
"id": 2,
"type": "Call LLM Basic",
"pos": [
42,
190
],
"size": {
"0": 400,
"1": 200
},
"flags": {},
"order": 1,
"mode": 0,
"inputs": [
{
"name": "LLM",
"type": "LLM",
"link": 1
}
],
"outputs": [
{
"name": "STRING",
"type": "STRING",
"links": [
2
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "Call LLM Basic"
},
"widgets_values": [
"protein folding domain specific language using algebraic data types",
0,
0.8,
1383,
"randomize"
]
},
{
"id": 1,
"type": "Load LLM Model Basic",
"pos": [
44,
52
],
"size": [
391.0514561653137,
82
],
"flags": {},
"order": 0,
"mode": 0,
"outputs": [
{
"name": "LLM",
"type": "LLM",
"links": [
1
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "Load LLM Model Basic"
},
"widgets_values": [
"openhermes-2.5-mistral-7b.Q4_K_M.gguf",
0
]
},
{
"id": 3,
"type": "ShowText|pysssss",
"pos": [
462,
54
],
"size": [
1557.4833592414857,
1229.4874382972719
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "text",
"type": "STRING",
"link": 2,
"widget": {
"name": "text"
}
}
],
"outputs": [
{
"name": "STRING",
"type": "STRING",
"links": null,
"shape": 6
}
],
"properties": {
"Node name for S&R": "ShowText|pysssss"
},
"widgets_values": [
"",
"\n\n# Protein Folding Domain Specific Language in Python Using Algebraic Data Types\n\nThis project provides a domain specific language (DSL) for describing the process of protein folding in Python. The DSL uses algebraic data types to represent the structure of proteins and their interactions with the surrounding environment. The DSL is designed to be flexible, extensible, and easy to use, making it suitable for both teaching and research purposes.\n\n## Getting Started\n\nTo get started with the DSL, you need to install the following Python packages:\n\n- [pyparsing](https://pypi.org/project/pyparsing/)\n- [typing_extensions](https://pypi.org/project/typing-extensions/) (optional)\n\nYou can install these packages using pip:\n\n```bash\npip install pyparsing typing_extensions\n```\n\nOnce you have installed the necessary packages, you can import the DSL from the `pf_dsl` module and start defining protein folding problems. Here's an example of how to define a simple protein folding problem:\n\n```python\nfrom pf_dsl import parse_protein\n\nproblem = '''\nchain A\n residue ala, ser, phe, ile, val, leu, asp, glu, asn, gln, his, tyr, cys, trp, met, gly, pro, thr, arg, lys, asx, glx, xxx, xxx\n\nsheet A1-A3 parallel\n strand A1-A2\n strand A3\n sheet A4-A6 antiparallel\n strand A5-A6\n loop A7-A8\n\nbeta-turn A7-A8 left\n\nloop A9-A10\n\nsheet A11-A13 parallel\n strand A11-A12\n strand A13\n sheet A14-A16 antiparallel\n strand A15-A16\n loop A17-A18\n\nbeta-turn A17-A18 right\n\nloop A19-A20\n\nsheet A21-A23 parallel\n strand A21-A22\n strand A23\n sheet A24-A26 antiparallel\n strand A25-A26\n loop A27-A28\n\nbeta-turn A27-A28 left\n\nloop A29-A30\n\nsheet A31-A33 parallel\n strand A31-A32\n strand A33\n sheet A34-A36 antiparallel\n strand A35-A36\n loop A37-A38\n\nbeta-turn A37-A38 left\n\nloop A39-A40\n\nsheet A41-A43 parallel\n strand A41-A42\n strand A43\n sheet A44-A46 antiparallel\n strand A45-A46\n loop A47-A48\n\nbeta-turn A47-A48 right\n\nloop A49-A50\n\nsheet A51-A53 parallel\n strand A51-A52\n strand A53\n sheet A54-A56 antiparallel\n strand A55-A56\n loop A57-A58\n\nbeta-turn A57-A58 left\n\nloop A59-A60\n\nsheet A61-A63 parallel\n strand A61-A62\n strand A63\n sheet A64-A66 antiparallel\n strand A65-A66\n loop A67-A68\n\nbeta-turn A67-A68 right\n\nloop A69-A70\n\nsheet A71-A73 parallel\n strand A71-A72\n strand A73\n sheet A74-A76 antiparallel\n strand A75-A76\n loop A77-A78\n\nbeta-turn A77-A78 left\n\nloop A79-A80\n\nsheet A81-A83 parallel\n strand A81-A82\n strand A83\n sheet A84-A86 antiparallel\n strand A85-A86\n loop A87-A88\n\nbeta-turn A87-A88 right\n\nloop A89-A90\n\nsheet A91-A93 parallel\n strand A91-A92\n strand A93\n sheet A94-A96 antiparallel\n strand A95-A96\n loop A97-A98\n\nbeta-turn A97-A98 left\n\nloop A99-A100\n\nsheet A101-A103 parallel\n strand A101-A102\n strand A103\n sheet A104-A106 antiparallel\n strand A105-A106\n loop A107-A108\n\nbeta-turn A107-A108 right\n\nloop A109-A110\n\nchain B\n residue ala, ser, phe, ile, val, leu, asp, glu, asn, gln, his, tyr, cys, trp, met, gly, pro, thr, arg, lys, asx, glx, xxx, xxx\n'''\n\nchain_a = parse_protein(problem)\nprint(chain_a)\n```\n\nThis code defines a protein with 100 amino acids (residues), and groups them into various secondary structure elements such as sheets, loops, and beta-turns. The DSL provides a concise and readable way to describe the structure of proteins, making it easier to reason about their behavior during the folding process.\n\n## Usage Examples\n\nHere are some examples of how you can use the DSL to define various protein folding problems:\n\n```python\n# Define a simple protein with alternating sheets and loops\nproblem = '''\nchain A\n residue ala, ser, phe, ile, val, leu, asp, glu, asn, gln, his, tyr, cys, trp, met, gly, pro, thr, arg, lys, asx, glx, xxx, xxx\n\nsheet A1-A2 parallel\n strand A1-A2\n loop A3-A4\n sheet A5-A6 antiparallel\n strand A6-A7\n loop A8-A9\n'''\nparse_protein(problem)\n\n# Define a protein with multiple chains and secondary structure elements\nproblem = '''\nchain A\n residue ala, ser, phe, ile, val, leu, asp, glu, asn, gln, his, tyr, cys, trp, met, gly, pro, thr, arg, lys, asx, glx, xxx, xxx\n\nchain B\n residue ala, ser, phe, ile, val, leu, asp, glu, asn, gln, his, tyr, cys, trp, met, gly, pro, thr, arg, lys, asx, glx, xxx, xxx\n\nsheet A1-A2 parallel\n strand A1-A2\n sheet B3-B4 antiparallel\n strand B4-B5\n loop A6-A7\n loop B8-B9\n'''\nparse_protein(problem)\n\n# Define a protein with multiple sheets and complex loops\nproblem = '''\nchain A\n residue ala, ser, phe, ile, val, leu, asp, glu, asn, gln, his, tyr, cys, trp, met, gly, pro, thr, arg, lys, asx, glx, xxx, xxx\n\nsheet A1-A3 parallel\n strand A1-A2\n strand A3\n sheet A4-A6 antiparallel\n strand A5-A6\n loop A7-A8\n beta-turn A7-A8 left\n\nloop A9-A10\n\nsheet A11-A13 parallel\n strand A11-A"
]
}
],
"links": [
[
1,
1,
0,
2,
0,
"LLM"
],
[
2,
2,
0,
3,
0,
"STRING"
]
],
"groups": [],
"config": {},
"extra": {},
"version": 0.4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment