import numpy as np
# ------------------- quantisation helpers (same as user's snippet) -----------
def activation_quant(x):
scale = 127.0 / np.maximum(np.max(np.abs(x), axis=-1, keepdims=True), 1e-5)
return np.round(x * scale).clip(-128, 127) / scale
def weight_quant(w):
scale = 1.0 / np.maximum(np.mean(np.abs(w)), 1e-5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Cross-entropy fine-tune on PrimeIntellect/SYNTHETIC-1 | |
– ZeRO-2 (no remote_device) | |
– Flash-Attn-2 enabled after loading | |
""" | |
import argparse, json, os | |
from pathlib import Path | |
from typing import Iterable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```python | |
import numpy as np | |
# ------------------- quantisation helpers (same as user's snippet) ----------- | |
def activation_quant(x): | |
scale = 127.0 / np.maximum(np.max(np.abs(x), axis=-1, keepdims=True), 1e-5) | |
return np.round(x * scale).clip(-128, 127) / scale | |
def weight_quant(w): | |
scale = 1.0 / np.maximum(np.mean(np.abs(w)), 1e-5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
pip install git+ https://github.com/childressg/matmulfreellm/tree/master/mmfreelm/ops | |
``` | |
``` | |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
DeepSpeed ZeRO for memory-efficient training (stage 3). |
Genhead Agents
You can use this diagram as a template to create your own git branching diagrams. Here's how:
- Create a new diagram with diagrams.net (formerly draw.io)
- Go to File > Open From > URL
- Insert this url (it points to the xml data below):
https://gist.githubusercontent.com/bryanbraun/8c93e154a93a08794291df1fcdce6918/raw/bf563eb36c3623bb9e7e1faae349c5da802f9fed/template-data.xml
- Customize as needed for your team.