skillfed

lightly

A deep learning package for self-supervised learning

lightly v1.5.26 166.3K downloads/30d#10,502 on PyPI3,793
Permissive license Copyright (c) 2018 The Python Packaging Authority Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) Active released

What it is and what it does

Lightly is a self-supervised learning framework built on PyTorch that implements established SSL algorithms for computer vision. It provides modular, low-level building blocks—loss functions, model heads, and complete model implementations—that let you train neural networks on unlabeled image data by learning visual representations through contrastive or other self-supervised objectives. The framework supports models including MoCo, SimCLR, BYOL, SwaV, DenseCL, SimSiam, Barlow Twins, DetConS, DINO, NNCLR, and LeJEPA, with examples for both single-GPU PyTorch and distributed training via PyTorch Lightning.

You use it by selecting a model architecture, defining a loss function, and training on your unlabeled dataset—the learned representations can then be fine-tuned for downstream tasks like classification or detection. The package is designed to be accessible and PyTorch-idiomatic, with extensive documentation and Colab notebooks for each model. It depends on torch, torchvision, pytorch_lightning, hydra-core for configuration, and several utility libraries, making it suitable for research and production workflows where you have unlabeled image data and want to bootstrap a strong visual encoder.

Use it for:

  • Pretrain a vision encoder on a large unlabeled image dataset, then fine-tune it for classification or detection tasks downstream.
  • Experiment with different SSL algorithms (MoCo, SimCLR, BYOL, DINO) to compare their effectiveness on your specific domain.
  • Train distributed SSL models across multiple GPUs using PyTorch Lightning integration for large-scale pretraining.
  • Build custom SSL pipelines by composing loss functions and model heads for novel self-supervised objectives.
  • Reduce labeled data requirements by leveraging self-supervised pretraining before supervised fine-tuning.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Lightly provides self-supervised learning models and loss functions for computer vision, enabling you to train neural networks on unlabeled image data using methods like MoCo, SimCLR, BYOL, and DINO.

Yes. Lightly is actively maintained, MIT-licensed, and implements a mature set of self-supervised learning algorithms with low install friction. Install it if you need to train on unlabeled image data or experiment with SSL methods. The substantial dependency tree (torch, pytorch_lightning, hydra-core) is typical for deep learning and not a drawback if you're already in that ecosystem; it becomes a consideration only if you're adding it to a minimal environment.

Install

lightly on PyPI

pip

pip install lightly

uv

uv add lightly

poetry

poetry add lightly

Installing lightly

Before you install

Low install friction with a pure-Python wheel. Active maintenance with a recent release (18 days old) and steady repository activity. Requires 14 runtime dependencies including torch, torchvision, and pytorch_lightning, which are substantial but standard for deep learning work.

License in practice

MIT license permits commercial and private use with minimal restrictions—you may use, modify, and distribute the package freely provided you include the license notice.

Quickstart

pip install lightly

import lightly
from lightly.models import ResNetSimCLR
from lightly.loss import NTXentLoss

model = ResNetSimCLR()
loss = NTXentLoss()

Requires PyTorch and torchvision; GPU recommended for practical training but not strictly required.

Verify before relying

  • Whether the package includes pretrained model weights or requires training from scratch.
  • Performance characteristics and typical training time for supported models on standard datasets.
  • Compatibility with specific PyTorch versions beyond the stated Python version support.

Package facts

License Copyright (c) 2018 The Python Packaging Authority Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 14 — certifi, hydra-core, lightly_utils, numpy, python_dateutil, requests, six, tqdm, torch, torchvision, pydantic, pytorch_lightning, urllib3, aenum
Maintenance actively maintained — 18 days since the last release
Last repo commit
First released
Downloads 166,251/month — #10,502 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: lightly-1.5.26-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Scientific/Engineering :: Image ProcessingTopic :: Scientific/Engineering :: MathematicsTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules

Tags

self-supervised learning computer visioncontrastive learning framework pytorchssl pretraining modelsunlabeled image trainingvision representation learningpytorch ssl modelsmoco simclr byol dino
self-supervised-learningcomputer-visionpytorch

More Software Development packages