Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
clean imports (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored Feb 2, 2021
1 parent 3c5b535 commit 27f765d
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 24 deletions.
1 change: 0 additions & 1 deletion flash/core/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from typing import Any, Union

import torch
from transformers.modeling_outputs import SequenceClassifierOutput

from flash.core.data import TaskDataPipeline
from flash.core.model import Task
Expand Down
2 changes: 0 additions & 2 deletions flash/core/data/datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import warnings
from typing import Any, Optional

import pytorch_lightning as pl
Expand Down
3 changes: 0 additions & 3 deletions flash/core/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@

import os.path
import zipfile
from io import BytesIO
from typing import Any, Type
from urllib.request import urlopen, urlretrieve
from zipfile import ZipFile

import requests
import torch
Expand Down
5 changes: 2 additions & 3 deletions flash/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from contextlib import contextmanager
from typing import Any, Callable, Dict, IO, Mapping, Optional, Sequence, Type, Union
from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Type, Union

import pytorch_lightning as pl
import torch
from torch import nn

from flash.core.data import DataModule, DataPipeline, download_data
from flash.core.data import DataModule, DataPipeline
from flash.core.utils import get_callable_dict


Expand Down
2 changes: 0 additions & 2 deletions flash/text/seq2seq/core/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
from typing import Any, Callable, Optional, Union

from datasets import load_dataset
from datasets.utils.download_manager import GenerateMode
from pytorch_lightning.utilities.exceptions import MisconfigurationException
from torch import Tensor
from transformers import AutoTokenizer, default_data_collator

Expand Down
2 changes: 0 additions & 2 deletions flash/vision/classification/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
from typing import Any, Callable, Mapping, Sequence, Type, Union

import torch
import torchvision
from pytorch_lightning.metrics import Accuracy
from pytorch_lightning.utilities.exceptions import MisconfigurationException
from torch import nn
from torch.nn import functional as F

Expand Down
3 changes: 1 addition & 2 deletions flash/vision/embedding/image_embedder_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
from typing import Any, Callable, Mapping, Optional, Sequence, Type, Union

import pytorch_lightning
import torch
import torchvision
from pytorch_lightning.metrics import Accuracy
Expand All @@ -25,7 +24,7 @@
from flash.core import Task
from flash.core.data import TaskDataPipeline
from flash.core.data.utils import _contains_any_tensor
from flash.vision.classification.data import _default_valid_transforms, _pil_loader, ImageClassificationData
from flash.vision.classification.data import _default_valid_transforms, _pil_loader
from flash.vision.embedding.model_map import _load_model, _models

_resnet_backbone = lambda model: nn.Sequential(*list(model.children())[:-2]) # noqa: E731
Expand Down
1 change: 0 additions & 1 deletion flash/vision/embedding/model_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from contextlib import suppress
from typing import Type

from pytorch_lightning.utilities import _BOLTS_AVAILABLE
from pytorch_lightning.utilities.exceptions import MisconfigurationException
Expand Down
6 changes: 1 addition & 5 deletions tests/core/test_finetuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Any, Callable, Mapping, Optional, Sequence, Type, Union
from typing import Any

import pytest
import pytorch_lightning as pl
import torch
from pytorch_lightning.utilities.exceptions import MisconfigurationException
from torch import nn
from torch.nn import functional as F

from flash import Trainer
from flash.core.finetuning import NoFreeze
from flash.core.model import Task
from flash.vision.classification import ImageClassifier


Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from flash import ClassificationTask
from flash.tabular import TabularClassifier
from flash.text import SummarizationTask, TextClassifier, TranslationTask
from flash.text import SummarizationTask, TextClassifier
from flash.vision import ImageClassifier

# ======== Mock functions ========
Expand Down
3 changes: 1 addition & 2 deletions tests/core/test_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
# limitations under the License.
from typing import Any

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

from flash import ClassificationTask, Trainer
from flash.core.finetuning import Freeze, NoFreeze
from flash.core.finetuning import NoFreeze


class DummyDataset(torch.utils.data.Dataset):
Expand Down

0 comments on commit 27f765d

Please sign in to comment.