-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #214 from lightly-ai/develop
Develop to master - Pre-release 1.1.1
- Loading branch information
Showing
4 changed files
with
278 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import unittest | ||
import torch | ||
|
||
import lightly | ||
|
||
|
||
class TestFromImports(unittest.TestCase): | ||
|
||
def test_from_imports(self): | ||
# active learning (commented out don't work) | ||
from lightly.active_learning.config.sampler_config import SamplerConfig | ||
from lightly.active_learning.agents.agent import ActiveLearningAgent | ||
from lightly.active_learning.scorers.classification import ScorerClassification | ||
|
||
# api imports | ||
from lightly.api.routes.users import get_quota | ||
from lightly.api.routes.users.docker import get_authorization | ||
from lightly.api.routes.users.docker import get_soft_authorization | ||
from lightly.api.routes.users.docker import post_diagnostics | ||
from lightly.api.api_workflow_client import ApiWorkflowClient | ||
from lightly.api.bitmask import BitMask | ||
|
||
# data imports | ||
from lightly.data import LightlyDataset | ||
from lightly.data.dataset import LightlyDataset | ||
from lightly.data import BaseCollateFunction | ||
from lightly.data.collate import BaseCollateFunction | ||
from lightly.data import ImageCollateFunction | ||
from lightly.data.collate import ImageCollateFunction | ||
from lightly.data import MoCoCollateFunction | ||
from lightly.data.collate import MoCoCollateFunction | ||
from lightly.data import SimCLRCollateFunction | ||
from lightly.data.collate import SimCLRCollateFunction | ||
from lightly.data import imagenet_normalize | ||
from lightly.data.collate import imagenet_normalize | ||
|
||
# embedding imports | ||
from lightly.embedding import BaseEmbedding | ||
from lightly.embedding._base import BaseEmbedding | ||
from lightly.embedding import SelfSupervisedEmbedding | ||
from lightly.embedding.embedding import SelfSupervisedEmbedding | ||
|
||
# loss imports | ||
from lightly.loss import NTXentLoss | ||
from lightly.loss.ntx_ent_loss import NTXentLoss | ||
from lightly.loss import SymNegCosineSimilarityLoss | ||
from lightly.loss.sym_neg_cos_sim_loss import SymNegCosineSimilarityLoss | ||
from lightly.loss.memory_bank import MemoryBankModule | ||
|
||
# models imports | ||
from lightly.models import ResNetGenerator | ||
from lightly.models.resnet import ResNetGenerator | ||
from lightly.models import SimCLR | ||
from lightly.models.simclr import SimCLR | ||
from lightly.models import MoCo | ||
from lightly.models.moco import MoCo | ||
from lightly.models import SimSiam | ||
from lightly.models.simsiam import SimSiam | ||
from lightly.models import ZOO | ||
from lightly.models.zoo import ZOO | ||
from lightly.models import checkpoints | ||
from lightly.models.zoo import checkpoints | ||
from lightly.models.batchnorm import get_norm_layer | ||
|
||
# transforms imports | ||
from lightly.transforms import GaussianBlur | ||
from lightly.transforms.gaussian_blur import GaussianBlur | ||
from lightly.transforms import RandomRotate | ||
from lightly.transforms.rotation import RandomRotate | ||
|
||
# utils imports | ||
from lightly.utils import save_embeddings | ||
from lightly.utils.io import save_embeddings | ||
from lightly.utils import load_embeddings | ||
from lightly.utils.io import load_embeddings | ||
from lightly.utils import load_embeddings_as_dict | ||
from lightly.utils.io import load_embeddings_as_dict | ||
from lightly.utils import fit_pca | ||
from lightly.utils.embeddings_2d import fit_pca | ||
|
||
# core imports | ||
from lightly import train_model_and_embed_images | ||
from lightly import train_embedding_model | ||
from lightly import embed_images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import unittest | ||
import torch | ||
|
||
import lightly | ||
|
||
|
||
class TestNestedImports(unittest.TestCase): | ||
|
||
def test_nested_imports(self): | ||
# active learning (commented out don't work) | ||
#lightly.active_learning.agents.agent.ActiveLearningAgent | ||
#lightly.active_learning.agents.ActiveLearningAgent | ||
lightly.active_learning.config.sampler_config.SamplerConfig | ||
#lightly.active_learning.scorers.classification.ScorerClassification | ||
|
||
# api imports | ||
lightly.api.routes.users.get_quota | ||
lightly.api.routes.users.docker.get_authorization | ||
lightly.api.routes.users.docker.get_soft_authorization | ||
lightly.api.routes.users.docker.post_diagnostics | ||
lightly.api.api_workflow_client.ApiWorkflowClient | ||
lightly.api.bitmask.BitMask | ||
|
||
# data imports | ||
lightly.data.LightlyDataset | ||
lightly.data.dataset.LightlyDataset | ||
lightly.data.BaseCollateFunction | ||
lightly.data.collate.BaseCollateFunction | ||
lightly.data.ImageCollateFunction | ||
lightly.data.collate.ImageCollateFunction | ||
lightly.data.MoCoCollateFunction | ||
lightly.data.collate.MoCoCollateFunction | ||
lightly.data.SimCLRCollateFunction | ||
lightly.data.collate.SimCLRCollateFunction | ||
lightly.data.imagenet_normalize | ||
lightly.data.collate.imagenet_normalize | ||
|
||
# embedding imports | ||
lightly.embedding.BaseEmbedding | ||
lightly.embedding._base.BaseEmbedding | ||
lightly.embedding.SelfSupervisedEmbedding | ||
lightly.embedding.embedding.SelfSupervisedEmbedding | ||
|
||
# loss imports | ||
lightly.loss.NTXentLoss | ||
lightly.loss.ntx_ent_loss.NTXentLoss | ||
lightly.loss.SymNegCosineSimilarityLoss | ||
lightly.loss.sym_neg_cos_sim_loss.SymNegCosineSimilarityLoss | ||
lightly.loss.memory_bank.MemoryBankModule | ||
|
||
# models imports | ||
lightly.models.ResNetGenerator | ||
lightly.models.resnet.ResNetGenerator | ||
lightly.models.SimCLR | ||
lightly.models.simclr.SimCLR | ||
lightly.models.MoCo | ||
lightly.models.moco.MoCo | ||
lightly.models.SimSiam | ||
lightly.models.simsiam.SimSiam | ||
lightly.models.ZOO | ||
lightly.models.zoo.ZOO | ||
lightly.models.checkpoints | ||
lightly.models.zoo.checkpoints | ||
lightly.models.batchnorm.get_norm_layer | ||
|
||
# transforms imports | ||
lightly.transforms.GaussianBlur | ||
lightly.transforms.gaussian_blur.GaussianBlur | ||
lightly.transforms.RandomRotate | ||
lightly.transforms.rotation.RandomRotate | ||
|
||
# utils imports | ||
lightly.utils.save_embeddings | ||
lightly.utils.io.save_embeddings | ||
lightly.utils.load_embeddings | ||
lightly.utils.io.load_embeddings | ||
lightly.utils.load_embeddings_as_dict | ||
lightly.utils.io.load_embeddings_as_dict | ||
lightly.utils.fit_pca | ||
lightly.utils.embeddings_2d.fit_pca | ||
|
||
# core imports | ||
lightly.train_model_and_embed_images | ||
lightly.core.train_model_and_embed_images | ||
lightly.train_embedding_model | ||
lightly.core.train_embedding_model | ||
lightly.embed_images | ||
lightly.core.embed_images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import unittest | ||
import torch | ||
|
||
import lightly | ||
|
||
|
||
class TestSemiNestedImports(unittest.TestCase): | ||
|
||
def test_seminested_imports(self): | ||
from lightly import active_learning | ||
# active learning (commented out don't work) | ||
#lightly.active_learning.agents.agent.ActiveLearningAgent | ||
#lightly.active_learning.agents.ActiveLearningAgent | ||
active_learning.config.sampler_config.SamplerConfig | ||
#lightly.active_learning.scorers.classification.ScorerClassification | ||
|
||
# api imports | ||
from lightly import api | ||
api.routes.users.get_quota | ||
api.routes.users.docker.get_authorization | ||
api.routes.users.docker.get_soft_authorization | ||
api.routes.users.docker.post_diagnostics | ||
api.api_workflow_client.ApiWorkflowClient | ||
api.bitmask.BitMask | ||
|
||
# data imports | ||
from lightly import data | ||
data.LightlyDataset | ||
data.dataset.LightlyDataset | ||
data.BaseCollateFunction | ||
data.collate.BaseCollateFunction | ||
data.ImageCollateFunction | ||
data.collate.ImageCollateFunction | ||
data.MoCoCollateFunction | ||
data.collate.MoCoCollateFunction | ||
data.SimCLRCollateFunction | ||
data.collate.SimCLRCollateFunction | ||
data.imagenet_normalize | ||
data.collate.imagenet_normalize | ||
|
||
# embedding imports | ||
from lightly import embedding | ||
embedding.BaseEmbedding | ||
embedding._base.BaseEmbedding | ||
embedding.SelfSupervisedEmbedding | ||
embedding.embedding.SelfSupervisedEmbedding | ||
|
||
# loss imports | ||
from lightly import loss | ||
loss.NTXentLoss | ||
loss.ntx_ent_loss.NTXentLoss | ||
loss.SymNegCosineSimilarityLoss | ||
loss.sym_neg_cos_sim_loss.SymNegCosineSimilarityLoss | ||
loss.memory_bank.MemoryBankModule | ||
|
||
# models imports | ||
from lightly import models | ||
models.ResNetGenerator | ||
models.resnet.ResNetGenerator | ||
models.SimCLR | ||
models.simclr.SimCLR | ||
models.MoCo | ||
models.moco.MoCo | ||
models.SimSiam | ||
models.simsiam.SimSiam | ||
models.ZOO | ||
models.zoo.ZOO | ||
models.checkpoints | ||
models.zoo.checkpoints | ||
models.batchnorm.get_norm_layer | ||
|
||
# transforms imports | ||
from lightly import transforms | ||
transforms.GaussianBlur | ||
transforms.gaussian_blur.GaussianBlur | ||
transforms.RandomRotate | ||
transforms.rotation.RandomRotate | ||
|
||
# utils imports | ||
from lightly import utils | ||
utils.save_embeddings | ||
utils.io.save_embeddings | ||
utils.load_embeddings | ||
utils.io.load_embeddings | ||
utils.load_embeddings_as_dict | ||
utils.io.load_embeddings_as_dict | ||
utils.fit_pca | ||
utils.embeddings_2d.fit_pca |