Skip to content

Fix visited-set shape in paired MSA construction - #256

Open
fnachon wants to merge 9 commits into
HannesStark:mainfrom
fnachon:fix/msa-paired-visited-set
Open

Fix visited-set shape in paired MSA construction#256
fnachon wants to merge 9 commits into
HannesStark:mainfrom
fnachon:fix/msa-paired-visited-set

Conversation

@fnachon

@fnachon fnachon commented Jul 10, 2026

Copy link
Copy Markdown

taxonomy_map is [(taxon, [(chain_id, seq_idx), ...]), ...], but visited = {(c, s) for c, items in taxonomy_map for s in items} bound c=taxon and s=(chain_id, seq_idx) (the whole tuple), so visited ended up containing (taxon, (chain_id, seq_idx)) entries instead of (chain_id, seq_idx) entries. The later (c, i) not in visited check (building available[c]) can then never match, so sequences already consumed by taxonomy-based pairing aren't excluded from the pool of "available" filler sequences and can be reused.

Found this by comparing against a fix for the equivalent bug in fnachon/boltz (a fork of jwohlwend/boltz, which boltzgen's MSA featurization code is derived from).

fnachon and others added 9 commits January 10, 2026 15:54
Changes made to run without errors on the Mac MPS device: torch.autocast, number of devices and workers to use on M1-5 chips, workaround for CUDA-specific code, handling of float64 incompatibilities for MPS.
Replace hardcoded torch.autocast("cuda") with device-agnostic
device_type=tensor.device.type in confidence_utils, inverse_fold,
and writer modules introduced in the upstream merge.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Python pickle does not preserve RDKit atom-level SetProp values. When
PyTorch DataLoader spawns worker processes (default num_workers=1 on
macOS), self.canonicals is pickled and all atom 'name' properties are
lost, causing KeyError in process_atom_features.

Fix: load all required molecules directly from the moldir zip inside
each get_sample() / get_feat() call instead of using the pickled
self.canonicals. The moldir zip handle is cached per-process by
_get_zipfile(), so there is no repeated I/O overhead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ders

- Disable pin_memory on MPS (unsupported, causes UserWarning)
- Enable persistent_workers when num_workers > 0 (avoids repeated
  worker init overhead and the PL suggestion warning)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
taxonomy_map is [(taxon, [(chain_id, seq_idx), ...]), ...], but the
comprehension unpacked it as `for c, items in taxonomy_map for s in
items`, binding c=taxon and s=(chain_id, seq_idx) whole. visited
ended up containing (taxon, (chain_id, seq_idx)) tuples instead of
(chain_id, seq_idx) tuples, so the later `(c, i) not in visited`
check on chain_id/seq_idx pairs could never match. Sequences already
consumed by taxonomy-based pairing were therefore not excluded from
the "available" pool and could be reused as filler rows.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant