Implementation of Memorizing Transformers (ICLR 2022), attention net augmented with indexing and retrieval of memories using approximate nearest neighbors, in Pytorch.
:chart_with_upwards_trend: Implementation of eight evaluation metrics to access the similarity between two images. The eight metrics are as follows: RMSE, PSNR, SSIM, ISSM, FSIM, SRE, SAM, and UIQ.
Unofficial PyTorch implementation of Denoising Diffusion Probabilistic Models.
Key parameters and specifications
Key parameters and specifications
Parameter
Value
Language
Python
Category
Model Development
Subcategory
Training toolkits
Stars
647
Forks
78
Contributors
1
Created date
2020-12-04
Updated date
2026-09-28
Stars in 1 day
0
Stars in 7 days
0
Rank
15,556
Previous rank
15,365
Rank change
-191
7-day stars rank
15,052
Previous 7-day stars rank
15,056
7-day stars rank change
4
Total stars rank
15,829
Previous total stars rank
15,801
Total stars rank change
-28
Country
USA
README summary
SAM: Sharpness-Aware Minimization for Efficiently Improving Generalization by Pierre Foret, Ariel Kleiner, Hossein Mobahi and Behnam Neyshabur. SAM in a few words **Abstract**: In today's heavily overparameterized models, the value of the training loss provides few guarantees on model generalization ability. Indeed, optimizing only the training loss value, as is commonly done, can easily lead to suboptimal model quality. In particular, our procedure, Sharpness-Aware Minimization (SAM), seeks parameters that lie in neighborhoods having uniformly low loss; this formulation
results in a min-max optimization problem on which gradient descent can be performed efficiently. We present empirical results showing that SAM improves model generalization across a variety of benchmark datasets (e. , CIFAR-{10, 100}, ImageNet, finetuning tasks) and models, yielding novel state-of-the-art performance for several. Additionally, we find that SAM natively provides robustness to label noise on par with that provided by state-of-the-art procedures that specifically target learning with noisy labels. Each point
is a different dataset / model / data augmentation | A sharp minimum to which a ResNet trained with SGD converged | A wide minimum to which the same ResNet trained with SAM converged. | About this repo This code allows the user to replicate most of the experiments of the paper, including: Training from scratch Wideresnets and Pyramidnets (with shake shake / shake drop) on CIFAR10/CIFAR100/SVHN/Fashion MNIST, with or without SAM, with or without cutout and AutoAugment. Training Resnets and Efficientnet on
Imagenet, with or without SAM or RandAugment. Finetuning Efficientnet from checkpoints trained on Imagenet/JFT on imagenet. How to train from scratch Once the repo is cloned, experiments can be launched using sam. py: Note that our code uses all available GPUs/TPUs for training. To see a detailed list of all available flags, run python3 -m sam. Output Training curves can be loaded using TensorBoard. TensorBoard events will be saved in the output_dir, and their path will contain
the learning_rate, the weight_decay, rho and the random_seed. 1% (ckpt) | | || | | | AutoAugment (AA) | 77. 3% (ckpt) || | | RandAugment (RA) | | | | | | 83. 4% (ckpt) | We report in this table the scores as found here. If you use these checkpoints with another codebase, you might obtain some slightly different scores based on the type of accelerator you use and your data processing pipeline (resizing algorithm in particular). Advprop requires some slight modification of the input pipeline. Please refer to the README of
the official tensorflow efficientnet implementation to see which paper should be cited for which checkpoint. Once the checkpoint is downloaded and uncompressed, it can be finetuned on any of the datasets: Bibtex **This is not an official Google product.
Frequently asked questions
How many stars and forks are recorded?
google-research/sam has 647 stars and 78 forks.
What is the repository rank?
google-research/sam is ranked 15,556.
What language and category are recorded?
google-research/sam has 647 stars, uses Python and belongs to Model Development.
Which repository is closest in rank?
google-research/sam is compared with daniilrobnikov/vits2, ranked 15,553 with 647 stars.
README
SAM: Sharpness-Aware Minimization for Efficiently Improving Generalization
by Pierre Foret, Ariel Kleiner, Hossein Mobahi and Behnam Neyshabur.
SAM in a few words
Abstract: In today's heavily overparameterized models, the value of the training loss provides few guarantees on model generalization ability. Indeed, optimizing only the training loss value, as is commonly done, can easily lead to suboptimal model quality. Motivated by the connection between geometry of the loss landscape and generalization---including a generalization bound that we prove here---we introduce a novel, effective procedure for instead simultaneously minimizing loss value and loss sharpness. In particular, our procedure, Sharpness-Aware Minimization (SAM), seeks parameters that lie in neighborhoods having uniformly low loss; this formulation results in a min-max optimization problem on which gradient descent can be performed efficiently. We present empirical results showing that SAM improves model generalization across a variety of benchmark datasets (e.g., CIFAR-{10, 100}, ImageNet, finetuning tasks) and models, yielding novel state-of-the-art performance for several. Additionally, we find that SAM natively provides robustness to label noise on par with that provided by state-of-the-art procedures that specifically target learning with noisy labels.
Error rate reduction obtained by switching to SAM. Each point is a different dataset / model / data augmentation
A sharp minimum to which a ResNet trained with SGD converged
A wide minimum to which the same ResNet trained with SAM converged.
About this repo
This code allows the user to replicate most of the experiments of the paper, including:
Training from scratch Wideresnets and Pyramidnets (with shake shake / shake drop) on CIFAR10/CIFAR100/SVHN/Fashion MNIST, with or without SAM, with or without cutout and AutoAugment.
Training Resnets and Efficientnet on Imagenet, with or without SAM or RandAugment.
Finetuning Efficientnet from checkpoints trained on Imagenet/JFT on imagenet.
How to train from scratch
Once the repo is cloned, experiments can be launched using sam.sam_jax.train.py:
Note that our code uses all available GPUs/TPUs for training.
To see a detailed list of all available flags, run python3 -m sam.sam_jax.train --help.
Output
Training curves can be loaded using TensorBoard. TensorBoard events will be
saved in the output_dir, and their path will contain the learning_rate,
the weight_decay, rho and the random_seed.
We report in this table the scores as found here. If you use these checkpoints with another codebase, you might obtain some slightly different scores based on the type of accelerator you use and your data processing pipeline (resizing algorithm in particular).
Advprop requires some slight modification of the input pipeline. See here for more details.
@ARTICLE{2020arXiv201001412F,
author = {{Foret}, Pierre and {Kleiner}, Ariel and {Mobahi}, Hossein and {Neyshabur}, Behnam},
title = "{Sharpness-Aware Minimization for Efficiently Improving Generalization}",
year = 2020,
eid = {arXiv:2010.01412},
eprint = {2010.01412},
}