Skip to content

Commit fb0c60a

Browse files
committed
add num sample steps and ability to sample structure on cuda if available, for @Kaihui-Cheng
1 parent 24c491c commit fb0c60a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

alphafold3_pytorch/cli.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@
1919
@click.option('-prot', '--protein', type = str, multiple = True, help = 'protein sequences')
2020
@click.option('-rna', '--rna', type = str, multiple = True, help = 'single stranded rna sequences')
2121
@click.option('-dna', '--dna', type = str, multiple = True, help = 'single stranded dna sequences')
22+
@click.option('-steps', '--num-sample-steps', type = int, help = 'number of sampling steps to take')
23+
@click.option('-cuda', '--use-cuda', type = bool, help = 'use cuda if available')
2224
@click.option('-o', '--output', type = str, help = 'output path', default = 'output.cif')
2325
def cli(
2426
checkpoint: str,
2527
protein: list[str],
2628
rna: list[str],
2729
dna: list[str],
30+
num_sample_steps: int,
31+
use_cuda: bool,
2832
output: str
2933
):
3034

@@ -39,8 +43,16 @@ def cli(
3943

4044
alphafold3 = Alphafold3.init_and_load(checkpoint_path)
4145

46+
if use_cuda and torch.cuda.is_available():
47+
alphafold3 = alphafold3.cuda()
48+
4249
alphafold3.eval()
43-
structure, = alphafold3.forward_with_alphafold3_inputs(alphafold3_input, return_bio_pdb_structures = True)
50+
51+
structure, = alphafold3.forward_with_alphafold3_inputs(
52+
alphafold3_input,
53+
return_bio_pdb_structures = True,
54+
num_sample_steps = num_sample_steps
55+
)
4456

4557
output_path = Path(output)
4658
output_path.parents[0].mkdir(exist_ok = True, parents = True)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "alphafold3-pytorch"
3-
version = "0.5.17"
3+
version = "0.5.18"
44
description = "Alphafold 3 - Pytorch"
55
authors = [
66
{ name = "Phil Wang", email = "[email protected]" },

0 commit comments

Comments
 (0)