LittlePlyResearch notebook

curriculum_loss.py

python · 5 lines · Exact bytes

Line 1 ↗
Version & provenance · theory-cm7

Recorded SHA-256 fdc4e8709e5d945fa620ee1ce5b4fa66a18d62192e8b2ad656d7674d5c8b3f61Rendered SHA-256 fdc4e8709e5d945fa620ee1ce5b4fa66a18d62192e8b2ad656d7674d5c8b3f61

Apache-2.0 original project code; dependencies retain their own licenses. License notes. Line links are stable within this snapshot. CM-7 completed implementation source; original and public rendered hashes recorded. Host-specific paths use /work placeholders; inspect reproduction instructions before running. Separate Rust helper retains its GPL license.

1"""DDP averages gradients; normalize by the whole accumulated global target count."""
2def weighted_loss(loss,world,global_targets,empty=False):
3    if global_targets<=0:raise ValueError('empty global update')
4    return loss.sum()*(0. if empty else world/global_targets)
5