Skip to main content

PythonTorchProject

Struct PythonTorchProject 

Source
pub struct PythonTorchProject { /* private fields */ }
Expand description

Python/Torch-backed workload bridge implemented on top of the generic p2p runtime.

Implementations§

Source§

impl PythonTorchProject

Source

pub fn new(config: PythonTorchWorkloadConfig) -> Result<Self>

Spawns the backing Python worker and probes its runtime capability.

Source

pub fn new_with_data_pipeline( config: PythonTorchWorkloadConfig, data_pipeline: LeaseDataPipeline<String, PythonBatchRef>, ) -> Result<Self>

Spawns the backing Python worker with an explicit lease data pipeline.

Source

pub fn sharded_data_pipeline( dataset: &PythonTorchDatasetConfig, ) -> LeaseDataPipeline<String, PythonBatchRef>

Returns the default shard-backed lease data pipeline for one dataset config.

Source

pub fn micro_epoch_pipeline( descriptor: LeaseDataPipelineDescriptor, dataset_registration: impl Fn() -> Result<DatasetRegistration> + Send + Sync + 'static, microshard_plan: impl Fn(&DatasetRegistration) -> Result<MicroShardPlan> + Send + Sync + 'static, payload: impl Fn(&AssignmentLease, &[CachedMicroShard]) -> Result<Value> + Send + Sync + 'static, ) -> LeaseDataPipeline<String, PythonBatchRef>

Builds a generic Python micro-epoch pipeline backed by workload-defined payloads.

Source

pub fn indexed_dataset_pipeline( pipeline_name: impl Into<String>, dataset_registration: impl Fn() -> Result<DatasetRegistration> + Send + Sync + 'static, microshard_plan: impl Fn(&DatasetRegistration) -> Result<MicroShardPlan> + Send + Sync + 'static, payload: impl Fn(&AssignmentLease, &[CachedMicroShard]) -> Result<Value> + Send + Sync + 'static, ) -> LeaseDataPipeline<String, PythonBatchRef>

Builds a Python pipeline for existing torch Dataset/Sampler-style data flows.

Source

pub fn generated_dataset_pipeline( pipeline_name: impl Into<String>, dataset_registration: impl Fn() -> Result<DatasetRegistration> + Send + Sync + 'static, microshard_plan: impl Fn(&DatasetRegistration) -> Result<MicroShardPlan> + Send + Sync + 'static, payload: impl Fn(&AssignmentLease, &[CachedMicroShard]) -> Result<Value> + Send + Sync + 'static, ) -> LeaseDataPipeline<String, PythonBatchRef>

Builds a Python pipeline for deterministic synthetic or recipe-driven data generation.

Source

pub fn probe_capability(&self) -> &CapabilityEstimate

Returns the worker-advertised capability estimate.

Source

pub fn runtime_device_name(&self) -> &str

Returns the resolved runtime device tag.

Source

pub fn workload_name(&self) -> &str

Returns the Python-side workload name advertised by the worker.

Source

pub fn data_pipeline_descriptor(&self) -> &LeaseDataPipelineDescriptor

Returns the static lease/micro-epoch data pipeline descriptor.

Source

pub fn data_pipeline_kind(&self) -> LeaseDataPipelineKind

Returns the configured lease/micro-epoch pipeline kind.

Source

pub fn data_pipeline_registration(&self) -> Result<DatasetRegistration>

Returns the dataset registration backing the current pipeline.

Source

pub fn local_upstream_root(&self) -> Result<Option<PathBuf>>

Returns the local upstream root when the current pipeline is backed by a Local dataset registration.

Source

pub fn configured_shard_root(&self) -> &Path

Returns the configured shard root for the default sharded Python dataset config. This is configuration data only and may be unrelated to the active pipeline when new_with_data_pipeline(...) is used.

Trait Implementations§

Source§

impl Clone for PythonTorchProject

Source§

fn clone(&self) -> PythonTorchProject

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PythonTorchProject

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl P2pWorkload for PythonTorchProject

Source§

type Device = String

Defines the device alias.
Source§

type Model = PythonModelHandle

Defines the model alias.
Source§

type Batch = PythonBatchRef

Defines the batch alias.
Source§

type WindowStats = BTreeMap<String, MetricValue>

Defines the window stats alias.
Source§

fn init_model(&self, device: &Self::Device) -> Self::Model

Initializes a model instance for the provided backend device.
Source§

fn benchmark( &self, _model: &Self::Model, _device: &Self::Device, ) -> CapabilityEstimate

Benchmarks the workload and reports the runtime capability estimate.
Source§

fn train_window( &self, ctx: &mut WindowCtx<Self::Device, Self::Model, Self::Batch>, ) -> Result<WindowReport<Self::WindowStats>, TrainError>

Runs one training window for the leased batches.
Source§

fn evaluate(&self, model: &Self::Model, split: EvalSplit) -> MetricReport

Evaluates the model on the requested dataset split.
Source§

fn apply_patch(&mut self, patch: &RuntimePatch) -> PatchOutcome

Applies a runtime patch to the workload implementation.
Source§

fn supported_patch_classes(&self) -> PatchSupport

Returns the patch classes accepted by the workload implementation.
Source§

fn runtime_device(&self) -> Self::Device

Returns the runtime device used by the workload.
Source§

fn dataset_registration(&self) -> Result<DatasetRegistration>

Returns the dataset registration used to plan microshards.
Source§

fn microshard_plan( &self, _registration: &DatasetRegistration, ) -> Result<MicroShardPlan>

Builds the microshard plan for the registered dataset.
Source§

fn load_batches( &self, lease: &AssignmentLease, cached_microshards: &[CachedMicroShard], ) -> Result<Vec<Self::Batch>>

Loads training batches for the lease from cached microshards.
Source§

fn load_model_artifact( &self, model: Self::Model, descriptor: &ArtifactDescriptor, store: &FsArtifactStore, _device: &Self::Device, ) -> Result<Self::Model>

Loads a model artifact from the artifact store into the runtime model representation.
Source§

fn materialize_model_artifact( &self, model: &Self::Model, artifact_kind: ArtifactKind, head_id: HeadId, base_head_id: Option<HeadId>, store: &FsArtifactStore, ) -> Result<ArtifactDescriptor>

Materializes a model artifact into the checkpoint store.
Source§

fn contribution_metrics( &self, report: &WindowReport<Self::WindowStats>, ) -> BTreeMap<String, MetricValue>

Returns receipt metrics for a completed training window.
Source§

fn contribution_weight(&self, report: &WindowReport<Self::WindowStats>) -> f64

Returns the contribution weight used for receipt scoring.
Source§

fn reconcile_canonical_model( &self, local_model: &Self::Model, canonical_model: Self::Model, strategy: TrainerCanonicalReconcileStrategy, ) -> Result<Self::Model>

Reconciles a speculative local trainer model with a newly visible canonical model.
Source§

fn merge_candidate_models( &self, base_model: &Self::Model, candidates: &[MergeModelCandidate<'_, Self::Model>], policy: MergePolicy, ) -> Result<Option<Self::Model>>

Optionally merges candidate models into one merged model.
Source§

fn apply_single_root_ema( &self, base_model: &Self::Model, merged_model: Self::Model, policy: MergePolicy, ) -> Result<Self::Model>

Optionally applies single-root EMA after merge selection.
Source§

fn supported_workload(&self) -> SupportedWorkload

Returns the supported workload manifest.
Source§

fn model_schema_hash(&self) -> ContentId

Returns the stable model schema hash.
Source§

fn workload_id(&self) -> WorkloadId

Returns the workload id.
Source§

fn switch_runtime_workload( &mut self, workload_id: &WorkloadId, ) -> Result<(), Error>

Switches the live runtime to one other compiled workload when supported. Read more
Source§

fn checkpoint_format_hash(&self) -> ContentId

Returns the checkpoint format hash.
Source§

fn verify_revision(&self, revision: &RevisionManifest) -> Result<(), Error>

Verifies that the runtime workload matches one revision manifest.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more