Skip to content

Commit

Permalink
chore: remove usort from requirement.txt and lint codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
IamGianluca committed Apr 5, 2024
1 parent d8ca3ce commit 7c14ae9
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 45 deletions.
7 changes: 3 additions & 4 deletions blazingai/learner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
import lightning as pl
import timm
import torch
from omegaconf import DictConfig
from torch import nn
from transformers import AutoConfig, AutoModel

from blazingai.loss import loss_factory
from blazingai.metrics import metric_factory

from blazingai.optim import lr_scheduler_factory, optimizer_factory
from blazingai.text.reinitialize import reinit_autoencoder_model
from omegaconf import DictConfig
from torch import nn
from transformers import AutoConfig, AutoModel


class ImageClassifier(pl.LightningModule):
Expand Down
14 changes: 6 additions & 8 deletions blazingai/recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
import numpy as np
import pandas as pd
import torch
from lightning.pytorch import callbacks
from lightning.pytorch.callbacks import RichProgressBar
from lightning.pytorch.callbacks.callback import Callback
from lightning.pytorch.loggers import Logger
from omegaconf import DictConfig, OmegaConf
from timm.data import transforms_factory

from blazingai import learner
from blazingai.io import print_mtrc, save_mtrc, save_pred
Expand All @@ -13,14 +19,6 @@
from blazingai.text.data import TextDataModule
from blazingai.vision.data import ImageDataModule

from lightning.pytorch import callbacks
from lightning.pytorch.callbacks import RichProgressBar

from lightning.pytorch.callbacks.callback import Callback
from lightning.pytorch.loggers import Logger
from omegaconf import DictConfig, OmegaConf
from timm.data import transforms_factory


# TODO: use protocol instead of ModuleType so that we can use a fake module when
# unit testing
Expand Down
2 changes: 1 addition & 1 deletion blazingai/vision/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path

import numpy as np
from joblib import delayed, Parallel
from joblib import Parallel, delayed
from loguru import logger
from PIL import Image
from pydicom import filereader
Expand Down
1 change: 0 additions & 1 deletion blazingai/vision/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import Any, Optional

import lightning as pl

import numpy as np
import torch
from PIL import Image, ImageFile
Expand Down
30 changes: 2 additions & 28 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@ antlr4-python3-runtime==4.9.3
asttokens==2.4.1
# via stack-data
attrs==23.2.0
# via
# aiohttp
# usort
# via aiohttp
certifi==2024.2.2
# via requests
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via
# moreorless
# usort
contourpy==1.2.1
# via matplotlib
coverage==7.4.4
Expand Down Expand Up @@ -84,8 +78,6 @@ joblib==1.3.2
# via scikit-learn
kiwisolver==1.4.5
# via matplotlib
libcst==1.2.0
# via usort
lightning==2.2.1
lightning-utilities==0.11.0
# via
Expand All @@ -98,8 +90,6 @@ markupsafe==2.1.5
matplotlib==3.8.4
matplotlib-inline==0.1.6
# via ipython
moreorless==0.4.0
# via usort
mpmath==1.3.0
# via sympy
msgpack==1.0.8
Expand All @@ -112,9 +102,7 @@ multiprocess==0.70.16
# via datasets
mypy==1.9.0
mypy-extensions==1.0.0
# via
# mypy
# typing-inspect
# via mypy
networkx==3.2.1
# via torch
numpy==1.26.4
Expand Down Expand Up @@ -181,8 +169,6 @@ pandas==2.2.1
# via datasets
parso==0.8.3
# via jedi
pathspec==0.12.1
# via trailrunner
pexpect==4.9.0
# via ipython
pillow==10.2.0
Expand Down Expand Up @@ -225,7 +211,6 @@ pyyaml==6.0.1
# via
# datasets
# huggingface-hub
# libcst
# lightning
# omegaconf
# pytorch-lightning
Expand Down Expand Up @@ -255,17 +240,13 @@ six==1.16.0
# python-dateutil
stack-data==0.6.3
# via ipython
stdlibs==2024.1.28
# via usort
sympy==1.12
# via torch
threadpoolctl==3.4.0
# via scikit-learn
timm==0.9.16
tokenizers==0.15.2
# via transformers
toml==0.10.2
# via usort
torch==2.2.1
# via
# lightning
Expand All @@ -286,8 +267,6 @@ tqdm==4.66.2
# lightning
# pytorch-lightning
# transformers
trailrunner==1.4.0
# via usort
traitlets==5.14.2
# via
# ipython
Expand All @@ -298,20 +277,15 @@ triton==2.2.0
typing-extensions==4.10.0
# via
# huggingface-hub
# libcst
# lightning
# lightning-utilities
# mypy
# pytorch-lightning
# torch
# typing-inspect
typing-inspect==0.9.0
# via libcst
tzdata==2024.1
# via pandas
urllib3==2.2.1
# via requests
usort==1.0.8.post1
wcwidth==0.2.13
# via prompt-toolkit
xxhash==3.4.1
Expand Down
3 changes: 2 additions & 1 deletion tests/test_convert_images.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from pathlib import Path

import pytest
from blazingai.vision.convert import convert_dicom2jpg
from pydicom import dcmread

from blazingai.vision.convert import convert_dicom2jpg


@pytest.fixture(scope="session")
def dicom_file(tmpdir_factory):
Expand Down
1 change: 1 addition & 0 deletions tests/test_io.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
import pytest
import torch

from blazingai.io import save_mtrc, save_pred


Expand Down
4 changes: 2 additions & 2 deletions tests/test_metrics.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest
import torch
from blazingai.metrics import CrossValMetricsTracker, MeanColumnwiseRootMeanSquaredError
from omegaconf import DictConfig

from torchmetrics.regression.mse import MeanSquaredError

from blazingai.metrics import CrossValMetricsTracker, MeanColumnwiseRootMeanSquaredError


def test_oof_metric():
# given
Expand Down

0 comments on commit 7c14ae9

Please sign in to comment.