Search is not available for this dataset
repo stringlengths 2 152 ⌀ | file stringlengths 15 239 | code stringlengths 0 58.4M | file_length int64 0 58.4M | avg_line_length float64 0 1.81M | max_line_length int64 0 12.7M | extension_type stringclasses 364
values |
|---|---|---|---|---|---|---|
lightly | lightly-master/docs/source/tutorials_source/platform/tutorial_pizza_filter.py | # -*- coding: utf-8 -*-
"""
This documentation accompanies the video tutorial: `youtube link <https://youtu.be/imQWZ0HhYjk>`_
##############################################################################
.. _lightly-tutorial-pizza-filter:
Tutorial 1: Curate Pizza Images
===============================
.. warning:... | 6,748 | 31.291866 | 112 | py |
lightly | lightly-master/docs/source/tutorials_source/platform/tutorial_sunflowers.py | """
.. _lightly-tutorial-sunflowers:
Tutorial 2: Diversify the Sunflowers Dataset
=============================================
.. warning::
**Tutorial is outdated**
This tutorial uses a deprecated workflow of the Lightly Solution and will be removed in the future.
Please refer to the `new documentation... | 5,955 | 42.474453 | 117 | py |
lightly | lightly-master/examples/README.md | # Examples
We provide example implementations for self-supervised learning models for PyTorch and PyTorch Lightning to give you a headstart when implementing your own model!
All examples can be run from the terminal with:
```
python <path to example.py>
```
The examples should also run on [Google Colab](https://c... | 715 | 31.545455 | 265 | md |
lightly | lightly-master/examples/pytorch/barlowtwins.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import torch
import torchvision
from torch import nn
from lightly.loss import BarlowTwinsLoss
from lightly.models.modul... | 1,923 | 27.716418 | 77 | py |
lightly | lightly-master/examples/pytorch/byol.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import torch
import torchvision
from torch import nn
from lightly.loss import NegativeCosineSimilarity
fro... | 2,999 | 30.578947 | 81 | py |
lightly | lightly-master/examples/pytorch/dcl.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import torch
import torchvision
from torch import nn
from lightly.loss import DCLLoss
from lightly.models.modules impor... | 1,938 | 26.7 | 77 | py |
lightly | lightly-master/examples/pytorch/dino.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import torch
import torchvision
from torch import nn
from lightly.loss import DINOLoss
from lightly.models... | 3,561 | 32.603774 | 90 | py |
lightly | lightly-master/examples/pytorch/fastsiam.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import torch
import torchvision
from torch import nn
from lightly.loss import NegativeCosineSimilarity
from lightly.mod... | 2,294 | 30.013514 | 79 | py |
lightly | lightly-master/examples/pytorch/ijepa.py | import copy
import torch
import torchvision
from torch import nn
from torch.nn import functional as F
from tqdm import tqdm
from lightly.data.collate import IJEPAMaskCollator
from lightly.models import utils
from lightly.models.modules.ijepa import IJEPABackbone, IJEPAPredictor
from lightly.transforms.ijepa_transform... | 3,957 | 32.542373 | 80 | py |
lightly | lightly-master/examples/pytorch/mae.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import torch
import torchvision
from torch import nn
from lightly.models import utils
from lightly.models.modules impor... | 3,762 | 31.721739 | 85 | py |
lightly | lightly-master/examples/pytorch/moco.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import torch
import torchvision
from torch import nn
from lightly.loss import NTXentLoss
from lightly.mode... | 2,827 | 30.076923 | 81 | py |
lightly | lightly-master/examples/pytorch/msn.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import torch
import torchvision
from torch import nn
from lightly.loss import MSNLoss
from lightly.models i... | 3,790 | 30.07377 | 80 | py |
lightly | lightly-master/examples/pytorch/nnclr.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import torch
import torchvision
from torch import nn
from lightly.loss import NTXentLoss
from lightly.models.modules im... | 2,263 | 27.3 | 77 | py |
lightly | lightly-master/examples/pytorch/pmsn.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import torch
import torchvision
from torch import nn
from lightly.loss import PMSNLoss
from lightly.models ... | 3,773 | 29.934426 | 80 | py |
lightly | lightly-master/examples/pytorch/simclr.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import torch
import torchvision
from torch import nn
from lightly.loss import NTXentLoss
from lightly.models.modules im... | 1,910 | 27.522388 | 77 | py |
lightly | lightly-master/examples/pytorch/simmim.py | import torch
import torchvision
from torch import nn
from lightly.models import utils
from lightly.models.modules import masked_autoencoder
from lightly.transforms.mae_transform import MAETransform # Same transform as MAE
class SimMIM(nn.Module):
def __init__(self, vit):
super().__init__()
deco... | 3,213 | 30.203883 | 82 | py |
lightly | lightly-master/examples/pytorch/simsiam.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import torch
import torchvision
from torch import nn
from lightly.loss import NegativeCosineSimilarity
from lightly.mod... | 2,096 | 28.957143 | 79 | py |
lightly | lightly-master/examples/pytorch/smog.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import torch
import torchvision
from sklearn.cluster import KMeans
from torch import nn
from lightly.loss.... | 5,393 | 32.092025 | 80 | py |
lightly | lightly-master/examples/pytorch/swav.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import torch
import torchvision
from torch import nn
from lightly.loss import SwaVLoss
from lightly.models.modules impo... | 2,268 | 29.662162 | 80 | py |
lightly | lightly-master/examples/pytorch/swav_queue.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import torch
import torchvision
from torch import nn
from lightly.loss import SwaVLoss
from lightly.loss.memory_bank im... | 4,433 | 35.644628 | 99 | py |
lightly | lightly-master/examples/pytorch/tico.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import torch
import torchvision
from torch import nn
from lightly.loss.tico_loss import TiCoLoss
from ligh... | 2,771 | 29.130435 | 81 | py |
lightly | lightly-master/examples/pytorch/vicreg.py | import torch
import torchvision
from torch import nn
## The projection head is the same as the Barlow Twins one
from lightly.loss import VICRegLoss
## The projection head is the same as the Barlow Twins one
from lightly.loss.vicreg_loss import VICRegLoss
from lightly.models.modules import BarlowTwinsProjectionHead
fr... | 1,869 | 27.333333 | 73 | py |
lightly | lightly-master/examples/pytorch/vicregl.py | import torch
import torchvision
from torch import nn
from lightly.loss import VICRegLLoss
## The global projection head is the same as the Barlow Twins one
from lightly.models.modules import BarlowTwinsProjectionHead
from lightly.models.modules.heads import VicRegLLocalProjectionHead
from lightly.transforms.vicregl_t... | 2,591 | 31.810127 | 80 | py |
lightly | lightly-master/examples/pytorch_lightning/barlowtwins.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import BarlowTwin... | 1,844 | 29.245902 | 77 | py |
lightly | lightly-master/examples/pytorch_lightning/byol.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss impo... | 2,857 | 33.02381 | 88 | py |
lightly | lightly-master/examples/pytorch_lightning/dcl.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import DCLLoss
fr... | 1,880 | 29.33871 | 77 | py |
lightly | lightly-master/examples/pytorch_lightning/dino.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss impo... | 3,437 | 34.8125 | 98 | py |
lightly | lightly-master/examples/pytorch_lightning/fastsiam.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import NegativeCo... | 2,293 | 31.309859 | 83 | py |
lightly | lightly-master/examples/pytorch_lightning/ijepa.py | # TODO
| 7 | 3 | 6 | py |
lightly | lightly-master/examples/pytorch_lightning/mae.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.models import utils
fr... | 3,626 | 32.275229 | 85 | py |
lightly | lightly-master/examples/pytorch_lightning/moco.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss impo... | 2,677 | 32.475 | 88 | py |
lightly | lightly-master/examples/pytorch_lightning/msn.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss impor... | 3,715 | 32.477477 | 87 | py |
lightly | lightly-master/examples/pytorch_lightning/nnclr.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import NTXentLoss... | 2,186 | 29.375 | 77 | py |
lightly | lightly-master/examples/pytorch_lightning/pmsn.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss impor... | 3,705 | 32.387387 | 87 | py |
lightly | lightly-master/examples/pytorch_lightning/simclr.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import NTXentLoss... | 1,814 | 28.754098 | 77 | py |
lightly | lightly-master/examples/pytorch_lightning/simmim.py | import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.models import utils
from lightly.models.modules import masked_autoencoder
from lightly.transforms.mae_transform import MAETransform # Same transform as MAE
class SimMIM(pl.LightningModule):
def __init__(self):
... | 3,158 | 30.909091 | 82 | py |
lightly | lightly-master/examples/pytorch_lightning/simsiam.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import NegativeCo... | 2,020 | 30.578125 | 79 | py |
lightly | lightly-master/examples/pytorch_lightning/smog.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import pytorch_lightning as pl
import torch
import torchvision
from sklearn.cluster import KMeans
from torc... | 5,306 | 35.349315 | 83 | py |
lightly | lightly-master/examples/pytorch_lightning/swav.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import SwaVLoss
f... | 2,236 | 30.957143 | 84 | py |
lightly | lightly-master/examples/pytorch_lightning/swav_queue.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import SwaVLoss
f... | 4,217 | 36.327434 | 99 | py |
lightly | lightly-master/examples/pytorch_lightning/tico.py | import copy
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss.tico_loss import TiCoLoss
from lightly.models.modules.heads import TiCoProjectionHead
from lightly.models.utils import deactivate_requires_grad, update_momentum
from lightly.transforms.simclr_transform im... | 2,481 | 30.820513 | 88 | py |
lightly | lightly-master/examples/pytorch_lightning/vicreg.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss.vicreg_loss impor... | 1,896 | 29.111111 | 77 | py |
lightly | lightly-master/examples/pytorch_lightning/vicregl.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import VICRegLLos... | 2,714 | 33.367089 | 80 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/barlowtwins.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import BarlowTwin... | 2,228 | 30.394366 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/byol.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss impo... | 3,150 | 33.25 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/dcl.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import DCLLoss
fr... | 2,288 | 30.356164 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/dino.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss impo... | 3,690 | 34.834951 | 98 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/fastsiam.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import NegativeCo... | 2,546 | 31.653846 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/ijepa.py | # TODO
| 7 | 3 | 6 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/mae.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.models import utils
fr... | 3,796 | 32.017391 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/moco.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss impo... | 2,930 | 32.689655 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/msn.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss impor... | 3,975 | 32.411765 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/nnclr.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import NTXentLoss... | 2,439 | 29.886076 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/pmsn.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss impor... | 3,999 | 32.057851 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/simclr.py | import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import NTXentLoss
from lightly.models.modules import SimCLRProjectionHead
from lightly.transforms.simclr_transform import SimCLRTransform
class SimCLR(pl.LightningModule):
def __init__(self):
super().__i... | 1,998 | 28.835821 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/simmim.py | import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.models import utils
from lightly.models.modules import masked_autoencoder
from lightly.transforms.mae_transform import MAETransform # Same transform as MAE
class SimMIM(pl.LightningModule):
def __init__(self):
... | 3,328 | 30.704762 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/simsiam.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import NegativeCo... | 2,368 | 31.452055 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/swav.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import SwaVLoss
f... | 2,671 | 32.4 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/tico.py | import copy
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss.tico_loss import TiCoLoss
from lightly.models.modules.heads import TiCoProjectionHead
from lightly.models.utils import deactivate_requires_grad, update_momentum
from lightly.transforms.simclr_transform im... | 2,734 | 31.176471 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/vicreg.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import VICRegLoss... | 2,268 | 30.082192 | 91 | py |
lightly | lightly-master/examples/pytorch_lightning_distributed/vicregl.py | # Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import pytorch_lightning as pl
import torch
import torchvision
from torch import nn
from lightly.loss import VICRegLLos... | 2,967 | 33.511628 | 91 | py |
lightly | lightly-master/lightly/__init__.py | """Lightly is a computer vision framework for self-supervised learning.
With Lightly you can train deep learning models using
self-supervision. This means, that you don't require
any labels to train a model. Lightly has been built
to help you understand and work with large unlabeled datasets.
It is built on top of PyT... | 3,371 | 26.867769 | 88 | py |
lightly | lightly-master/lightly/core.py | """ Contains the core functionality of the lightly Python package. """
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import os
from typing import List, Tuple
import numpy as np
import yaml
import lightly.cli as cli
from lightly.cli.embed_cli import _embed_cli
from lightly.cli.lightly_cli... | 7,426 | 32.606335 | 95 | py |
lightly | lightly-master/lightly/active_learning/__init__.py | import warnings
def raise_active_learning_deprecation_warning():
warnings.warn(
"Using active learning via the lightly package is deprecated and will be removed soon. "
"Please use the Lightly Solution instead. "
"See https://docs.lightly.ai for more information and tutorials on doing acti... | 391 | 31.666667 | 99 | py |
lightly | lightly-master/lightly/active_learning/config/__init__.py | """ Collection of Selection Configurations """
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from lightly.active_learning.config.selection_config import SelectionConfig
| 200 | 27.714286 | 75 | py |
lightly | lightly-master/lightly/active_learning/config/selection_config.py | import warnings
from datetime import datetime
from lightly.active_learning import raise_active_learning_deprecation_warning
from lightly.openapi_generated.swagger_client.models.sampling_method import (
SamplingMethod,
)
class SelectionConfig:
"""Configuration class for a selection.
Attributes:
m... | 2,001 | 35.4 | 103 | py |
lightly | lightly-master/lightly/api/__init__.py | """ The lightly.api module provides access to the Lightly API."""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from lightly.api import patch as _patch
from lightly.api.api_workflow_artifacts import ArtifactNotExist
from lightly.api.api_workflow_client import ApiWorkflowClient
from lightly... | 555 | 33.75 | 65 | py |
lightly | lightly-master/lightly/api/api_workflow_artifacts.py | import os
from lightly.api import download
from lightly.openapi_generated.swagger_client.models import (
DockerRunArtifactData,
DockerRunArtifactType,
DockerRunData,
)
class ArtifactNotExist(Exception):
pass
class _ArtifactsMixin:
def download_compute_worker_run_artifacts(
self,
... | 15,450 | 34.356979 | 139 | py |
lightly | lightly-master/lightly/api/api_workflow_client.py | import os
import platform
import warnings
from io import IOBase
from typing import *
import requests
from requests import Response
from lightly.__init__ import __version__
from lightly.api import utils, version_checking
from lightly.api.api_workflow_artifacts import _ArtifactsMixin
from lightly.api.api_workflow_colla... | 10,750 | 37.53405 | 187 | py |
lightly | lightly-master/lightly/api/api_workflow_collaboration.py | from typing import List
from lightly.openapi_generated.swagger_client.models import (
SharedAccessConfigCreateRequest,
SharedAccessConfigData,
SharedAccessType,
)
class _CollaborationMixin:
def share_dataset_only_with(self, dataset_id: str, user_emails: List[str]) -> None:
"""Shares a dataset... | 3,132 | 38.658228 | 108 | py |
lightly | lightly-master/lightly/api/api_workflow_compute_worker.py | import copy
import dataclasses
import difflib
import json
import time
from functools import partial
from typing import Any, Callable, Dict, Iterator, List, Optional, Type, TypeVar, Union
from lightly.api import utils
from lightly.openapi_generated.swagger_client.api_client import ApiClient
from lightly.openapi_generat... | 25,577 | 34.773427 | 117 | py |
lightly | lightly-master/lightly/api/api_workflow_datasets.py | import warnings
from itertools import chain
from typing import Iterator, List, Optional, Set
from lightly.api import utils
from lightly.openapi_generated.swagger_client.models import (
CreateEntityResponse,
DatasetCreateRequest,
DatasetData,
DatasetType,
)
from lightly.openapi_generated.swagger_client.... | 20,205 | 38.697446 | 91 | py |
lightly | lightly-master/lightly/api/api_workflow_datasources.py | import time
import warnings
from typing import Dict, List, Optional, Tuple, Union
import tqdm
from lightly.openapi_generated.swagger_client.models import (
DatasourceConfig,
DatasourceConfigVerifyDataErrors,
DatasourceProcessedUntilTimestampRequest,
DatasourceProcessedUntilTimestampResponse,
Datas... | 32,700 | 40.237074 | 139 | py |
lightly | lightly-master/lightly/api/api_workflow_download_dataset.py | import io
import os
import urllib.request
import warnings
from concurrent.futures.thread import ThreadPoolExecutor
from typing import Dict, List, Optional
from urllib.request import Request
import tqdm
from PIL import Image
from lightly.api import download, utils
from lightly.api.bitmask import BitMask
from lightly.o... | 11,378 | 34.783019 | 148 | py |
lightly | lightly-master/lightly/api/api_workflow_export.py | import warnings
from typing import Dict, List
from lightly.api import utils
from lightly.openapi_generated.swagger_client.models import (
FileNameFormat,
LabelBoxDataRow,
LabelBoxV4DataRow,
LabelStudioTask,
)
class _ExportDatasetMixin:
def export_label_studio_tasks_by_tag_id(
self,
... | 13,415 | 33.488432 | 97 | py |
lightly | lightly-master/lightly/api/api_workflow_predictions.py | from typing import Sequence
from lightly.openapi_generated.swagger_client.models import (
PredictionSingleton,
PredictionTaskSchema,
)
class _PredictionsMixin:
def create_or_update_prediction_task_schema(
self,
schema: PredictionTaskSchema,
prediction_version_id: int = -1,
) -... | 2,932 | 35.209877 | 114 | py |
lightly | lightly-master/lightly/api/api_workflow_selection.py | import time
import warnings
from typing import Dict, List, Optional, Union
import numpy as np
from numpy.typing import NDArray
from lightly.active_learning.config.selection_config import SelectionConfig
from lightly.openapi_generated.swagger_client.models import (
ActiveLearningScoreCreateRequest,
JobState,
... | 6,982 | 35.752632 | 113 | py |
lightly | lightly-master/lightly/api/api_workflow_tags.py | from typing import *
from lightly.api.bitmask import BitMask
from lightly.openapi_generated.swagger_client.models import (
TagArithmeticsOperation,
TagArithmeticsRequest,
TagBitMaskResponse,
TagCreateRequest,
TagData,
)
class TagDoesNotExistError(ValueError):
pass
class _TagsMixin:
def ... | 10,007 | 35.392727 | 113 | py |
lightly | lightly-master/lightly/api/api_workflow_upload_embeddings.py | import csv
import io
import tempfile
import urllib.request
from datetime import datetime
from typing import List
from urllib.request import Request
from lightly.api.utils import retry
from lightly.openapi_generated.swagger_client.models import (
DatasetEmbeddingData,
DimensionalityReductionMethod,
Trigger2... | 9,941 | 36.235955 | 110 | py |
lightly | lightly-master/lightly/api/api_workflow_upload_metadata.py | from concurrent.futures import ThreadPoolExecutor
from typing import Any, Dict, List, Union
from requests import Response
from tqdm import tqdm
from lightly.api.utils import paginate_endpoint, retry
from lightly.openapi_generated.swagger_client.models import (
ConfigurationEntry,
ConfigurationSetRequest,
... | 9,323 | 36 | 115 | py |
lightly | lightly-master/lightly/api/bitmask.py | """ Module to work with Lightly BitMasks """
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import copy
from typing import List
def _hex_to_int(hexstring: str) -> int:
"""Converts a hex string representation of an integer to an integer."""
return int(hexstring, 16)
def _bin_to_i... | 6,793 | 29.603604 | 83 | py |
lightly | lightly-master/lightly/api/download.py | import concurrent.futures
import os
import pathlib
import shutil
import threading
import warnings
from concurrent.futures import ThreadPoolExecutor
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Type, Union
import PIL
import requests
import tqdm
from lightly.api import utils
try:
import av
e... | 19,950 | 35.742173 | 96 | py |
lightly | lightly-master/lightly/api/patch.py | import logging
from typing import Any, Dict, Type
def make_swagger_configuration_picklable(
configuration_cls: Type,
) -> None:
"""Adds __getstate__ and __setstate__ methods to swagger configuration to make it
picklable.
This doesn't make all swagger classes picklable. Notably, the ApiClient and
... | 2,375 | 39.271186 | 88 | py |
lightly | lightly-master/lightly/api/swagger_api_client.py | from typing import Any, Dict, Tuple, Union
from lightly.api.swagger_rest_client import LightlySwaggerRESTClientObject
from lightly.openapi_generated.swagger_client.api_client import ApiClient, Configuration
DEFAULT_API_TIMEOUT = 60 * 3 # seconds
class PatchApiClientMixin:
"""Mixin that makes an ApiClient objec... | 2,391 | 35.8 | 123 | py |
lightly | lightly-master/lightly/api/swagger_rest_client.py | from typing import Any, Dict, Tuple, Union
from lightly.openapi_generated.swagger_client.api_client import Configuration
from lightly.openapi_generated.swagger_client.rest import RESTClientObject
class PatchRESTClientObjectMixin:
"""Mixin that adds patches to a RESTClientObject.
* Adds default timeout to al... | 4,271 | 34.89916 | 152 | py |
lightly | lightly-master/lightly/api/utils.py | """ Communication Utility """
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import io
import os
import random
import threading
import time
from enum import Enum
from typing import Iterator, List, Optional
# the following two lines are needed because
# PIL misidentifies certain jpeg image... | 6,937 | 27.318367 | 108 | py |
lightly | lightly-master/lightly/api/version_checking.py | import signal
import warnings
from typing import Tuple
from lightly.api import utils
from lightly.api.swagger_api_client import LightlySwaggerApiClient
from lightly.openapi_generated.swagger_client.api import VersioningApi
from lightly.utils import version_compare
class LightlyAPITimeoutException(Exception):
pas... | 2,544 | 30.8125 | 82 | py |
lightly | lightly-master/lightly/cli/__init__.py | """ The lightly.cli module provides a console interface
for training self-supervised models, embedding,
and filtering datasets
"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from lightly.cli.crop_cli import crop_cli
from lightly.cli.download_cli import download_cli
from lightly... | 444 | 30.785714 | 55 | py |
lightly | lightly-master/lightly/cli/_cli_simclr.py | """ SimCLR Model """
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import warnings
import torch
import torch.nn as nn
from lightly.models.modules import SimCLRProjectionHead
class _SimCLR(nn.Module):
"""Implementation of SimCLR used by the command-line interface.
Provides bac... | 1,181 | 25.266667 | 84 | py |
lightly | lightly-master/lightly/cli/_helpers.py | """ Command-Line Interface Helpers """
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import os
import hydra
import torch
from hydra import utils
from torch import nn as nn
from lightly.cli._cli_simclr import _SimCLR
from lightly.embedding import SelfSupervisedEmbedding
from lightly.model... | 7,330 | 30.063559 | 87 | py |
lightly | lightly-master/lightly/cli/crop_cli.py | # -*- coding: utf-8 -*-
"""**Lightly Train:** Train a self-supervised model from the command-line.
This module contains the entrypoint for the **lightly-train**
command-line interface.
"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import os.path
from typing import List
import hydra
i... | 4,468 | 37.525862 | 131 | py |
lightly | lightly-master/lightly/cli/download_cli.py | # -*- coding: utf-8 -*-
"""**Lightly Download:** Download images from the Lightly platform.
This module contains the entrypoint for the **lightly-download**
command-line interface.
"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import os
import hydra
import lightly.data as data
from... | 4,846 | 34.903704 | 115 | py |
lightly | lightly-master/lightly/cli/embed_cli.py | # -*- coding: utf-8 -*-
"""**Lightly Embed:** Embed images with one command.
This module contains the entrypoint for the **lightly-embed**
command-line interface.
"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import os
from typing import List, Tuple, Union
import hydra
import numpy ... | 3,907 | 28.606061 | 80 | py |
lightly | lightly-master/lightly/cli/lightly_cli.py | # -*- coding: utf-8 -*-
"""**Lightly Magic:** Train and embed in one command.
This module contains the entrypoint for the **lightly-magic**
command-line interface.
"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import hydra
from omegaconf import DictConfig
from lightly.cli._helpers i... | 1,887 | 26.362319 | 78 | py |
lightly | lightly-master/lightly/cli/train_cli.py | # -*- coding: utf-8 -*-
"""**Lightly Train:** Train a self-supervised model from the command-line.
This module contains the entrypoint for the **lightly-train**
command-line interface.
"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import copy
import os
import warnings
import hydra
im... | 6,371 | 32.893617 | 86 | py |
lightly | lightly-master/lightly/cli/version_cli.py | # -*- coding: utf-8 -*-
"""**Lightly Version:** Show the version of the installed package.
Example:
>>> # show the version of the installed package
>>> lightly-version
"""
# Copyright (c) 2021. Lightly AG and its affiliates.
# All Rights Reserved
import hydra
import lightly
from lightly.cli._helpers import ... | 677 | 20.870968 | 78 | py |
lightly | lightly-master/lightly/cli/config/__init__.py | """ lightly.cli.config
The lightly.cli.config module holds default configs for the command-line
interface.
"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
| 196 | 20.888889 | 76 | py |
lightly | lightly-master/lightly/cli/config/config.yaml | ### i/o
# The following arguments specify input and output locations
# of images, embeddings, and checkpoints.
input_dir: '' # Path to input directory which holds images.
output_dir: '' # Path to directory which should store downloads.
embeddings: '' # Path to csv file whic... | 8,838 | 54.24375 | 138 | yaml |
lightly | lightly-master/lightly/cli/config/get_config.py | from pathlib import Path
from omegaconf import DictConfig, OmegaConf
def get_lightly_config() -> DictConfig:
config_path = Path(__file__).with_name("config.yaml")
conf = OmegaConf.load(config_path)
# TODO(Huan, 05.04.2023): remove this when hydra is completely dropped
if conf.get("hydra"):
# ... | 427 | 29.571429 | 74 | py |
lightly | lightly-master/lightly/data/__init__.py | """The lightly.data module provides a dataset wrapper and collate functions. """
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from lightly.data._video import (
EmptyVideoError,
NonIncreasingTimestampError,
UnseekableTimestampError,
VideoError,
)
from lightly.data.collate ... | 687 | 24.481481 | 80 | py |