Spaces:
Running
Running
Download lpu/__init__.py from iparaco/Virtual-LPU: direct link, hf CLI and curl.
- Browser
- Download file 1.62 kB
-
https://huggingface.co/spaces/iparaco/Virtual-LPU/resolve/main/lpu/__init__.py
- Command line
-
hf download hf://spaces/iparaco/Virtual-LPU/lpu/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/iparaco/Virtual-LPU/resolve/main/lpu/__init__.py
1.62 kB
| """LPU Virtual Runtime - intelligent GPU acceleration layer for PyTorch workloads. | |
| Primary target: Super-Resolution training on Windows 11 with dual Tesla P100 | |
| (Pascal, sm_60, no Tensor Cores). Designed for any CUDA-capable NVIDIA GPU. | |
| Design rules enforced across this package: | |
| * No fabricated metrics. Anything not measured is labeled an estimate. | |
| * NumPy is never described as CUDA. CUDA execution = torch CUDA tensors only. | |
| * Per-GPU memory accounting. VRAM is never treated as a unified pool. | |
| * The target project's Python environment is never modified (read-only). | |
| * Every optimization is reversible and fails open to plain PyTorch behavior. | |
| Torch is imported LAZILY (see lpu.compat): importing `lpu` never loads torch, | |
| so the background controller keeps a tiny torch-free footprint. | |
| Get torch via `from lpu.compat import require_torch`. | |
| """ | |
| from .version import __version__, PACKAGE_NAME, COMPATIBILITY | |
| from .compat import optional_import, require_torch, TORCH_AVAILABLE | |
| __all__ = [ | |
| "__version__", | |
| "PACKAGE_NAME", | |
| "COMPATIBILITY", | |
| "optional_import", | |
| "require_torch", | |
| "TORCH_AVAILABLE", | |
| ] | |
| def training_session(model, train_loader=None, config=None, name: str = "train", | |
| criterion=None, optimizer=None, batch_size=None): | |
| """Convenience constructor for lpu.training.TrainingSession (V4 kwargs).""" | |
| from .training import TrainingSession | |
| return TrainingSession(model, train_loader=train_loader, config=config, | |
| name=name, criterion=criterion, optimizer=optimizer, | |
| batch_size=batch_size) | |