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_devicefunction — Resolve a device spec to a concrete torch device string.
cjm_substrate_torch_utils.memory
release_modelfunction — 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_errorfunction — Convert a CUDA out-of-memory exception into a substrate-typedCapabilityResourceError.is_cuda_oomfunction — 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)
| File | Size | Uploaded | |
|---|---|---|---|
| cjm_substrate_torch_utils-0.0.14.tar.gz | 10.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|