Skip to main content

Grokfast

Project description

Grokfast - Pytorch (wip)

Explorations into "Grokfast, Accelerated Grokking by Amplifying Slow Gradients", out of Seoul National University in Korea. In particular, will compare it with NAdam on modular addition as well as a few other tasks, since I am curious why those experiments are left out of the paper. If it holds up, will polish it up into a nice package for quick use.

Install

$ pip install grokfast-pytorch

Usage

import torch
from torch import nn

# toy model

model = nn.Linear(10, 1)

# import GrokFastAdamW and instantiate with parameters

from grokfast_pytorch import GrokFastAdamW

opt = GrokFastAdamW(model.parameters(), lr = 1e-4)

# forward and backwards

loss = model(torch.randn(10))
loss.backward()

# optimizer step

opt.step()
opt.zero_grad()

Citations

@inproceedings{Lee2024GrokfastAG,
    title   = {Grokfast: Accelerated Grokking by Amplifying Slow Gradients},
    author  = {Jaerin Lee and Bong Gyun Kang and Kihoon Kim and Kyoung Mu Lee},
    year    = {2024},
    url     = {https://api.semanticscholar.org/CorpusID:270123846}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grokfast_pytorch-0.0.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

grokfast_pytorch-0.0.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file grokfast_pytorch-0.0.1.tar.gz.

File metadata

  • Download URL: grokfast_pytorch-0.0.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for grokfast_pytorch-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7f929bf90bd886a91264c57263cb3bb616dd817f3b960c13f94a4c4580b06256
MD5 a96049e21ab917050976eb515b7ed39b
BLAKE2b-256 3a7c166a44c4a9efdb28abee8954fc843adc2b0dce5f27a58eb0750984de48c4

See more details on using hashes here.

File details

Details for the file grokfast_pytorch-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for grokfast_pytorch-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 77589f708c6d6362c10828deaf728e70a42b5ee56edf7d8efc5c62a309957903
MD5 1628ca55e69854611e6e053cc4986fbf
BLAKE2b-256 e8abcc4cc83f1973ca9132f84d1ac56d50cd317816909ecc1665f98bdb70456b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page