Download runtime/training/readout_cpu.py from hscr/luxfer: direct link, hf CLI and curl.
- Browser
- Download file 713 Bytes
-
https://huggingface.co/hscr/luxfer/resolve/main/runtime/training/readout_cpu.py
- Command line
-
hf download hf://hscr/luxfer/runtime/training/readout_cpu.py
-
curl -L -o readout_cpu.py https://huggingface.co/hscr/luxfer/resolve/main/runtime/training/readout_cpu.py
713 Bytes
| """Frozen CPU projection profiles for the native Portuguese readout trainer.""" | |
| from inference.mixed_precision import FP32Linear | |
| PROFILES = ("checkpoint", "fp32-head-and-8-mlps") | |
| def configure_cpu_projections(model, profile, check_resources): | |
| if profile == "checkpoint": | |
| return | |
| blocks = [getattr(layer, "base", layer) for layer in model.model.layers.layers] | |
| model.lm_head.base = FP32Linear(model.lm_head.base) | |
| check_resources() | |
| for index, block in enumerate(blocks): | |
| if index < 6 or index >= len(blocks) - 2: | |
| block.mlp.gate_up_proj = FP32Linear(block.mlp.gate_up_proj) | |
| block.mlp.down_proj = FP32Linear(block.mlp.down_proj) | |
| check_resources() | |