Instructions to use agentic-ptb/grok-record with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Grok
How to use agentic-ptb/grok-record with Grok:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download harness/scripts/soup.py from agentic-ptb/grok-record: direct link, hf CLI and curl.
- Browser
- Download file 1.77 kB
-
https://huggingface.co/agentic-ptb/grok-record/resolve/main/harness/scripts/soup.py
- Command line
-
hf download hf://agentic-ptb/grok-record/harness/scripts/soup.py
-
curl -L -o soup.py https://huggingface.co/agentic-ptb/grok-record/resolve/main/harness/scripts/soup.py
1.77 kB
| #!/usr/bin/env python3 | |
| """Average two of our own checkpoints (same architecture).""" | |
| from __future__ import annotations | |
| import json | |
| import shutil | |
| import sys | |
| from pathlib import Path | |
| import torch | |
| from safetensors.torch import load_file, save_file | |
| def main(): | |
| a, b, out, wa = Path(sys.argv[1]), Path(sys.argv[2]), Path(sys.argv[3]), float(sys.argv[4]) | |
| wb = 1.0 - wa | |
| out.mkdir(parents=True, exist_ok=True) | |
| shards = sorted(a.glob("model-*.safetensors")) | |
| if not shards: | |
| raise SystemExit(f"no shards in {a}") | |
| index = {"metadata": {"format": "pt"}, "weight_map": {}} | |
| for sa in shards: | |
| sb = b / sa.name | |
| ta = load_file(str(sa), device="cpu") | |
| tb = load_file(str(sb), device="cpu") | |
| merged = {} | |
| for k in ta: | |
| if k not in tb: | |
| merged[k] = ta[k] | |
| continue | |
| if ta[k].dtype in (torch.float16, torch.bfloat16, torch.float32): | |
| merged[k] = (ta[k].float() * wa + tb[k].float() * wb).to(ta[k].dtype) | |
| else: | |
| merged[k] = ta[k] | |
| dest = out / sa.name | |
| save_file(merged, str(dest)) | |
| for k in merged: | |
| index["weight_map"][k] = sa.name | |
| print("wrote", dest.name, "tensors", len(merged)) | |
| (out / "model.safetensors.index.json").write_text(json.dumps(index, indent=2)) | |
| for name in ( | |
| "config.json", | |
| "generation_config.json", | |
| "tokenizer.json", | |
| "tokenizer_config.json", | |
| "chat_template.jinja", | |
| "special_tokens_map.json", | |
| ): | |
| src = a / name | |
| if src.exists(): | |
| shutil.copy2(src, out / name) | |
| (out / "STABLE").write_text("ok\n") | |
| print("done", out, "w", wa, wb) | |
| if __name__ == "__main__": | |
| main() | |