Instructions to use kernels-community/finegrained-fp8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use kernels-community/finegrained-fp8 with Kernels:
# !pip install kernels from kernels import get_kernel kernel = get_kernel("kernels-community/finegrained-fp8") - Notebooks
- Google Colab
- Kaggle
| import torch | |
| from contextlib import contextmanager | |
| def device_context(device: torch.device): | |
| """Context manager that sets the active device for any backend (cuda, xpu, etc.).""" | |
| backend = getattr(torch, device.type, None) | |
| if backend is not None and hasattr(backend, "device"): | |
| with backend.device(device): | |
| yield | |
| else: | |
| yield | |