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

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

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