Keys & Caches CLI - Accelerate your Python functions with cloud GPUs
Project description
Keys & Caches
The fastest way to run PyTorch models on cloud GPUs with automatic profiling and performance insights.
๐ What is Keys & Caches?
Keys & Caches is a command-line tool that makes it effortless to run PyTorch models on high-performance cloud GPUs. With just one command, you can:
- ๐ Submit jobs to cloud GPUs - Access A100, H100, and L4 GPUs instantly
- ๐ Get automatic profiling - Detailed performance traces for every model forward pass
- ๐ Debug performance bottlenecks - Chrome trace format for visual analysis
- โก Stream real-time logs - Watch your training progress live
- ๐ฐ Pay only for what you use - No idle time charges
๐ฏ Key Features
๐ฎ One-Command Deployment
# Run any PyTorch script on cloud GPUs
kandc python train.py --model-size large --epochs 100
๐ Automatic Model Profiling
from kandc import capture_model_class
@capture_model_class(model_name="MyModel")
class MyModel(nn.Module):
# Your model automatically gets profiled!
๐ฎ Flexible GPU Configurations
- A100 GPUs (40GB/80GB) - Proven performance for training and inference
- H100 GPUs (80GB) - Latest architecture with enhanced performance
- L4 GPUs (24GB) - Cost-effective option for efficient workloads
- Scale 1-8 GPUs - From development to massive scale training
๐ง Installation
Prerequisites
- Python 3.8+ (Python 3.9+ recommended)
- PyTorch installed in your environment
Install Keys & Caches
pip install kandc
Verify Installation
kandc --version
๐ฏ Quick Start (5 Minutes)
1. Create a Simple Model
Create my_first_model.py:
import torch
import torch.nn as nn
from kandc import capture_model_class
@capture_model_class(model_name="FirstModel")
class SimpleModel(nn.Module):
def __init__(self):
super().__init__()
self.layers = nn.Sequential(
nn.Linear(784, 256),
nn.ReLU(),
nn.Linear(256, 128),
nn.ReLU(),
nn.Linear(128, 10)
)
def forward(self, x):
return self.layers(x)
def main():
print("๐ Running my first Keys & Caches job!")
model = SimpleModel()
x = torch.randn(32, 784)
# Forward pass (automatically profiled!)
model.eval()
with torch.no_grad():
output = model(x)
print(f"โ
Output shape: {output.shape}")
print("โ
Job completed successfully!")
if __name__ == "__main__":
main()
2. Test Locally First
python my_first_model.py
3. Run on Cloud GPUs
kandc python my_first_model.py
That's it! Your model runs on high-performance GPUs with automatic profiling. ๐
๐ฎ Command Formats
Interactive Format (Beginner-Friendly)
kandc python my_model.py --epochs 10 --batch-size 32
- Prompts you for job configuration (app name, GPU count, etc.)
- Great for getting started and experiments
Separator Format (Automation-Ready)
kandc --app-name "my-experiment" --gpu A100-80GB:2 -- python my_model.py --epochs 10
- Fully specified with
--separator - Ideal for scripts and automation
๐ฏ GPU Options
| GPU Type | Count | Memory | Use Case | Example Flag |
|---|---|---|---|---|
| A100-40GB | 1-8 | 40GB each | Cost-effective training | --gpu A100:4 |
| A100-80GB | 1-8 | 80GB each | High-memory models | --gpu A100-80GB:2 |
| H100 | 1-8 | 80GB each | Latest architecture | --gpu H100:8 |
| L4 | 1-8 | 24GB each | Efficient inference | --gpu L4:1 |
๐ Automatic Model Profiling
Keys & Caches automatically profiles your models:
Class Decorator (Most Common)
from kandc import capture_model_class
@capture_model_class(model_name="MyModel")
class MyModel(nn.Module):
# Your model definition
Instance Wrapper (For Pre-built Models)
from kandc import capture_model_instance
# For HuggingFace models, etc.
model = AutoModel.from_pretrained("bert-base-uncased")
model = capture_model_instance(model, model_name="BERT")
Profiling Features
- โฑ๏ธ Layer-level timing - See which layers are bottlenecks
- ๐พ Memory tracking - Monitor GPU memory usage
- ๐ Shape recording - Debug tensor dimension issues
- ๐ Chrome traces - Visual timeline in chrome://tracing
๐ก Examples
Computer Vision
# ResNet training
kandc python examples/vision_models/resnet_example.py
NLP & Transformers
# HuggingFace BERT
kandc --requirements requirements_examples/nlp_requirements.txt -- python examples/nlp_models/pretrained_models.py
Vision-Language Models
# OpenAI CLIP
kandc --requirements requirements_examples/vlm_requirements.txt -- python examples/vlm_models/clip_example.py
Generative Models
# GANs and VAEs
kandc python examples/generative_models/gan_example.py
๐ Documentation
- ๐ Getting Started - Installation, setup, and your first GPU job
- ๐ก Examples - Comprehensive examples and use cases
- ๐ Contact & Support - Get help and connect with the community
๐ฐ Publishing to PyPI
Prerequisites
# Install build and publishing tools
pip install build twine
# Ensure you have PyPI credentials configured
# Create ~/.pypirc or use environment variables
Build and Upload Process
# 1. Update version in pyproject.toml
# Edit the version field: version = "0.1.1"
# 2. Clean previous builds
rm -rf dist/ build/
# 3. Build the package
python -m build
# 4. Check the built package
twine check dist/*
# 6. Upload to PyPI
twine upload dist/*
๐ Support
- ๐ง Email: support@herdora.com
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
๐ License
MIT License - see LICENSE for details.
Ready to accelerate your ML workflows? Install Keys & Caches and run your first GPU job in under 5 minutes! ๐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kandc-0.0.2.tar.gz.
File metadata
- Download URL: kandc-0.0.2.tar.gz
- Upload date:
- Size: 30.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69505d983601d59addff3aaf3a6407a324e148d14f16a6e63c857b29d4684a17
|
|
| MD5 |
5e52afe49b57147ff7501e44c8bc6b1a
|
|
| BLAKE2b-256 |
ceba9cbacae1b5263ccfecc22845b02d27194cebc4f1510ee52569415f397b80
|
File details
Details for the file kandc-0.0.2-py3-none-any.whl.
File metadata
- Download URL: kandc-0.0.2-py3-none-any.whl
- Upload date:
- Size: 30.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88e6e7ea424e3897236b1b603f456ccccade03bfc545ad141c172752dd1284b7
|
|
| MD5 |
1d90f0a53b12e255135b557714261ba1
|
|
| BLAKE2b-256 |
d2815ddaa2a2e67ca44094ae409804eccf25c8d28e0deff4342cd88198243d52
|