cloud
cloud(
model,
*,
remote=False,
cache=True,
dashboard=None,
notify=False,
instance=None,
progress=True,
project=None,
until=None,
overwrite=False,
)Context manager that intercepts PyMC operations with remote execution, caching, live dashboard, and push notifications.
Remote containers stay warm for 20 minutes after the last run.
Runs the full MCMC workflow in the cloud: pm.sample (NUTS via nutpie / pymc / numpyro / blackjax, and custom step= methods), pm.sample_smc, pm.sample_prior_predictive / pm.sample_posterior_predictive, and pm.compute_log_likelihood (for az.loo / az.waic / az.compare). Optimization-based inference (pm.fit variational, pm.find_MAP) and non-InferenceData utilities (pm.compute_deterministics, pm.draw) are not yet routed to the cloud and still run locally. For remote pm.sample, return_inferencedata=False and a per-draw callback= can’t be matched exactly and warn instead of silently diverging. The Stop button can abort nutpie/pymc runs early (keeping the partial trace); JAX samplers (numpyro/blackjax) and SMC have no per-draw hook and run to completion.
Usage::
with cp.cloud(model, remote=True): # cloud + live dashboard
with cp.cloud(model, remote=True, notify=True): # cloud + dashboard + ntfy
with cp.cloud(model, remote=True, dashboard=False): # cloud, no dashboard
with cp.cloud(model, cache="disk"): # local + disk cache
with cp.cloud(model, notify=True): # local + ntfy notifications
Methods
| Name | Description |
|---|---|
| destroy | Tear down this session’s environment. |
destroy
cloud.destroy(delete_volume=False)Tear down this session’s environment.
Call after the with block to immediately stop the container::
session = cp.cloud(model, remote=True)
with session:
idata = pm.sample(draws=2000)
session.destroy()
Only this session’s model is affected. delete_volume=True also deletes the project-wide Volume, discarding every model’s uploaded payload – opt-in because the project is shared with other sessions.