Spaces:
Sleeping
Sleeping
Commit Β·
78f4a0d
1
Parent(s): cf92bd1
enrich: replace 'review-pending' placeholders with curated descriptions on 28 discovered tools
Browse files- forge/enrich.py +79 -0
- forge/forge.db +0 -0
forge/enrich.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Replace 'Discovered via Bright Data scraping (review-pending)' placeholders with
|
| 2 |
+
real curated descriptions for the 28 well-known ML tools node-discovery surfaced.
|
| 3 |
+
|
| 4 |
+
The BD-scrape pass for integration snippets + citation URLs is a separate step
|
| 5 |
+
(enrich_with_examples) that burns credits meaningfully β for now, this just
|
| 6 |
+
gets the live demo off placeholder text.
|
| 7 |
+
|
| 8 |
+
Run: python -m forge.enrich
|
| 9 |
+
"""
|
| 10 |
+
from __future__ import annotations
|
| 11 |
+
|
| 12 |
+
from . import db
|
| 13 |
+
|
| 14 |
+
# Curated one-liners. Specific, factual, no marketing fluff.
|
| 15 |
+
DESCRIPTIONS = {
|
| 16 |
+
# frameworks
|
| 17 |
+
"accelerate": "HuggingFace library that wraps PyTorch training to add multi-GPU, mixed-precision, and DeepSpeed/FSDP support with minimal code changes.",
|
| 18 |
+
"megatron": "NVIDIA's framework for training large transformer models with tensor + pipeline parallelism. Heavy-iron, multi-node scale.",
|
| 19 |
+
"pytorch": "The dynamic-graph deep-learning framework underneath nearly everything in modern ML training.",
|
| 20 |
+
"pytorchfsdp": "PyTorch's native Fully-Sharded Data Parallel β shards parameters, gradients, and optimizer state across GPUs. Alternative to DeepSpeed ZeRO.",
|
| 21 |
+
"tensorrtmodeloptimizer": "NVIDIA library for compressing models with PTQ, sparsity, and distillation before TensorRT deployment.",
|
| 22 |
+
"tensorrtllm": "NVIDIA's runtime for fast LLM inference on its GPUs. Inference-time, not training.",
|
| 23 |
+
"transformerengine": "NVIDIA library for FP8 training/inference on Hopper+ GPUs. Drop-in replacement for transformer blocks.",
|
| 24 |
+
"transformers": "HuggingFace's model library β the de-facto interface for loading and fine-tuning open LLMs.",
|
| 25 |
+
# optimizers
|
| 26 |
+
"adagrad": "Adaptive gradient optimizer that scales the per-parameter LR by accumulated squared gradients. Mostly superseded by AdamW for LLMs.",
|
| 27 |
+
"pagedoptimizers": "bitsandbytes optimizer that pages optimizer state between GPU and CPU RAM to handle memory spikes during QLoRA training.",
|
| 28 |
+
"rmsprop": "Adaptive optimizer that divides the gradient by a running average of its magnitude. Direct ancestor of Adam.",
|
| 29 |
+
"sgd": "Stochastic gradient descent β the classical optimizer. Still competitive with proper LR + momentum, but rarely the default for LLM finetuning.",
|
| 30 |
+
"shampoo": "Second-order optimizer using Kronecker-factored preconditioning. Promising at scale but compute-heavy.",
|
| 31 |
+
# quantization
|
| 32 |
+
"4bitquantization": "Storing model weights in 4 bits. The basis of QLoRA (via bitsandbytes NF4).",
|
| 33 |
+
"doublequantization": "QLoRA technique that quantizes the quantization constants themselves, saving an extra ~0.4 bits per parameter.",
|
| 34 |
+
"fp8": "8-bit floating-point format on Hopper/Blackwell GPUs for training + inference. Used via Transformer Engine.",
|
| 35 |
+
"ptq": "Post-training quantization β quantize weights after training without retraining. AWQ and GPTQ are PTQ methods.",
|
| 36 |
+
"bitsandbytes": "The library implementing 4-bit (NF4) and 8-bit weight quantization that powers QLoRA on consumer GPUs.",
|
| 37 |
+
# schedulers
|
| 38 |
+
"cosineannealinglr": "PyTorch's cosine decay scheduler. Anneals LR from max to min over the run.",
|
| 39 |
+
"reducelronplateau": "Scheduler that drops the LR when a tracked metric stops improving.",
|
| 40 |
+
"steplr": "Scheduler that multiplies LR by gamma every N epochs. Simple staircase decay.",
|
| 41 |
+
# techniques
|
| 42 |
+
"dora": "Weight-Decomposed LoRA β separates a weight update into magnitude and direction. Drop-in upgrade to LoRA with negligible overhead.",
|
| 43 |
+
"flashattention": "Memory-efficient exact attention kernel that avoids materializing the full attention matrix. Essential at long contexts.",
|
| 44 |
+
"peft": "HuggingFace library implementing parameter-efficient finetuning methods (LoRA, QLoRA, DoRA, IA3, etc.).",
|
| 45 |
+
"relora": "Restart-LoRA β periodically merges LoRA adapters into the base and re-initializes new ones, enabling higher effective rank than vanilla LoRA.",
|
| 46 |
+
"tensorparallelism": "Sharding a single layer's matmul across GPUs along the hidden dim. Standard for large-model training/inference.",
|
| 47 |
+
"mixedprecision": "Training with bf16/fp16 weights and fp32 master weights β saves memory and speeds up matmul without losing convergence.",
|
| 48 |
+
"pruning": "Setting unimportant weights to zero to reduce model size or compute. Structured pruning is GPU-friendly.",
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def run(path=db.DB_PATH):
|
| 53 |
+
conn = db.connect(path)
|
| 54 |
+
updated, missed = [], []
|
| 55 |
+
rows = conn.execute(
|
| 56 |
+
"SELECT id, canonical, name FROM nodes WHERE tags_json LIKE '%discovered%'"
|
| 57 |
+
).fetchall()
|
| 58 |
+
for r in rows:
|
| 59 |
+
desc = DESCRIPTIONS.get(r["canonical"])
|
| 60 |
+
if desc:
|
| 61 |
+
conn.execute("UPDATE nodes SET description=? WHERE id=?", (desc, r["id"]))
|
| 62 |
+
updated.append(r["name"])
|
| 63 |
+
else:
|
| 64 |
+
missed.append((r["canonical"], r["name"]))
|
| 65 |
+
conn.commit()
|
| 66 |
+
return updated, missed
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def main():
|
| 70 |
+
updated, missed = run()
|
| 71 |
+
print(f"updated {len(updated)} discovered-tool descriptions")
|
| 72 |
+
if missed:
|
| 73 |
+
print(f"no curated description for: {missed}")
|
| 74 |
+
else:
|
| 75 |
+
print("no placeholders remain.")
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
if __name__ == "__main__":
|
| 79 |
+
main()
|
forge/forge.db
CHANGED
|
Binary files a/forge/forge.db and b/forge/forge.db differ
|
|
|