Skip to content

Commit 798fd9c

Browse files
Merge pull request #56 from RosettaCommons/fix/install-cmds
Fix installation issues
2 parents fd24d72 + 4fcafb3 commit 798fd9c

File tree

6 files changed

+81
-65
lines changed

6 files changed

+81
-65
lines changed

.env

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
# - you will need to set the paths below as appropriate for your environment.
55
# We provide examples in the comments to give you an idea of the expected format.
66

7-
# Foundry install dir for checkpoints
8-
# Commented out by default since otherwise may be overridden by user export (load_dotenv(override=True) used at the moment)
9-
# TODO: Ensure override=False can be used.
10-
# FOUNDRY_CHECKPOINTS_DIR=
11-
127
# --- Mirrors to RCSB data ---
138

149
# The `PDB_MIRROR_PATH` is a path to a local mirror of the PDB database. It's
@@ -62,3 +57,8 @@ COLABFOLD_LOCAL_DB_PATH_CPU=
6257
# Network access (fallback; may cause IO-related issues)
6358
COLABFOLD_NET_DB_PATH_GPU=
6459
COLABFOLD_NET_DB_PATH_CPU=
60+
61+
# Foundry install dir for checkpoints
62+
# Commented out by default since otherwise may be overridden by user export (load_dotenv(override=True) used at the moment)
63+
# TODO: Ensure override=False can be used.
64+
# FOUNDRY_CHECKPOINTS_DIR=

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# For docs / outputs from example notebooks;
2+
demo/*/**.cif*
3+
demo/*/**.json
24
examples/*.cif
35
**.ckpt
46
**.pt

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,21 @@ All models within Foundry rely on [AtomWorks](https://github.com/RosettaCommons/
1111
pip install rc-foundry[all]
1212
```
1313

14-
**Downloading weights** All models can be downloaded to a target folder with:
15-
14+
**Downloading weights** Models can be downloaded to a target folder with:
15+
```
16+
foundry install base-models --checkpoint-dir <path/to/ckpt/dir>
1617
```
17-
foundry install all --checkpoint-dir <path/to/ckpt/dir>
18+
where `checkpoint-dir` will be `~/.foundry/checkpoints` by default. Once installed, foundry sets the env `FOUNDRY_CHECKPOINTS_DIR` which it will use during inference or subsequent commands to find the checkpoints. `base-models` installs the latest RFD3, RF3 and MPNN variants - you can also download all of the models supported (including multiple checkpoints of RF3) with `all`, or by listing the models sequentially (e.g. `foundry install rfd3 rf3 ...`).
19+
To list the registry of available checkpoints:
1820
```
19-
This will download all the models supported (including multiple checkpoints of RF3) but as a beginner you can start with:
21+
foundry list-available
2022
```
21-
foundry install rfd3 ligandmpnn rf3 --checkpoint-dir <path/to/ckpt/dir>
23+
To check what you already have downloaded (defaults to `$FOUNDRY_CHECKPOINTS_DIR` if set):
24+
```
25+
foundry list-installed
2226
```
2327

24-
>*See `examples/all.ipynb` for how to run each model in a notebook.*
28+
>*See `examples/all.ipynb` for how to run each model and design proteins end-to-end in a notebook.*
2529
2630
### Google Colab
2731
For an interactive Google Colab notebook walking through a basic design pipeline with RFD3, MPNN, and RF3, please see the [IPD Design Pipeline Tutorial](https://colab.research.google.com/drive/1ZwIMV3n9h0ZOnIXX0GyKUuoiahgifBxh?usp=sharing).
@@ -68,11 +72,7 @@ For an interactive Google Colab notebook walking through a basic design pipeline
6872
Install both `foundry` and models in editable mode for development:
6973

7074
```bash
71-
# Install foundry and RF3 in editable mode
72-
uv pip install -e . -e ./models/rf3 -e ./models/rfd3 -e ./models/mpnn
73-
74-
# Or install only foundry (no models)
75-
uv pip install -e .
75+
uv pip install -e '.[all,dev]'
7676
```
7777

7878
This approach allows you to:

models/rfd3/README.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@ both are described in more detail below.
1010
<img src="docs/.assets/overview.png" alt="All-atom design with RFD3">
1111
</p>
1212

13-
## Get Started
14-
1. Install RFdiffusion3. See [Main README](../../README.md) for instructions how to install all models to run full pipeline (recommended). If you have already installed all the models skip [here](#run-inference).
13+
> [!NOTE]
14+
> Looking for config documentation? See [here](./docs/input.md)
15+
16+
## Getting Started
17+
1. Install RFdiffusion3. See [Main README](../../README.md) for instructions how to install all models to run full pipeline (recommended). If you have already installed all the models skip [here](#run-inference).
1518
```bash
1619
pip install rc-foundry[rfd3]
1720
```
1821
2. Download checkpoint to your desired checkpoint location.
1922
```bash
20-
foundry install rfd3 --checkpoint-dir /path/to/ckpt/dir
23+
foundry install rfd3 --checkpoint-dir <path/to/ckpt/dir>
2124
```
2225
This sets `FOUNDRY_CHECKPOINTS_DIR` and will in future look for checkpoints in that directory, allowing you to run inference without supplying the checkpoint path. The checkpoint directory is optional, defaulting to `~/.foundry/checkpoints` if unset.
2326

24-
## Run Inference
27+
## Running Inference
2528

2629
To run inference (with foundry installed in your environment, or RFD3 & Foundry src in PYTHONPATH):
2730
```bash
@@ -54,15 +57,6 @@ that you are running the examples from the `foundry/models/rfd3/docs`
5457
directory. If you would like to run RFD3 from a different location,
5558
you will need to change the path in the `.json` file(s) before running.
5659

57-
### Install HBPLUS for hydrogen bond conditioning:
58-
One of the examples shows how to incorporate hydrogen bond conditioning
59-
into your designs. To make use of this feature, you will need to
60-
additionally complete the following steps:
61-
62-
1. Download hbplus from here: https://www.ebi.ac.uk/thornton-srv/software/HBPLUS/download.html (available for free)
63-
2. Follow the installation instruction here: https://www.ebi.ac.uk/thornton-srv/software/HBPLUS/install.html
64-
3. Update `HBPLUS_PATH` in `foundry/.env` file with the path to your `hbplus` executable.
65-
6660
<table>
6761
<tr>
6862
<td align="center">
@@ -90,7 +84,7 @@ additionally complete the following steps:
9084
</tr>
9185
</table>
9286

93-
## Training:
87+
## Training and Fine-Tuning
9488

9589
We make available to the community not only the weights to run RFdiffusion3 but also the complete training code, easily extendable to additional use cases. Any AtomWorks-compatible dataset (and thus, any collection of structure files) can be readily incorporated and used for training or fine-tuning.
9690

@@ -112,9 +106,10 @@ RFdiffusion3 supports arbitrary datasets of structure files for training and fin
112106

113107
After setting up Hydra configs, launch a training run:
114108
```bash
115-
uv run python models/rfd3/src/rfd3/train.py experiment=pretrain
109+
uv run python models/rfd3/src/rfd3/train.py experiment=pretrain ckpt_path=<path/to/ckpt>
116110
```
117111

112+
Supplying `ckpt_path=null` (default) will start with fresh weights.
118113
See the [path configs](/models/rfd3/configs/paths/) to customize data input and log output directories.
119114

120115
### Logging Configuration
@@ -162,6 +157,17 @@ In `models/rfd3/configs/datasets/design_base.yaml` there's the shared configs fo
162157

163158
**Training with WandB:** We strongly recommend tracking your runs via wandb. To use it, simply have your WANDB_API_KEY set and use the wandb logger. For more details see [here](wandb.ai)
164159

160+
# Appendix
161+
162+
## Install HBPLUS for hydrogen bond conditioning:
163+
One of the examples shows how to incorporate hydrogen bond conditioning
164+
into your designs. To make use of this feature, you will need to
165+
additionally complete the following steps:
166+
167+
1. Download hbplus from here: https://www.ebi.ac.uk/thornton-srv/software/HBPLUS/download.html (available for free)
168+
2. Follow the installation instruction here: https://www.ebi.ac.uk/thornton-srv/software/HBPLUS/install.html
169+
3. Update `HBPLUS_PATH` in `foundry/.env` file with the path to your `hbplus` executable.
170+
165171
## Citation
166172

167173
If you use this code or data in your work, please consider citing:

models/rfd3/docs/input.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RFdiffusion3 — Input specification (dialect **2**)
1+
# RFdiffusion3 — Input Specification & Command-line arguments
22

33
---
44

@@ -30,6 +30,23 @@ JSON inputs take the following top-level structure;
3030
}
3131
```
3232

33+
You can then run inference at the command line with:
34+
```
35+
rfd3 design out_dir=<path/to/outdir> inputs=<path/to/inputs>
36+
```
37+
In this document, we detail the syntax of the config structure.
38+
39+
## CLI arguments
40+
Key CLI arguments (from the default config) to know include:
41+
- `n_batches` — number of batches to generate per input key (default: 1).
42+
- `diffusion_batch_size` — number of diffusion samples per batch (default: 8).
43+
- `specification` — JSON overrides for the per-example InputSpecification (default: `{}`). For example, you can run `rfd3 design inputs=null specification.length=200` for a quick debug of creating a 200-length protein.
44+
- `inference_sampler.num_timesteps` — diffusion timesteps for sampling (default: 200).
45+
- `inference_sampler.step_scale` — scales diffusion step size; higher → less diverse, more designable (default: 1.5).
46+
- `low_memory_mode` — memory-efficient tokenization mode; set `True` if GPU RAM is tight (default: False).
47+
48+
The full config of default arguments that are applied can be seen in [inference_engine/rfdiffusion3.yaml](../configs/inference_engine/rfdiffusion3.yaml)
49+
3350
## InputSpecification fields
3451

3552
Below is a table of all of the inputs that the `InputSpecification` accepts. Use these fields to describe what RFdiffusion3 should do with your inputs.
@@ -88,7 +105,7 @@ select_fixed_atoms:
88105
```
89106
90107
<p align="center">
91-
<img src=".assets/input_selection.png" alt="InputSelection language for foundry">
108+
<img src=".assets/input_selection.png" alt="InputSelection language for foundry" width=500>
92109
</p>
93110
94111
## Unindexing specifics
@@ -166,4 +183,4 @@ Let us know if you have any additional questions, we'd be happy to answer them!
166183
Below is a reference for more examples of different ways you can specify inputs to select from your pdb in configs; we hope the community can find use in this flexible system for future models!
167184
<p align="center">
168185
<img src=".assets/input_selection_large.png" alt="Input selection syntax" width=650>
169-
</p>
186+
</p>

src/foundry_cli/download_checkpoints.py

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
console = Console()
3030

3131

32+
def _resolve_checkpoint_dir(checkpoint_dir: Optional[Path]) -> Path:
33+
"""Return user-specified checkpoint dir or fall back to default."""
34+
return (
35+
checkpoint_dir if checkpoint_dir is not None else get_default_checkpoint_dir()
36+
)
37+
38+
3239
def download_file(url: str, dest: Path, verify_hash: Optional[str] = None) -> None:
3340
"""Download a file with progress bar and optional hash verification.
3441
@@ -123,7 +130,7 @@ def install_model(model_name: str, checkpoint_dir: Path, force: bool = False) ->
123130
def install(
124131
models: list[str] = typer.Argument(
125132
...,
126-
help="Models to install: 'all', 'rfd3', 'rf3', 'mpnn', or combination",
133+
help="Models to install: 'all', 'rfd3', 'rf3', 'mpnn', or a combination thereof",
127134
),
128135
checkpoint_dir: Optional[Path] = typer.Option(
129136
None,
@@ -136,24 +143,21 @@ def install(
136143
),
137144
):
138145
"""Install model checkpoints for foundry.
139-
140146
Examples:
141-
142147
foundry install all
143-
144148
foundry install rfd3 rf3
145-
146149
foundry install proteinmpnn --checkpoint-dir ./checkpoints
147150
"""
148151
# Determine checkpoint directory
149-
if checkpoint_dir is None:
150-
checkpoint_dir = get_default_checkpoint_dir()
152+
checkpoint_dir = _resolve_checkpoint_dir(checkpoint_dir)
151153

152154
console.print(f"[bold]Checkpoint directory:[/bold] {checkpoint_dir}")
153155
console.print()
154156

155157
# Expand 'all' to all available models
156158
if "all" in models:
159+
models_to_install = list(REGISTERED_CHECKPOINTS.keys())
160+
elif "base-models" in models:
157161
models_to_install = ["rfd3", "proteinmpnn", "ligandmpnn", "rf3"]
158162
else:
159163
models_to_install = models
@@ -177,34 +181,28 @@ def install(
177181
console.print("[bold green]Installation complete![/bold green]")
178182

179183

180-
@app.command(name="list")
181-
def list_models():
184+
@app.command(name="list-available")
185+
def list_available():
182186
"""List available model checkpoints."""
183187
console.print("[bold]Available models:[/bold]\n")
184188
for name, info in REGISTERED_CHECKPOINTS.items():
185189
console.print(f" [cyan]{name:8}[/cyan] - {info.description}")
186190

187191

188-
@app.command()
189-
def show(
190-
checkpoint_dir: Optional[Path] = typer.Option(
191-
None,
192-
"--checkpoint-dir",
193-
"-d",
194-
help="Checkpoint directory to show",
195-
),
196-
):
197-
"""Show installed checkpoints."""
198-
if checkpoint_dir is None:
199-
checkpoint_dir = get_default_checkpoint_dir()
192+
@app.command(name="list-installed")
193+
def list_installed():
194+
"""List installed checkpoints and their sizes."""
195+
checkpoint_dir = _resolve_checkpoint_dir(None)
200196

201197
if not checkpoint_dir.exists():
202198
console.print(
203199
f"[yellow]No checkpoints directory found at {checkpoint_dir}[/yellow]"
204200
)
205201
raise typer.Exit(0)
206202

207-
checkpoint_files = list(checkpoint_dir.glob("*.ckpt"))
203+
checkpoint_files = list(checkpoint_dir.glob("*.ckpt")) + list(
204+
checkpoint_dir.glob("*.pt")
205+
)
208206
if not checkpoint_files:
209207
console.print(f"[yellow]No checkpoint files found in {checkpoint_dir}[/yellow]")
210208
raise typer.Exit(0)
@@ -219,21 +217,14 @@ def show(
219217
console.print(f"\n[bold]Total:[/bold] {total_size:.2f} GB")
220218

221219

222-
@app.command()
220+
@app.command(name="clean")
223221
def clean(
224-
checkpoint_dir: Optional[Path] = typer.Option(
225-
None,
226-
"--checkpoint-dir",
227-
"-d",
228-
help="Checkpoint directory to clean",
229-
),
230222
confirm: bool = typer.Option(
231223
True, "--confirm/--no-confirm", help="Ask for confirmation before deleting"
232224
),
233225
):
234226
"""Remove all downloaded checkpoints."""
235-
if checkpoint_dir is None:
236-
checkpoint_dir = get_default_checkpoint_dir()
227+
checkpoint_dir = _resolve_checkpoint_dir(None)
237228

238229
if not checkpoint_dir.exists():
239230
console.print(f"[yellow]No checkpoints found at {checkpoint_dir}[/yellow]")

0 commit comments

Comments
 (0)