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

Commit

Permalink
change Module not found error to a more verbose pip install command (#…
Browse files Browse the repository at this point in the history
…347)

* change Module not found error to a more verbose pip install command

* change ModuleNotFound error message for tabular

* change ModuleNotFound error message for image_style_transfer

* change ModuleNotFound error message for style transfer fix

* change MoudleNotFound error message for segmentation image

* change ModuleNotFound error message for embedding image

* change ModuleNotFound error message for seq2seq text

* change ModuleNotFound error message for classification text

* Remove -e

* Use \'

* Update error msg

Co-authored-by: Akihiro Nitta <nitta@akihironitta.com>
  • Loading branch information
just-eoghan and akihironitta committed May 29, 2021
1 parent 1054949 commit 9c5dbd7
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion flash/image/detection/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __init__(
):

if not _IMAGE_AVAILABLE:
raise ModuleNotFoundError("Please, pip install . '[image]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[image]'")

self.save_hyperparameters()

Expand Down
2 changes: 1 addition & 1 deletion flash/image/embedding/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(
pooling_fn: Callable = torch.max
):
if not _IMAGE_AVAILABLE:
raise ModuleNotFoundError("Please, pip install -e '.[image]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[image]'")

super().__init__(
model=None,
Expand Down
4 changes: 2 additions & 2 deletions flash/image/segmentation/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class SemanticSegmentationPathsDataSource(PathsDataSource):

def __init__(self):
if not _IMAGE_AVAILABLE:
raise ModuleNotFoundError("Please, pip install -e '.[image]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[image]'")
super().__init__(IMG_EXTENSIONS)

def load_data(self, data: Union[Tuple[str, str], Tuple[List[str], List[str]]],
Expand Down Expand Up @@ -172,7 +172,7 @@ def __init__(
image_size: A tuple with the expected output image size.
"""
if not _IMAGE_AVAILABLE:
raise ModuleNotFoundError("Please, pip install -e '.[image]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[image]'")
self.image_size = image_size
self.num_classes = num_classes
if num_classes:
Expand Down
2 changes: 1 addition & 1 deletion flash/image/segmentation/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __init__(
) -> None:

if isinstance(backbone, str) and (not _TORCHVISION_AVAILABLE or not _TIMM_AVAILABLE):
raise ModuleNotFoundError("Please, pip install -e '.[image]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[image]'")

if metrics is None:
metrics = IoU(num_classes=num_classes)
Expand Down
2 changes: 1 addition & 1 deletion flash/image/style_transfer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __init__(
):

if not _IMAGE_STLYE_TRANSFER:
raise ModuleNotFoundError("Please, pip install -e '.[image_style_transfer]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[image_style_transfer]'")

self.save_hyperparameters(ignore="style_image")

Expand Down
2 changes: 1 addition & 1 deletion flash/tabular/classification/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(
**tabnet_kwargs,
):
if not _TABULAR_AVAILABLE:
raise ModuleNotFoundError("Please, pip install -e '.[tabular]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[tabular]'")

self.save_hyperparameters()

Expand Down
4 changes: 2 additions & 2 deletions flash/text/classification/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, backbone: str, max_length: int = 128):
super().__init__()

if not _TEXT_AVAILABLE:
raise ModuleNotFoundError("Please, pip install -e '.[text]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[text]'")

self.backbone = backbone
self.tokenizer = AutoTokenizer.from_pretrained(backbone, use_fast=True)
Expand Down Expand Up @@ -203,7 +203,7 @@ def __init__(
):

if not _TEXT_AVAILABLE:
raise ModuleNotFoundError("Please, pip install -e '.[text]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[text]'")

self.backbone = backbone
self.max_length = max_length
Expand Down
2 changes: 1 addition & 1 deletion flash/text/classification/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(
serializer: Optional[Union[Serializer, Mapping[str, Serializer]]] = None,
):
if not _TEXT_AVAILABLE:
raise ModuleNotFoundError("Please, pip install -e '.[text]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[text]'")

self.save_hyperparameters()

Expand Down
6 changes: 3 additions & 3 deletions flash/text/seq2seq/core/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(
super().__init__()

if not _TEXT_AVAILABLE:
raise ModuleNotFoundError("Please, pip install -e '.[text]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[text]'")

self.backbone = backbone
self.tokenizer = AutoTokenizer.from_pretrained(self.backbone, use_fast=True)
Expand Down Expand Up @@ -236,7 +236,7 @@ def __init__(
self.padding = padding

if not _TEXT_AVAILABLE:
raise ModuleNotFoundError("Please, pip install -e '.[text]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[text]'")

super().__init__(
train_transform=train_transform,
Expand Down Expand Up @@ -292,7 +292,7 @@ def __init__(self):
super().__init__()

if not _TEXT_AVAILABLE:
raise ModuleNotFoundError("Please, pip install -e '.[text]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[text]'")

self._backbone = None
self._tokenizer = None
Expand Down
2 changes: 1 addition & 1 deletion flash/text/seq2seq/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(
num_beams: Optional[int] = None,
):
if not _TEXT_AVAILABLE:
raise ModuleNotFoundError("Please, pip install -e '.[text]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[text]'")

os.environ["TOKENIZERS_PARALLELISM"] = "TRUE"
# disable HF thousand warnings
Expand Down
2 changes: 1 addition & 1 deletion flash/text/seq2seq/summarization/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(
):
super().__init__()
if not _TEXT_AVAILABLE:
raise ModuleNotFoundError("Please, pip install -e '.[text]'")
raise ModuleNotFoundError("Please, pip install 'lightning-flash[text]'")

self.rouge_newline_sep = rouge_newline_sep
self.rouge_keys = rouge_keys
Expand Down

0 comments on commit 9c5dbd7

Please sign in to comment.