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

ModuleNotFoundError - Please, pip install . '[image]' #341

Closed
just-eoghan opened this issue May 26, 2021 · 6 comments
Closed

ModuleNotFoundError - Please, pip install . '[image]' #341

just-eoghan opened this issue May 26, 2021 · 6 comments
Assignees
Labels
bug / fix Something isn't working help wanted Extra attention is needed

Comments

@just-eoghan
Copy link
Contributor

🐛 Bug

The finetuning object dection example https://lightning-flash.readthedocs.io/en/latest/reference/object_detection.html#finetuning fails with error

Exception has occurred: ModuleNotFoundError
Please, pip install . '[image]'

To Reproduce

Steps to reproduce the behavior:

Run the lightning flash object detection fine tuning example.

https://lightning-flash.readthedocs.io/en/latest/reference/object_detection.html#finetuning

Code sample

import flash
from flash.core.data.utils import download_data
from flash.image import ObjectDetectionData, ObjectDetector

# 1. Download the data
# Dataset Credit: https://www.kaggle.com/ultralytics/coco128
download_data("https://github.com/zhiqwang/yolov5-rt-stack/releases/download/v0.3.0/coco128.zip", "data/")

# 2. Load the Data
datamodule = ObjectDetectionData.from_coco(
    train_folder="data/coco128/images/train2017/",
    train_ann_file="data/coco128/annotations/instances_train2017.json",
    val_split=0.3,
    batch_size=4,
    num_workers=4,
)

# 3. Build the model
model = ObjectDetector(model="retinanet", num_classes=datamodule.num_classes)

# 4. Create the trainer
trainer = flash.Trainer(max_epochs=3, limit_train_batches=1, limit_val_batches=1)

# 5. Finetune the model
trainer.finetune(model, datamodule=datamodule)

# 6. Save it!
trainer.save_checkpoint("object_detection_model.pt")`

Expected behavior

The fine-tuning example of object detection is expected to run.

Environment

  • PyTorch Version: 1.7.1
  • OS (e.g., Linux): Ubuntu 20.04
  • How you installed PyTorch: Pip
  • Python version: Python 3.6.13 :: Anaconda, Inc.
  • cuDNN version: 7.6
  • GPU models and configuration:
@just-eoghan just-eoghan added bug / fix Something isn't working help wanted Extra attention is needed labels May 26, 2021
@ethanwharris
Copy link
Collaborator

Hi @deepseek-eoghan It looks like you have some missing dependencies, did you try pip install "lightning-flash[image]"?

@just-eoghan
Copy link
Contributor Author

Hey @ethanwharris that works perfectly thanks for your help!

Will we consider a PR for the following line of the flash.image.detection.model? @ https://github.com/PyTorchLightning/lightning-flash/blob/master/flash/image/detection/model.py

Line 97

Change:

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

To:

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

I can submit a PR if you think it's worthwhile. Thank you.

@akihironitta
Copy link
Contributor

Hi @deepseek-eoghan! Thank you for reporting the issue. Your suggestion sounds reasonable :] Could you submit a PR for this?

@just-eoghan
Copy link
Contributor Author

Great thanks @akihironitta, am I able to make a branch to make the changes for the PR?

@akihironitta
Copy link
Contributor

@deepseek-eoghan Thank you for your interest!

am I able to make a branch to make the changes for the PR?

No, you cannot create a branch in this repository. First, you need to fork (=copy) this repository for you to make changes. Here's an overview for contribution:

  1. Fork (=copy) this repository so that you can make changes.
  2. Make changes in your repository. (i.e. https://github.com/deepseek-eoghan/lightning-flash)
    (you can make a branch in your repository)
  3. Submit a PR. :]

You can find more details at https://github.com/PyTorchLightning/lightning-flash/blob/master/.github/CONTRIBUTING.md.

@just-eoghan
Copy link
Contributor Author

Hey @ethanwharris @akihironitta thanks for your help!

Closing this now with a PR pending #347

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug / fix Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants