Fix installation

This commit is contained in:
jbutch
2025-12-04 19:25:17 -08:00
parent fd24d7268b
commit a9196592ca
5 changed files with 45 additions and 44 deletions

1
.env
View File

@@ -62,3 +62,4 @@ COLABFOLD_LOCAL_DB_PATH_CPU=
# Network access (fallback; may cause IO-related issues)
COLABFOLD_NET_DB_PATH_GPU=
COLABFOLD_NET_DB_PATH_CPU=
FOUNDRY_CHECKPOINTS_DIR='/home/jbutch/.foundry/checkpoints'

2
.gitignore vendored
View File

@@ -1,4 +1,6 @@
# For docs / outputs from example notebooks;
demo/*/**.cif*
demo/*/**.json
examples/*.cif
**.ckpt
**.pt

View File

@@ -21,6 +21,15 @@ This will download all the models supported (including multiple checkpoints of R
foundry install rfd3 ligandmpnn rf3 --checkpoint-dir <path/to/ckpt/dir>
```
List the registry of available checkpoints with:
```
foundry list-available
```
Check what you already have downloaded (defaults to `$FOUNDRY_CHECKPOINTS_DIR` if set) with:
```
foundry list-installed --checkpoint-dir <path/to/ckpt/dir>
```
>*See `examples/all.ipynb` for how to run each model in a notebook.*
### Google Colab

View File

@@ -10,7 +10,7 @@ both are described in more detail below.
<img src="docs/.assets/overview.png" alt="All-atom design with RFD3">
</p>
## Get Started
## Getting Started
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).
```bash
pip install rc-foundry[rfd3]
@@ -21,7 +21,7 @@ foundry install rfd3 --checkpoint-dir /path/to/ckpt/dir
```
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.
## Run Inference
## Running Inference
To run inference (with foundry installed in your environment, or RFD3 & Foundry src in PYTHONPATH):
```bash
@@ -54,15 +54,6 @@ that you are running the examples from the `foundry/models/rfd3/docs`
directory. If you would like to run RFD3 from a different location,
you will need to change the path in the `.json` file(s) before running.
### Install HBPLUS for hydrogen bond conditioning:
One of the examples shows how to incorporate hydrogen bond conditioning
into your designs. To make use of this feature, you will need to
additionally complete the following steps:
1. Download hbplus from here: https://www.ebi.ac.uk/thornton-srv/software/HBPLUS/download.html (available for free)
2. Follow the installation instruction here: https://www.ebi.ac.uk/thornton-srv/software/HBPLUS/install.html
3. Update `HBPLUS_PATH` in `foundry/.env` file with the path to your `hbplus` executable.
<table>
<tr>
<td align="center">
@@ -90,7 +81,7 @@ additionally complete the following steps:
</tr>
</table>
## Training:
## Training and Fine-Tuning
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.
@@ -112,9 +103,10 @@ RFdiffusion3 supports arbitrary datasets of structure files for training and fin
After setting up Hydra configs, launch a training run:
```bash
uv run python models/rfd3/src/rfd3/train.py experiment=pretrain
uv run python models/rfd3/src/rfd3/train.py experiment=pretrain ckpt_path=<path/to/ckpt>
```
Supplying `ckpt_path=null` (default) will start with fresh weights.
See the [path configs](/models/rfd3/configs/paths/) to customize data input and log output directories.
### Logging Configuration
@@ -162,6 +154,17 @@ In `models/rfd3/configs/datasets/design_base.yaml` there's the shared configs fo
**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)
# Appendix
## Install HBPLUS for hydrogen bond conditioning:
One of the examples shows how to incorporate hydrogen bond conditioning
into your designs. To make use of this feature, you will need to
additionally complete the following steps:
1. Download hbplus from here: https://www.ebi.ac.uk/thornton-srv/software/HBPLUS/download.html (available for free)
2. Follow the installation instruction here: https://www.ebi.ac.uk/thornton-srv/software/HBPLUS/install.html
3. Update `HBPLUS_PATH` in `foundry/.env` file with the path to your `hbplus` executable.
## Citation
If you use this code or data in your work, please consider citing:

View File

@@ -29,6 +29,13 @@ app = typer.Typer(help="Foundry model checkpoint installation utilities")
console = Console()
def _resolve_checkpoint_dir(checkpoint_dir: Optional[Path]) -> Path:
"""Return user-specified checkpoint dir or fall back to default."""
return (
checkpoint_dir if checkpoint_dir is not None else get_default_checkpoint_dir()
)
def download_file(url: str, dest: Path, verify_hash: Optional[str] = None) -> None:
"""Download a file with progress bar and optional hash verification.
@@ -123,7 +130,7 @@ def install_model(model_name: str, checkpoint_dir: Path, force: bool = False) ->
def install(
models: list[str] = typer.Argument(
...,
help="Models to install: 'all', 'rfd3', 'rf3', 'mpnn', or combination",
help="Models to install: 'all', 'rfd3', 'rf3', 'mpnn', or a combination thereof",
),
checkpoint_dir: Optional[Path] = typer.Option(
None,
@@ -136,18 +143,12 @@ def install(
),
):
"""Install model checkpoints for foundry.
Examples:
foundry install all
foundry install rfd3 rf3
foundry install proteinmpnn --checkpoint-dir ./checkpoints
"""
# Determine checkpoint directory
if checkpoint_dir is None:
checkpoint_dir = get_default_checkpoint_dir()
checkpoint_dir = _resolve_checkpoint_dir(checkpoint_dir)
console.print(f"[bold]Checkpoint directory:[/bold] {checkpoint_dir}")
console.print()
@@ -177,26 +178,18 @@ def install(
console.print("[bold green]Installation complete![/bold green]")
@app.command(name="list")
def list_models():
@app.command(name="list-available")
def list_available():
"""List available model checkpoints."""
console.print("[bold]Available models:[/bold]\n")
for name, info in REGISTERED_CHECKPOINTS.items():
console.print(f" [cyan]{name:8}[/cyan] - {info.description}")
@app.command()
def show(
checkpoint_dir: Optional[Path] = typer.Option(
None,
"--checkpoint-dir",
"-d",
help="Checkpoint directory to show",
),
):
"""Show installed checkpoints."""
if checkpoint_dir is None:
checkpoint_dir = get_default_checkpoint_dir()
@app.command(name="list-installed")
def list_installed():
"""List installed checkpoints and their sizes."""
checkpoint_dir = _resolve_checkpoint_dir(None)
if not checkpoint_dir.exists():
console.print(
@@ -219,21 +212,14 @@ def show(
console.print(f"\n[bold]Total:[/bold] {total_size:.2f} GB")
@app.command()
@app.command(name="clean")
def clean(
checkpoint_dir: Optional[Path] = typer.Option(
None,
"--checkpoint-dir",
"-d",
help="Checkpoint directory to clean",
),
confirm: bool = typer.Option(
True, "--confirm/--no-confirm", help="Ask for confirmation before deleting"
),
):
"""Remove all downloaded checkpoints."""
if checkpoint_dir is None:
checkpoint_dir = get_default_checkpoint_dir()
checkpoint_dir = _resolve_checkpoint_dir(None)
if not checkpoint_dir.exists():
console.print(f"[yellow]No checkpoints found at {checkpoint_dir}[/yellow]")