Registry / ai-ml / cpm-kernels

cpm-kernels

JSON →
library1.0.11pypypiunverified

CUDA kernels for the CPM (Chinese Pre-trained Model) family, providing optimized operations like rotary position embedding, layer normalization, and activation functions. Current version is 1.0.11, with irregular release cadence.

pip install cpm-kernels
INSTALL
IMPORT
SIG · CPM-KERNELS
C
cpm-kernels
ai-mlpythonv1.0.11
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CPUKernel
from cpm_kernels import CPUKernel
from cpm_kernels import CPUKernel

Initialize CPMKernel and apply rotary position embedding on a random tensor.

import torch from cpm_kernels import CPMKernel device = 'cuda' if torch.cuda.is_available() else 'cpu' x = torch.randn(2, 4, 64).to(device) kernel = CPMKernel() result = kernel.rotary_embedding(x, start=0) print(result.shape)
Debug
Known issues
gotchaRequires a CUDA-capable GPU and PyTorch compiled with CUDA. Runtime errors if no GPU available.
fix
Ensure torch.cuda.is_available() is True before using.
affects: all
deprecatedSome kernel functions (e.g., 'fused_ln') are deprecated in newer versions and may be removed. Check documentation.
fix
Use recommended alternatives (e.g., torch's native layernorm) or avoid deprecated calls.
affects: >=1.0.0
Upgrade
Version history
1.0.11latest on PyPI · released Mar 7, 2022
Audit
Dependencies
torchrequiredCUDA kernels require PyTorch with CUDA support
Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
cpm-kernels — pip install cpm-kernels · libregistry