Overview of CodeCarbon usage examples
masterThe CodeCarbon repository provides a wide range of examples categorized by use case:
- Quick Start: Hardware detection (
print_hardware.py) and tracking external CLI tools (command_line_tool.py). - Tracking Methods: Decorators, context managers, Keras/TensorFlow callbacks, and API integration.
- Machine Learning: Training (MNIST with TensorFlow, scikit-learn, PyTorch multi-GPU) and Hyperparameter Search (Grid/Random search).
- Inference: BERT, Hugging Face Transformers (SmolLM2), and local LLM APIs via Ollama.
- Hardware & Parallelism: Intel NPU support, full CPU utilization, multithreading, and RAPL vs CPU load comparisons.
- Integration & Logging: Exporting to BoAmps format, CSV files, Google Cloud Logging, Prometheus, Comet.ml, and Logfire.
- Metrics: Calculating Power Usage Effectiveness (PUE) and Water Usage Effectiveness (WUE).
- Notebooks: Interactive usage in Jupyter environments.