rome.data¶
Data Manager — collects scored outputs and builds them into a dataset.
The host workflow already produces scored things: completions with rewards,
sequences with pLDDT/pTM/pAE, designs with a simulation score. ROME's data
manager is where those land. Any task, on any node, calls DataManager.add
and the record becomes part of the training corpus; the training manager reads
the corpus back out as a dataset when it is time to train.
Records are stored one key per record (see rome.utils) so concurrent
producers never clobber each other, and the corpus is monotonic: adding is the
only thing the host workflow does. Filtering, deduplication and sampling are
applied on the way out, when a dataset is built.
META_NS
module-attribute
¶
Namespace holding bookkeeping counters (consumed watermark, etc).
CONSUMED_KEY
module-attribute
¶
Key under META_NS counting records already folded into a round.
DataConfig
dataclass
¶
DataConfig(min_samples: int = 32, max_records: Optional[int] = None, score_key: str = 'score', min_score: Optional[float] = None, filter_func: Optional[Callable[[Dict[str, Any]], bool]] = None, dedup_key: Optional[Callable[[Dict[str, Any]], Any]] = None, sample_func: Optional[Callable[[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, sampling: str = 'all', shard_size: Optional[int] = None, consume_on_train: bool = True, metadata: Dict[str, Any] = dict())
Knobs for how the data manager turns raw scored outputs into a dataset.
Parameters:
-
min_samples(int, default:32) –How many unconsumed records must accumulate before the training manager considers a round possible. This is the "training starts automatically once enough data accumulates" threshold.
-
max_records(Optional[int], default:None) –Soft cap on corpus size. When exceeded, the oldest records are evicted on the next
DataManager.add.None(the default) keeps everything.Warning
On Dragon, leave this unset unless you have measured that you need it. Eviction is the only thing that pops from the corpus dictionary, and a Dragon
DDict.keys()scan silently returns a truncated list when another client pops concurrently — one measured scan returned 39 of 400 keys and reported success. With no evictions the corpus is never popped, so scans are exact and the training shard is complete. Seedocs/dragon.md. -
score_key(str, default:'score') –Field of a record holding its scalar quality score. Used by the built-in
top_ksampler and bymin_score. -
min_score(Optional[float], default:None) –Reject records scoring below this on the way in.
Noneaccepts all. -
filter_func(Optional[Callable[[dict], bool]], default:None) –Arbitrary admission predicate, applied after
min_score. ReturnFalseto drop the record. This is where IMPRESS-R plugs in its pLDDT/pTM/pAE thresholds. -
dedup_key(Optional[Callable[[dict], Any]], default:None) –Returns a hashable identity for a record. Records whose identity was already seen are dropped.
Nonedisables deduplication. -
sample_func(Optional[Callable[[List[dict]], List[dict]]], default:None) –Builds the training shard from the corpus. Overrides
sampling. -
sampling(str, default:'all') –Built-in shard builder:
'all'(default),'top_k'(bestshard_sizebyscore_key) or'recent'(newestshard_size). -
shard_size(Optional[int], default:None) –Number of records the built-in samplers draw.
Nonemeans no limit. -
consume_on_train(bool, default:True) –When
True(default) records handed to a training round count as consumed, so the next round waits formin_samplesnew records. The corpus itself is never deleted.
metadata
class-attribute
instance-attribute
¶
Extra fields stamped onto every record (run id, campaign name, ...).
DataManager
¶
DataManager(ddict: Namespace, config: Optional[DataConfig] = None)
Gathers scored outputs from the host workflow and creates a dataset.
The public surface is deliberately tiny — the slide deck's promise is that adopting ROME costs a few API calls:
add/add_batch— call from anywhere in the workflowget_dataset— what the training task trains onready_to_train/unconsumed_count— what the training manager polls
Parameters:
-
ddict(Namespace) –Shared state. Every ROME component in a run must be handed the same one (
Managerdoes this for you). -
config(DataConfig, default:None) –Defaults are used when omitted.
Source code in rome/data.py
consumed_count
property
¶
Number of records already folded into a completed training round.
unconsumed_count
property
¶
Records added since the last training round consumed the corpus.
model_version
property
¶
Version of the model currently published by the training manager.
Stamped onto each record so a later analysis can tell which model generated it — the "produced_under_version" idea from IMPRESS-R.
add
¶
Add one scored output to the corpus.
Everything is keyword-driven so the same call works for any domain::
rome.data.add(prompt=p, completion=c, score=reward)
rome.data.add(sequence=seq, pdb_path=pdb, score=plddt, pTM=ptm)
Parameters:
-
score(float, default:None) –The record's scalar quality. Stored under
config.score_key. -
uid(str, default:None) –Caller-supplied identity. Generated when omitted.
-
**fields(Any, default:{}) –Arbitrary payload, stored verbatim.
Returns:
-
Optional[str]–The record uid, or
Nonewhen the record was filtered out.
Source code in rome/data.py
add_batch
¶
Add many records at once; returns the uids that were accepted.
Source code in rome/data.py
get_records
¶
Every record in the corpus, oldest first.
Source code in rome/data.py
get_dataset
¶
Build the training dataset from the corpus.
Applies config.sample_func when set, otherwise the built-in
config.sampling strategy.
Parameters:
-
as_hf_dataset(bool, default:False) –Return a
datasets.Datasetinstead of a list of dicts. Requiresdatasetsto be installed; the LLM trainer needs it, the MPNN trainer does not, which is why it is opt-in.
Source code in rome/data.py
ready_to_train
¶
mark_consumed
¶
Record that count records were used for training.
Called by the training manager when a round completes. Defaults to the
whole current corpus. No-op when config.consume_on_train is off, so
a workflow that wants to retrain on everything every round can.
Source code in rome/data.py
clear
¶
Drop the entire corpus. Returns the number of records removed.