SimCLR in PyTorch, with numbers and no Apex
A clean reimplementation of Google’s contrastive learning paper that includes native mixed precision and the boring-but-necessary linear evaluation protocol.

What it does
This is a readable PyTorch reimplementation of SimCLR, the Google framework that learns vision representations by teaching a model which augmented views of an image belong together. After pretraining on unlabeled data, it freezes the backbone and trains a linear classifier on top, giving you concrete top-1 accuracy on STL-10 and CIFAR-10 rather than just loss curves.
The interesting bit
The author skipped NVIDIA Apex in favor of PyTorch’s native AMP for 16-bit training, removing one common dependency headache. The bundled evaluation protocol is the quietly valuable part: most SimCLR repos stop at pretraining, but this one ships a Colab notebook that runs the full linear-probe test.
Key highlights
- Native PyTorch AMP for 16-bit training; no Apex required.
- Linear evaluation via an included Colab notebook, not just pretraining code.
- Reported top-1 accuracy: 74.45% on STL-10 and 69.82% on CIFAR-10 using ResNet-18.
- CPU debug mode available for quick smoke tests.
- Companion blog post breaks down the architecture in detail.
Caveats
- The provided checkpoints mix architectures and training durations—ResNet-18 runs for 100 epochs while ResNet-50 stops at 50—so you cannot directly compare model sizes from the table alone.
- Results are limited to small-scale datasets; ImageNet benchmarks are not included.
Verdict
Use this if you want a teaching-friendly SimCLR baseline with evaluation baked in. Look elsewhere if you need ImageNet-scale weights or a distributed training framework.
Frequently asked
- What is sthalles/SimCLR?
- A clean reimplementation of Google’s contrastive learning paper that includes native mixed precision and the boring-but-necessary linear evaluation protocol.
- Is SimCLR open source?
- Yes — sthalles/SimCLR is open source, released under the MIT license.
- What language is SimCLR written in?
- sthalles/SimCLR is primarily written in Jupyter Notebook.
- How popular is SimCLR?
- sthalles/SimCLR has 2.5k stars on GitHub.
- Where can I find SimCLR?
- sthalles/SimCLR is on GitHub at https://github.com/sthalles/SimCLR.