Skip to content

Commit 2e3703e

Browse files
jsspencercopybara-github
authored andcommitted
fix support for sharded databases
PiperOrigin-RevId: 836803355 Change-Id: Icc263c4a1ca153da99a71a336e1150b351cc4d27
1 parent e850301 commit 2e3703e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

run_alphafold.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import alphafold3.cpp
4242
from alphafold3.data import featurisation
4343
from alphafold3.data import pipeline
44+
from alphafold3.data.tools import shards
4445
from alphafold3.jax.attention import attention
4546
from alphafold3.model import features
4647
from alphafold3.model import model
@@ -667,7 +668,11 @@ def replace_db_dir(path_with_db_dir: str, db_dirs: Sequence[str]) -> str:
667668
raise FileNotFoundError(
668669
f'{path_with_db_dir} with ${{DB_DIR}} not found in any of {db_dirs}.'
669670
)
670-
if not os.path.exists(path_with_db_dir):
671+
if (sharded_paths := shards.get_sharded_paths(path_with_db_dir)) is not None:
672+
db_exists = all(os.path.exists(p) for p in sharded_paths)
673+
else:
674+
db_exists = os.path.exists(path_with_db_dir)
675+
if not db_exists:
671676
raise FileNotFoundError(f'{path_with_db_dir} does not exist.')
672677
return path_with_db_dir
673678

0 commit comments

Comments
 (0)