Skip to content

Commit

Permalink
👕 Standardize
Browse files Browse the repository at this point in the history
  • Loading branch information
o-laurent committed Sep 2, 2023
1 parent 816f03f commit 3b14e42
Show file tree
Hide file tree
Showing 52 changed files with 52 additions and 61 deletions.
2 changes: 1 addition & 1 deletion auto_tutorials_source/tutorial_bayesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
from functools import partial
from pathlib import Path

import torch.nn as nn
from torch import nn
import torch.optim as optim
from cli_test_helpers import ArgvContext

Expand Down
2 changes: 1 addition & 1 deletion auto_tutorials_source/tutorial_pe_cifar10.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def imshow(img):
# First we define a vanilla classifier for CIFAR10 for reference. We will use a
# convolutional neural network.

import torch.nn as nn
from torch import nn
import torch.nn.functional as F


Expand Down
2 changes: 1 addition & 1 deletion docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ trains any ResNet architecture on CIFAR10:
from pathlib import Path
import torch.nn as nn
from torch import nn
from torch_uncertainty import cli_main, init_args
from torch_uncertainty.baselines import ResNet
Expand Down
2 changes: 1 addition & 1 deletion experiments/classification/cifar10/resnet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# fmt: off
from pathlib import Path

import torch.nn as nn
from torch import nn

from torch_uncertainty import cli_main, init_args
from torch_uncertainty.baselines import ResNet
Expand Down
2 changes: 1 addition & 1 deletion experiments/classification/cifar10/vgg.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# fmt: off
from pathlib import Path

import torch.nn as nn
from torch import nn

from torch_uncertainty import cli_main, init_args
from torch_uncertainty.baselines import VGG
Expand Down
2 changes: 1 addition & 1 deletion experiments/classification/cifar10/wideresnet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# fmt: off
from pathlib import Path

import torch.nn as nn
from torch import nn

from torch_uncertainty import cli_main, init_args
from torch_uncertainty.baselines import WideResNet
Expand Down
2 changes: 1 addition & 1 deletion experiments/classification/cifar100/resnet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# fmt: off
from pathlib import Path

import torch.nn as nn
from torch import nn

from torch_uncertainty import cli_main, init_args
from torch_uncertainty.baselines import ResNet
Expand Down
2 changes: 1 addition & 1 deletion experiments/classification/cifar100/vgg.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# fmt: off
from pathlib import Path

import torch.nn as nn
from torch import nn

from torch_uncertainty import cli_main, init_args
from torch_uncertainty.baselines import VGG
Expand Down
2 changes: 1 addition & 1 deletion experiments/classification/cifar100/wideresnet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# fmt: off
from pathlib import Path

import torch.nn as nn
from torch import nn

from torch_uncertainty import cli_main, init_args
from torch_uncertainty.baselines import WideResNet
Expand Down
2 changes: 1 addition & 1 deletion experiments/classification/mnist/bayesian_lenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from functools import partial
from pathlib import Path

import torch.nn as nn
import torch.optim as optim
from torch import nn

from torch_uncertainty import cli_main, init_args
from torch_uncertainty.datamodules import MNISTDataModule
Expand Down
2 changes: 1 addition & 1 deletion experiments/classification/mnist/lenet.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# fmt: off
from pathlib import Path

import torch.nn as nn
import torch.optim as optim
from torch import nn

from torch_uncertainty import cli_main, init_args
from torch_uncertainty.datamodules import MNISTDataModule
Expand Down
2 changes: 1 addition & 1 deletion experiments/classification/tiny-imagenet/resnet.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# fmt: off
from pathlib import Path

import torch.nn as nn
import torch.optim as optim
from torch import nn

from torch_uncertainty import cli_main, init_args
from torch_uncertainty.baselines import ResNet
Expand Down
2 changes: 1 addition & 1 deletion experiments/regression/uci_datasets/mlp-kin8nm.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# fmt: off
from pathlib import Path

import torch.nn as nn
import torch.optim as optim
from torch import nn

from torch_uncertainty import cli_main, init_args
from torch_uncertainty.baselines.regression.mlp import MLP
Expand Down
2 changes: 1 addition & 1 deletion tests/_dummies/baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from argparse import ArgumentParser
from typing import Any

import torch.nn as nn
from pytorch_lightning import LightningModule
from torch import nn

from torch_uncertainty.routines.classification import (
ClassificationEnsemble,
Expand Down
3 changes: 1 addition & 2 deletions tests/_dummies/model.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# fmt: off

import torch
import torch.nn as nn
from torch import Tensor
from torch import Tensor, nn

# fmt: on
__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/test_batched.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# fmt:off
import torch
import torch.nn as nn
from torch import nn
from torchinfo import summary

from torch_uncertainty.baselines import ResNet, WideResNet
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/test_masked.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# fmt:off
import pytest
import torch
import torch.nn as nn
from torch import nn
from torchinfo import summary

from torch_uncertainty.baselines import ResNet, WideResNet
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/test_mimo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# fmt: off
import torch
import torch.nn as nn
from torch import nn
from torchinfo import summary

from torch_uncertainty.baselines import ResNet, WideResNet
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/test_packed.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# fmt:off
import pytest
import torch
import torch.nn as nn
from torch import nn
from torchinfo import summary

from torch_uncertainty.baselines import VGG, ResNet, WideResNet
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/test_resnet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# fmt:off
import pytest
import torch.nn as nn
from torch import nn

from torch_uncertainty.baselines import ResNet, WideResNet
from torch_uncertainty.optimization_procedures import (
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/test_standard.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# fmt:off
import torch
import torch.nn as nn
from torch import nn
from torchinfo import summary

from torch_uncertainty.baselines import VGG, ResNet, WideResNet
Expand Down
2 changes: 1 addition & 1 deletion tests/routines/test_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from pathlib import Path

import pytest
import torch.nn as nn
from cli_test_helpers import ArgvContext
from torch import nn

from torch_uncertainty import cli_main, init_args
from torch_uncertainty.optimization_procedures import optim_cifar10_resnet18
Expand Down
2 changes: 1 addition & 1 deletion tests/routines/test_regression.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# fmt:off
from pathlib import Path

import torch.nn as nn
from cli_test_helpers import ArgvContext
from torch import nn

from torch_uncertainty import cli_main, init_args
from torch_uncertainty.optimization_procedures import optim_cifar10_resnet18
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from pathlib import Path

import pytest
import torch.nn as nn
from cli_test_helpers import ArgvContext
from torch import nn

from torch_uncertainty import cli_main, init_args
from torch_uncertainty.baselines import VGG, ResNet, WideResNet
Expand Down
2 changes: 1 addition & 1 deletion tests/test_losses.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# fmt: off
import pytest
import torch
import torch.nn as nn
from torch import nn

from torch_uncertainty.layers.bayesian_layers import BayesLinear
from torch_uncertainty.losses import ELBOLoss
Expand Down
2 changes: 1 addition & 1 deletion torch_uncertainty/baselines/classification/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from typing import Any, Literal, Optional, Type, Union

import torch
import torch.nn as nn
from pytorch_lightning import LightningModule
from pytorch_lightning.core.saving import (
load_hparams_from_tags_csv,
load_hparams_from_yaml,
)
from torch import nn

from ...models.resnet import (
batched_resnet18,
Expand Down
2 changes: 1 addition & 1 deletion torch_uncertainty/baselines/classification/vgg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from typing import Any, Literal, Optional, Type, Union

import torch
import torch.nn as nn
from pytorch_lightning import LightningModule
from pytorch_lightning.core.saving import (
load_hparams_from_tags_csv,
load_hparams_from_yaml,
)
from torch import nn

from ...models.vgg import (
packed_vgg11,
Expand Down
2 changes: 1 addition & 1 deletion torch_uncertainty/baselines/classification/wideresnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from typing import Any, Literal, Optional, Type, Union

import torch
import torch.nn as nn
from pytorch_lightning import LightningModule
from pytorch_lightning.core.saving import (
load_hparams_from_tags_csv,
load_hparams_from_yaml,
)
from torch import nn

from ...models.wideresnet import (
batched_wideresnet28x10,
Expand Down
2 changes: 1 addition & 1 deletion torch_uncertainty/baselines/regression/mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from typing import Any, List, Literal, Optional, Union

import torch
import torch.nn as nn
from pytorch_lightning import LightningModule
from pytorch_lightning.core.saving import (
load_hparams_from_tags_csv,
load_hparams_from_yaml,
)
from torch import nn

from ...models.mlp import mlp, packed_mlp
from ...routines.regression import RegressionEnsemble, RegressionSingle
Expand Down
2 changes: 1 addition & 1 deletion torch_uncertainty/datamodules/cifar10.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from pathlib import Path
from typing import Any, List, Literal, Optional, Union

import torch.nn as nn
import torchvision.transforms as T
from pytorch_lightning import LightningDataModule
from timm.data.auto_augment import rand_augment_transform
from torch import nn
from torch.utils.data import DataLoader, Dataset, random_split
from torchvision.datasets import CIFAR10, SVHN

Expand Down
2 changes: 1 addition & 1 deletion torch_uncertainty/datamodules/cifar100.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from typing import Any, List, Literal, Optional, Union

import torch
import torch.nn as nn
import torchvision.transforms as T
from pytorch_lightning import LightningDataModule
from timm.data.auto_augment import rand_augment_transform
from torch import nn
from torch.utils.data import DataLoader, Dataset, random_split
from torchvision.datasets import CIFAR100, SVHN

Expand Down
2 changes: 1 addition & 1 deletion torch_uncertainty/datamodules/imagenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from pathlib import Path
from typing import Any, List, Optional, Union

import torch.nn as nn
import torchvision.transforms as T
from pytorch_lightning import LightningDataModule
from timm.data.auto_augment import rand_augment_transform
from timm.data.mixup import Mixup
from torch import nn
from torch.utils.data import DataLoader, Dataset
from torchvision.datasets import DTD, SVHN, ImageNet, INaturalist

Expand Down
2 changes: 1 addition & 1 deletion torch_uncertainty/datamodules/tiny_imagenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from pathlib import Path
from typing import Any, List, Optional, Union

import torch.nn as nn
import torchvision.transforms as T
from pytorch_lightning import LightningDataModule
from timm.data.auto_augment import rand_augment_transform
from torch import nn
from torch.utils.data import DataLoader, Dataset
from torchvision.datasets import SVHN

Expand Down
2 changes: 1 addition & 1 deletion torch_uncertainty/layers/batchens_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Optional, Tuple, Union

import torch
import torch.nn as nn
from torch import nn
from torch.nn.common_types import _size_2_t
from torch.nn.modules.utils import _pair

Expand Down
3 changes: 1 addition & 2 deletions torch_uncertainty/layers/bayesian_layers/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from typing import Optional

import torch
import torch.nn as nn
from torch import Tensor
from torch import Tensor, nn

import numpy as np

Expand Down
3 changes: 1 addition & 2 deletions torch_uncertainty/layers/masksembles_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from typing import Any, Union

import torch
import torch.nn as nn
from torch import Tensor
from torch import Tensor, nn
from torch.nn.common_types import _size_2_t

import numpy as np
Expand Down
3 changes: 1 addition & 2 deletions torch_uncertainty/layers/packed_layers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# fmt: off
from typing import Any, Union

import torch.nn as nn
from einops import rearrange
from torch import Tensor
from torch import Tensor, nn
from torch.nn.common_types import _size_2_t


Expand Down
2 changes: 1 addition & 1 deletion torch_uncertainty/models/deep_ensembles.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import List, Optional, Union

import torch
import torch.nn as nn
from torch import nn


# fmt: on
Expand Down
2 changes: 1 addition & 1 deletion torch_uncertainty/models/lenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from typing import Callable, Dict, Optional, Type, Union

import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import nn

from ..layers.bayesian_layers import BayesConv2d, BayesLinear
from ..layers.packed_layers import PackedConv2d, PackedLinear
Expand Down
Loading

0 comments on commit 3b14e42

Please sign in to comment.