{"id":21221718,"url":"https://github.com/glambard/adamw_keras","last_synced_at":"2025-07-10T13:32:53.453Z","repository":{"id":54698798,"uuid":"139555377","full_name":"GLambard/AdamW_Keras","owner":"GLambard","description":"AdamW optimizer for Keras","archived":false,"fork":false,"pushed_at":"2019-08-09T01:51:41.000Z","size":7,"stargazers_count":115,"open_issues_count":1,"forks_count":33,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-05T13:51:26.988Z","etag":null,"topics":["adam","adamw","keras","optimizer","tensorflow"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GLambard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-03T08:52:21.000Z","updated_at":"2025-04-02T02:34:51.000Z","dependencies_parsed_at":"2022-08-14T00:20:38.258Z","dependency_job_id":null,"html_url":"https://github.com/GLambard/AdamW_Keras","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GLambard/AdamW_Keras","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GLambard%2FAdamW_Keras","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GLambard%2FAdamW_Keras/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GLambard%2FAdamW_Keras/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GLambard%2FAdamW_Keras/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GLambard","download_url":"https://codeload.github.com/GLambard/AdamW_Keras/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GLambard%2FAdamW_Keras/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264585371,"owners_count":23632646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adam","adamw","keras","optimizer","tensorflow"],"created_at":"2024-11-20T22:31:58.827Z","updated_at":"2025-07-10T13:32:53.096Z","avatar_url":"https://github.com/GLambard.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Fixing Weight Decay Regularization in Adam](https://arxiv.org/abs/1711.05101) - For [Keras](https://keras.io/) :zap: :smiley:\n\nImplementation of the [**AdamW optimizer**](https://arxiv.org/abs/1711.05101)(**Ilya Loshchilov, Frank Hutter**) for [Keras](https://keras.io/). \n\n## Tested on this system\n\n- python 3.6\n- Keras 2.1.6\n- tensorflow(-gpu) 1.8.0\n\n## Usage\n\nAdditionally to a usual Keras setup for neural nets building (see [Keras](https://keras.io/) for details)\n```\nfrom AdamW import AdamW\n\nadamw = AdamW(lr=0.001, beta_1=0.9, beta_2=0.999, epsilon=None, decay=0., weight_decay=0.025, batch_size=1, samples_per_epoch=1, epochs=1)\n```\nThen nothing change compared to the usual usage of an optimizer in Keras after the definition of a model's architecture\n```\nmodel = Sequential()\n\u003cdefinition of the model_architecture\u003e\nmodel.compile(loss=\"mse\", optimizer=adamw, metrics=[metrics.mse], ...)\n```\n\nNote that the size of a batch (batch_size), number of training samples per epoch (samples_per_epoch) and the number of epochs (epochs) are necessary to the normalization of the weight decay ([paper](https://arxiv.org/abs/1711.05101), Section 4)\n\n## Done \n- Weight decay added to the parameters optimization\n- Normalized weight decay added \n\n## To be done (eventually - help is welcome)\n- Cosine annealing\n- Warm restarts\n\n# Source\n\n[**ADAM: A METHOD FOR STOCHASTIC OPTIMIZATION**](https://arxiv.org/pdf/1412.6980v8.pdf), D.P. Kingma, J. Lei Ba\n\n[**Fixing Weight Decay Regularization in Adam**](https://arxiv.org/pdf/1711.05101.pdf), I. Loshchilov, F. Hutter\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglambard%2Fadamw_keras","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglambard%2Fadamw_keras","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglambard%2Fadamw_keras/lists"}