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.__init__
  • 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.
  • is_cuda_oom function — Classify CUDA OOM across BOTH raise paths: the caching allocator's

Dependencies

Depends on: cjm-substrate, numpy, torch Used by: cjm-capability-demucs, cjm-capability-pyannote, cjm-capability-qwen3-forced-aligner, cjm-capability-voxtral-hf, cjm-capability-whisper, cjm-substrate-hf-utils

Metadata

Release files for cjm-substrate-torch-utils 0.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cjm-substrate-torch-utils 0.0.14
File Size Uploaded
cjm_substrate_torch_utils-0.0.14.tar.gz 10.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cjm-substrate-torch-utils 0.0.14
File Interpreter ABI Platform
cjm_substrate_torch_utils-0.0.14-py3-none-any.whl Python 3 none any Details

Total release size: 21.3 kB

Release files / cjm_substrate_torch_utils-0.0.14.tar.gz

Download URL cjm_substrate_torch_utils-0.0.14.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dec95476785ac8e1760207a1b28fa746fd765b2112ba84c3ea7271e91e923bb9
BLAKE2b-256 checksum
How to use checksums
ebaff98930b861f86cb460e2fda0f9042cfb3273925394e24df03ca7a8bb6cd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / cjm_substrate_torch_utils-0.0.14-py3-none-any.whl

Download URL cjm_substrate_torch_utils-0.0.14-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ca87292abf50326b040b7676c70a5b58092b148fb597345a9e651436d352d88
BLAKE2b-256 checksum
How to use checksums
2ec71eacc6314466c5ebbbd50f25f0929c1faf7c9eb7cf04e7c1f97197e0291e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

0.0.14 This release

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release 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