DeployedGraph¶
The DeployedGraph class orchestrates distributed execution of Falcon graphs using Ray.
Overview¶
DeployedGraph wraps a Graph and handles:
- one or more sample actors per node (
SampleActor, named after the node), which serve prior, proposal and posterior samples; - one train actor per estimator node (
TrainActor, named<node>/train), which trains the networks and publishes each new best state to the node's sample actors; - the simulation loop that fills the buffer while the train actors run.
Pass train=False to deploy sample actors only, as falcon sample does.
Class Reference¶
DeployedGraph
¶
Deploy a graph as Ray actors.
Every node gets num_actors sample actors; estimator nodes also get
one train actor, unless train is False (sampling only).
Note: This class uses falcon.info(), falcon.warning() etc. for logging. These functions use the module-level logger set by cli.py via set_logger().
Source code in src/falcon/core/deployed_graph.py
deploy_nodes
¶
Deploy all nodes in the graph as Ray actors.
Source code in src/falcon/core/deployed_graph.py
sample
¶
Run forward sampling through the graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_samples
|
Number of samples to generate |
required | |
conditions
|
Optional dict of pre-set conditions (arrays/tensors) |
None
|
Returns:
| Type | Description |
|---|---|
|
List[Dict[str, ObjectRef]]: One dict per sample with refs to all node values |
Source code in src/falcon/core/deployed_graph.py
sample_posterior
¶
Run posterior sampling through the inference graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_samples
|
Number of samples to generate |
required | |
conditions
|
Optional dict of pre-set conditions (arrays/tensors) |
None
|
Returns:
| Type | Description |
|---|---|
|
List[Dict[str, ObjectRef]]: One dict per sample with refs to all node values |
Source code in src/falcon/core/deployed_graph.py
sample_proposal
¶
Run proposal sampling through the inference graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_samples
|
Number of samples to generate |
required | |
conditions
|
Optional dict of pre-set conditions (arrays/tensors) |
None
|
Returns:
| Type | Description |
|---|---|
|
List[Dict[str, ObjectRef]]: One dict per sample with refs to all node values |
Source code in src/falcon/core/deployed_graph.py
sample_ppd
¶
Run posterior predictive distribution (PPD) sampling.
Two-phase: sample latent variables from the posterior, then forward-simulate observables from those posterior samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_samples
|
Number of samples to generate |
required | |
conditions
|
Observations dict (same as passed to sample_posterior) |
None
|
Returns:
| Type | Description |
|---|---|
|
List[Dict[str, ObjectRef]]: One dict per sample with refs to all node values (both posterior latents and forward-simulated observables) |
Source code in src/falcon/core/deployed_graph.py
get_status
¶
Status of all actors, keyed by actor name (z, z/train), and of the buffer.
Source code in src/falcon/core/deployed_graph.py
shutdown
¶
Shut down the deployed graph and release resources.
launch
¶
Launch training.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_manager
|
Dataset manager for samples |
required | |
observations
|
Observation data |
required | |
graph_path
|
Path to save/load graph |
None
|
|
stop_check
|
Optional callable that returns True when graceful stop is requested |
None
|
Source code in src/falcon/core/deployed_graph.py
save
¶
Save the checkpoints of all trained nodes.
Source code in src/falcon/core/deployed_graph.py
load
¶
Load the checkpoints of all estimator nodes into their actors.
Source code in src/falcon/core/deployed_graph.py
resolve_actor_options
¶
Split a node's ray: config into sample-actor and train-actor options.
num_sample_gpus / num_train_gpus set the GPUs of each actor, and
num_sample_cpus / num_train_cpus their CPUs (default: num_cpus);
every other Ray option applies to both. The deprecated num_gpus is
split evenly between the two actors, so the node keeps its GPU budget.
Returns:
| Type | Description |
|---|---|
Tuple[dict, Optional[dict], List[str]]
|
(sample_options, train_options or None, warnings) |