Skip to main content

cjm-substrate-torch-utils

PyTorch helpers for cjm-substrate capabilities: GPU memory release, typed CUDA-OOM handling, and device selection.

Modules

  • cjm_substrate_torch_utils.device — Resolve a device spec (auto / cpu / cuda / cuda:N) to a concrete torch device string.
  • cjm_substrate_torch_utils.memory — Robust move-to-CPU + drop-references + gc + CUDA-cache cleanup for releasing models, factored out of the per-capability reimplementations.
  • cjm_substrate_torch_utils.oom — Convert torch CUDA out-of-memory exceptions into the substrate's typed CapabilityResourceError (SG-47 Track B) so CR-7 reactive retry can evict and reload.

API

cjm_substrate_torch_utils.device

  • resolve_torch_device function — Resolve a device spec to a concrete torch device string.

cjm_substrate_torch_utils.memory

  • release_model function — Release one or more model objects: move to CPU, drop references, gc, free CUDA cache.

cjm_substrate_torch_utils.oom

  • cuda_oom_to_capability_resource_error function — Convert a CUDA out-of-memory exception into a substrate-typed CapabilityResourceError.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cjm_substrate_torch_utils-0.0.13.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cjm_substrate_torch_utils-0.0.13-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file cjm_substrate_torch_utils-0.0.13.tar.gz.

File metadata

File hashes

Hashes for cjm_substrate_torch_utils-0.0.13.tar.gz
Algorithm Hash digest
SHA256 6918aac5c1b2a407bdc71be55828b7d535649f151af05056db20ad7c222ffa1e
MD5 ced1bb124e33e46658bd91a5e4325063
BLAKE2b-256 ab5c2b193f69c30d34a24efd20116728b7bb3915917f2d7de95e945cf6147c19

See more details on using hashes here.

File details

Details for the file cjm_substrate_torch_utils-0.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for cjm_substrate_torch_utils-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 55ade80158daf9d5d8c426bd85a4ebb17a5e1deaff901b0fc6dd78c715730b3d
MD5 c9456de3ff2ccf9e5e2fc1de9ddb0cf8
BLAKE2b-256 4e3d9a1f5ecd04909e8576fa819ecd40aa66b14cc39baceff5b0d621aa4ff3b4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.13 This release

2 files

0.0.12

2 files

0.0.11

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page