Generated from source signatures and docstrings without importing the runtime.
Detect and report hardware capabilities at registration.
Produce a useful hardware-first name without exposing an internal ID.
Return a capabilities dict for the registration message.
Main.
Settings.
def host_id(self)— Host id.def manager_url(self)— Manager url.def sharing_enabled(self)— Sharing enabled.def sharing_supported(self)— Whether this installation includes the per-workload OS sandbox.def saved_identity(self)— Saved identity.def saved_credential(self)— Saved credential.def work_dir(self)— Work dir.def compute_mode(self)— Compute mode.def cli_name(self)— Cli name.def update_identity(self, **values: object)— Update identity.def save_identity(self, host_id: str, credential: str, broker_url: str='')— Save identity.def clear_identity(self)— Clear identity.
Build sparse-or-dense fp16 model deltas and compress them with Zstandard.
SHA-256 over the fp32-canonicalized state_dict — verifies the base/result of a delta-based model sync (see executor.update_model). MUST stay byte-identical to the platform protocol. Both repositories lock this contract to the same golden digest in their own tests.
Delta construction was cancelled by the active task.
def compute_delta_file(original: dict[str, torch.Tensor], modified: dict[str, torch.Tensor], destination: str, threshold: float=0.0, abort_event: threading.Event | None=None)
Write a compressed delta to disk for direct multipart upload.
Isolated GPU training executor with disk-backed models and shard cache.
BaseException prevents user except Exception blocks swallowing Stop.
A deliberate, non-retryable transfer cancellation.
Executor.
def work_dir(self)— Work dir.def abort_event(self)— Task-scoped cancellation signal for transfers owned by the session.def load(self, model_url: str, dataset_shards: list[dict | str], code: str, batch_size: int=32, params: dict | None=None, initial_shard_index: int=0)— Download the model and stage only the first bounded microshard.def run(self, steps: int=100, round_num: int=0, total_rounds: int=1, mode: str='training', step_offset: int=0)— Start user code in a background thread.def update_model(self, model_url: str, params: dict | None=None, dataset_shards: list[dict | str] | None=None, delta_url: str | None=None, base_hash: str | None=None, result_hash: str | None=None)— Prepare the model for the next round: apply middleware's fp16 sync delta to the model file already on disk when possible (see _try_delta_update), otherwise download the full model from model_url — which also serves as the automatic fallback whenever the delta path can't be used (hash mismatch, missing base, any error). A sync must never fail BECAUSE of the delta mechanism.def get_original_state(self)— Returns the pre-training state_dict, reloading it from self._model_path on demand — it's deliberately not kept resident in RAM between load()/update_model() and this call (see their comments). mmap-backed: this reload sits on every round boundary's critical path right before the delta computation, and mmap turns a full multi-GB read+copy into lazy page-in as compute_delta walks the keys. Safe here because nothing rewrites _model_path while the delta is being computed (update_model comes later).def get_shard(self, i: int)— Load one disk-backed shard; retain only its decoded value in memory.def get_shard_path(self, i: int)— Return a task-local shard file for the isolated runner.def wait(self)— Block until user code finishes (used for testing / sequential flow).def stop(self)— Stop.def reset(self)— Reset.def is_running(self)— Is running.def shutdown(self)— stop() + remove the temp directory (downloaded model files). Called when the WS session ends — every reconnect builds a fresh Executor with a fresh tmpdir, so without this each reconnect leaked a directory holding a potentially multi-GB model file until the disk filled. Idempotent.
Which physical GPU NVML calls should target on this process.
Physical GPU index for an NVML call, given how many devices NVML itself currently enumerates (pynvml.nvmlDeviceGetCount()).
ComputeField Machine WebSocket client.
Main.
Safe preparation and automatic materialization of Hugging Face bundles.
Return a canonical state file and optional local Hugging Face config root.
Build a built-in architecture and apply Transformers' key conversions.
Background hardware monitor — polls GPU (pynvml/MPS) and CPU/RAM (psutil) on a fixed interval.
Starts a daemon thread that calls callback(stats_dict) every interval seconds. Returns a threading.Event — set it to stop the monitor. stats_dict always contains cpu_util, ram_used_mb, and ram_total_mb. GPU fields added when available: NVIDIA (pynvml): gpu_util, gpu_mem_used_mb, gpu_mem_total_mb, gpu_temp_c Apple MPS: gpu_mem_used_mb (unified memory allocated by MPS)
Two-sided account pairing for ComputeField Machine.
Claim a browser-created code and wait for owner confirmation.
Finish pairing.
OS-backed workload sandboxing without a VM or desktop container product.
The required host sandbox could not be constructed.
Backend name.
Wrap command in the native host sandbox; never return it unwrapped.
Start a credential-free, network-free workload process.
Prove that a new process can run but cannot read identity or use IP networking.
Fail-closed syntax and capability gate for Workbench programs.
Unsafescript.
Parse and validate Machine code against the explicit capability set.
Execute validated code with a reduced builtin and import namespace.
Estimate broker link throughput using one bounded echoed binary frame.
Speedtesterror.
Returns {"upload_mbps", "download_mbps", "payload_bytes"}. Raises SpeedTestError if the echoed payload doesn't match what was sent.
Credential-free child process used exclusively for workload execution.
Main.
Exclusive, crash-cleaned storage for tenant-bound Machine artifacts.
Own one Machine work root for the daemon's complete lifetime.
def close(self)— Close.