rome.dummy¶
Dummy components for exercising ROME without a model.
Everything here has the same shape as a real ROME trainer or stream function and none of the cost: the trainer sleeps instead of fine-tuning, and the model emits a placeholder string instead of generating. That makes them useful for
- smoke-testing a new execution backend or allocation, where the question is whether tasks are placed and whether the DDict is reachable, not whether the model learns;
- demonstrating the closed loop end to end in seconds (see
examples/agnostic/dummy_loop.py); - standing in for one half of a real campaign while the other half is built.
The dummy checkpoint is a real file on disk holding the round's version, so a stream that reloads it genuinely observes the new version rather than being told about it. A run therefore fails in the same places a real one would --- an unwritable checkpoint directory, a DDict that is not shared, a stream that never sees a publication.
Both the trainer and the inference function block on time.sleep. That is
correct rather than sloppy: ROME runs a synchronous trainer inside an
asyncflow task and a synchronous process_func in a worker thread, so neither
sleep stalls the event loop the other streams are sharing.
DEFAULT_TEMPLATE
module-attribute
¶
What a dummy model "generates".
{uuid} is a fresh UUID per output; {version} and {index} are
available for callers who want the model version or the position in the batch
visible in the text itself.
CHECKPOINT_FILE
module-attribute
¶
Filename the dummy trainer writes and the dummy model reads back.
DummyTrainer
¶
DummyTrainer(*, train_seconds: float = 2.0, gpus: int = 1, nodes: int = 1, name: Optional[str] = None, fail_every: Optional[int] = None)
Bases: TrainTask
A training task that pretends to train.
Sleeps for train_seconds to stand in for compute, then writes a
checkpoint recording what the round would have learned from. The sleep is
the point: it makes a round take long enough that the surrounding
machinery --- the RUNNING status, streams continuing to serve while a
round is in flight, a stop request waiting for the round rather than
cancelling it --- is actually observable.
Parameters:
-
train_seconds(float, default:2.0) –How long a round pretends to take.
-
gpus(int, default:1) –Resources declared to the workflow engine, exactly as a real trainer would. Nothing uses them, but a backend smoke test wants them requested.
-
nodes(int, default:1) –Resources declared to the workflow engine, exactly as a real trainer would. Nothing uses them, but a backend smoke test wants them requested.
-
name(str, default:None) –Checkpoint directories are named after this. Defaults to
"dummy". -
fail_every(Optional[int], default:None) –Raise on every
n-th round. Used to exercise the training manager's failure handling;None(default) never fails.
Source code in rome/dummy.py
rounds
instance-attribute
¶
One entry per completed round: what it trained on and for how long.
wants_hf_dataset
class-attribute
instance-attribute
¶
Set on subclasses that want a datasets.Dataset rather than a list.
train
¶
Pretend to train on dataset; return the checkpoint directory.
Source code in rome/dummy.py
as_command
¶
Optionally run this round as an executable task instead of a function.
Return (shell_command, checkpoint_path) to have the training manager
submit shell_command as an executable task — a subprocess on the
allocation's resources, the way IMPRESS submits its wrapper scripts —
rather than pickling train into a worker. checkpoint_path is
where the command will write the checkpoint, since an executable task's
return value is not the path.
Return None (the default) to run train in-process as a
function task. A GPU fine-tune should prefer the command form: the
subprocess exits when the round ends, releasing its VRAM.
Completion contract: the command MUST write a file named
train_complete (rome.trainer.TRAIN_COMPLETE_MARKER) into its
output_dir as its final action, after the checkpoint is safely on
disk. The training manager polls for that marker to detect the round
finished, because on Dragon a task can run to completion and never
resolve its future (a running service blocks result delivery — see
docs/dragon.md). The marker, not the checkpoint, is the signal: with
publish-in-place the checkpoint path already exists from the prior round.
Source code in rome/train/base.py
validate
¶
Raise if dataset cannot be trained on.
Called by the training manager before a task is scheduled, so an unusable corpus fails fast on the manager instead of burning an HPC allocation. The default check is just "not empty".
Source code in rome/train/base.py
prepare_output_dir
staticmethod
¶
Standard checkpoint layout: <base_dir>/<name>/v<version>.
Source code in rome/train/base.py
DummyModel
¶
DummyModel(checkpoint_path: Optional[str] = None, template: str = DEFAULT_TEMPLATE, latency: float = 0.0)
A model that generates a placeholder string.
Reports the version it was loaded from, read out of the checkpoint file rather than passed in, so that a reload is observable from the output alone.
Parameters:
-
checkpoint_path(Optional[str], default:None) –Where it was loaded from.
Nonemeans untrained (version 0). -
template(str, default:DEFAULT_TEMPLATE) –Output format.
{uuid}is substituted with a fresh UUID per call;{version}and{index}are also available. -
latency(float, default:0.0) –Seconds one generation pretends to take.
Source code in rome/dummy.py
generate
¶
Produce one placeholder output.
write_dummy_checkpoint
¶
Write the placeholder checkpoint a dummy round produces.
Source code in rome/dummy.py
read_dummy_checkpoint
¶
Read a dummy checkpoint, tolerating one that was never written.
A stream starts before the first training round completes, so "no checkpoint yet" is the normal initial state, not an error: it reports version 0, which is what the untrained model is.
Source code in rome/dummy.py
dummy_load
¶
dummy_load(checkpoint_path: Optional[str], ctx: Any = None, template: str = DEFAULT_TEMPLATE, latency: float = 0.0) -> DummyModel
load_func for a dummy inference stream.
Called once at startup and again every time the training manager publishes
a checkpoint. Pass template and latency through
StreamConfig.load_kwargs.
Source code in rome/dummy.py
dummy_infer
¶
process_func for a dummy inference stream.
Returns one placeholder output per prompt, generated by whichever model version the stream currently holds.
Source code in rome/dummy.py
dummy_reward
¶
process_func for a dummy reward stream.
Emits a corpus-shaped record per output, so a manager with this stream configured accumulates training data with no scoring code at all. Real reward functions vary the score; this one is deliberately constant, so a run's behaviour depends only on the plumbing under test.