jadechoghari commited on
Commit
e9c831c
1 Parent(s): d4e347d
Files changed (6) hide show
  1. .gitignore +162 -0
  2. LICENSE +21 -0
  3. README.md +65 -13
  4. __init__.py +0 -0
  5. app.py +10 -11
  6. pyproject.toml +78 -0
.gitignore ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
+ .pdm.toml
111
+ .pdm-python
112
+ .pdm-build/
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+
133
+ # Spyder project settings
134
+ .spyderproject
135
+ .spyproject
136
+
137
+ # Rope project settings
138
+ .ropeproject
139
+
140
+ # mkdocs documentation
141
+ /site
142
+
143
+ # mypy
144
+ .mypy_cache/
145
+ .dmypy.json
146
+ dmypy.json
147
+
148
+ # Pyre type checker
149
+ .pyre/
150
+
151
+ # pytype static type analyzer
152
+ .pytype/
153
+
154
+ # Cython debug symbols
155
+ cython_debug/
156
+
157
+ # PyCharm
158
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
161
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162
+ #.idea/
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Jeremy Wohlwend, Gabriele Corso, Saro Passaro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,13 +1,65 @@
1
- ---
2
- title: Boltz
3
- emoji: 🏢
4
- colorFrom: purple
5
- colorTo: purple
6
- sdk: gradio
7
- sdk_version: 5.6.0
8
- app_file: app.py
9
- pinned: false
10
- short_description: AlphaFold3 Like Model
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h1 align="center">Boltz-1:
2
+
3
+ Democratizing Biomolecular Interaction Modeling
4
+ </h1>
5
+
6
+ ![](docs/boltz1_pred_figure.png)
7
+
8
+ Boltz-1 is an open-source model which predicts the 3D structure of proteins, rna, dna and small molecules; it handles modified residues, covalent ligands and glycans, as well as condition the generation on pocket residues.
9
+
10
+ For more information about the model, see our [technical report](https://gcorso.github.io/assets/boltz1.pdf).
11
+
12
+ ## Installation
13
+ Install boltz with PyPI (recommended):
14
+
15
+ ```
16
+ pip install boltz
17
+ ```
18
+
19
+ or directly from GitHub for daily updates:
20
+
21
+ ```
22
+ git clone https://github.com/jwohlwend/boltz.git
23
+ cd boltz; pip install -e .
24
+ ```
25
+ > Note: we recommend installing boltz in a fresh python environment
26
+
27
+ ## Inference
28
+
29
+ You can run inference using Boltz-1 with:
30
+
31
+ ```
32
+ boltz predict input_path
33
+ ```
34
+
35
+ Boltz currently accepts three input formats:
36
+
37
+ 1. Fasta file, for most use cases
38
+
39
+ 2. A comprehensive YAML schema, for more complex use cases
40
+
41
+ 3. A directory containing files of the above formats, for batched processing
42
+
43
+ To see all available options: `boltz predict --help` and for more informaton on these input formats, see our [prediction instructions](docs/prediction.md).
44
+
45
+ ## Training
46
+
47
+ If you're interested in retraining the model, see our [training instructions](docs/training.md).
48
+
49
+ ## Contributing
50
+
51
+ We welcome external contributions and are eager to engage with the community. Connect with us on our [Slack channel](https://boltz-community.slack.com/archives/C0818M6DWH2) to discuss advancements, share insights, and foster collaboration around Boltz-1.
52
+
53
+ ## Coming very soon
54
+
55
+ - [ ] Pocket conditioning support
56
+ - [ ] More examples
57
+ - [ ] Full data processing pipeline
58
+ - [ ] Colab notebook for inference
59
+ - [ ] Confidence model checkpoint
60
+ - [ ] Support for custom paired MSA
61
+ - [ ] Kernel integration
62
+
63
+ ## License
64
+
65
+ Our model and code are released under MIT License, and can be freely used for both academic and commercial purposes.
__init__.py DELETED
File without changes
app.py CHANGED
@@ -1,8 +1,14 @@
1
  import gradio as gr
2
  import os
3
  from gradio_molecule3d import Molecule3D
 
 
 
 
 
 
4
  from boltz.main_test import predict # Import your predict function
5
-
6
  # Example Molecule3D representation settings
7
  reps = [
8
  {
@@ -22,10 +28,10 @@ reps = [
22
  def run_prediction(input_file):
23
  # Assuming `input_file` is a Gradio `File` object
24
  data = input_file.name # Get the path to the uploaded .fasta file
25
- out_dir = "/predict" # Set your output directory
26
  cache = "~/.boltz"
27
  accelerator = "cpu"
28
- sampling_steps = 200
29
  diffusion_samples = 1
30
  output_format = "pdb"
31
 
@@ -33,16 +39,9 @@ def run_prediction(input_file):
33
  predict(
34
  data=data,
35
  out_dir=out_dir,
36
- cache=cache,
37
- checkpoint=checkpoint,
38
- devices=devices,
39
  accelerator=accelerator,
40
- recycling_steps=recycling_steps,
41
  sampling_steps=sampling_steps,
42
- diffusion_samples=diffusion_samples,
43
- output_format=output_format,
44
- num_workers=num_workers,
45
- override=override,
46
  )
47
 
48
  # Fetch the generated PDB file
 
1
  import gradio as gr
2
  import os
3
  from gradio_molecule3d import Molecule3D
4
+ import sys
5
+ import os
6
+ # from boltz.main_test import predict # Import your predict function
7
+ current_dir = os.path.dirname(os.path.abspath(__file__))
8
+ src_path = os.path.join(current_dir, "boltz", "src")
9
+ sys.path.append(src_path)
10
  from boltz.main_test import predict # Import your predict function
11
+ # from boltz.src.boltz.main_test import predict
12
  # Example Molecule3D representation settings
13
  reps = [
14
  {
 
28
  def run_prediction(input_file):
29
  # Assuming `input_file` is a Gradio `File` object
30
  data = input_file.name # Get the path to the uploaded .fasta file
31
+ out_dir = "./predict" # Set your output directory
32
  cache = "~/.boltz"
33
  accelerator = "cpu"
34
+ sampling_steps = 1
35
  diffusion_samples = 1
36
  output_format = "pdb"
37
 
 
39
  predict(
40
  data=data,
41
  out_dir=out_dir,
 
 
 
42
  accelerator=accelerator,
 
43
  sampling_steps=sampling_steps,
44
+ output_format=output_format
 
 
 
45
  )
46
 
47
  # Fetch the generated PDB file
pyproject.toml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = ["setuptools >= 61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "boltz"
7
+ version = "0.1.0"
8
+ requires-python = ">=3.9"
9
+ description = "Boltz-1"
10
+ readme = "README.md"
11
+ dependencies = [
12
+ "torch>=2.2",
13
+ "numpy==1.26.3",
14
+ "hydra-core==1.3.2",
15
+ "pytorch-lightning==2.4.0",
16
+ "rdkit==2024.3.6",
17
+ "dm-tree==0.1.8",
18
+ "requests==2.32.3",
19
+ "pandas==2.2.3",
20
+ "types-requests",
21
+ "einops==0.8.0",
22
+ "einx==0.3.0",
23
+ "fairscale==0.4.13",
24
+ "mashumaro==3.14",
25
+ "modelcif==1.2",
26
+ "wandb==0.18.7",
27
+ "click==8.1.7",
28
+ "pyyaml==6.0.2",
29
+ "biopython==1.84",
30
+ "scipy==1.13.1",
31
+ ]
32
+
33
+ [project.scripts]
34
+ boltz = "boltz.main:cli"
35
+
36
+ [project.optional-dependencies]
37
+ lint = ["ruff"]
38
+
39
+ [tool.ruff]
40
+ src = ["src"]
41
+ extend-exclude = ["conf.py"]
42
+ target-version = "py39"
43
+ lint.select = ["ALL"]
44
+ lint.ignore = [
45
+ "COM812", # Conflicts with the formatter
46
+ "ISC001", # Conflicts with the formatter
47
+ "ANN101", # "missing-type-self"
48
+ "RET504", # Unnecessary assignment to `x` before `return` statementRuff
49
+ "S101", # Use of `assert` detected
50
+ "D100", # Missing docstring in public module
51
+ "D104", # Missing docstring in public package
52
+ "PT001", # https://github.com/astral-sh/ruff/issues/8796#issuecomment-1825907715
53
+ "PT004", # https://github.com/astral-sh/ruff/issues/8796#issuecomment-1825907715
54
+ "PT005", # https://github.com/astral-sh/ruff/issues/8796#issuecomment-1825907715
55
+ "PT023", # https://github.com/astral-sh/ruff/issues/8796#issuecomment-1825907715
56
+ "FBT001",
57
+ "FBT002",
58
+ "PLR0913", # Too many arguments to init (> 5)
59
+ ]
60
+
61
+ [tool.ruff.lint.per-file-ignores]
62
+ "**/__init__.py" = [
63
+ "F401", # Imported but unused
64
+ "F403", # Wildcard imports
65
+ ]
66
+ "docs/**" = [
67
+ "INP001", # Requires __init__.py but folder is not a package.
68
+ ]
69
+ "scripts/**" = [
70
+ "INP001", # Requires __init__.py but folder is not a package.
71
+ ]
72
+
73
+ [tool.ruff.lint.pyupgrade]
74
+ # Preserve types, even if a file imports `from __future__ import annotations`(https://github.com/astral-sh/ruff/issues/5434)
75
+ keep-runtime-typing = true
76
+
77
+ [tool.ruff.lint.pydocstyle]
78
+ convention = "numpy"