Skip to content

Correcting for running Template-vision-segmentation in colab #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Jar199 opened this issue Jul 27, 2023 · 2 comments · Fixed by #286
Closed

Correcting for running Template-vision-segmentation in colab #281

Jar199 opened this issue Jul 27, 2023 · 2 comments · Fixed by #286

Comments

@Jar199
Copy link

Jar199 commented Jul 27, 2023

It’s about trivial error.

We can run the template we want through the open in colab button in the pytorch-ignite code generator. And, we can press the button to link the following code to run in colab for running Template-vision-segmentation directly in colab.

!wget https://raw.githubusercontent.com/pytorch-ignite/nbs/main/nbs/0a809e9f-82c6-42cc-a7de-378f7f87cc7b/ignite-template-vision-segmentation.zip  
!unzip ignite-template-vision-segmentation.zip  
!pip install -r requirements.txt  
!python main.py config.yaml  

However, if this is executed as colab, the following problem arise because it is executed without the data required for training.

Traceback (most recent call last):
  File "/content/data.py", line 80, in setup_data
    dataset_train = VOCSegmentationPIL(
  File "/content/data.py", line 56, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torchvision/datasets/voc.py", line 101, in __init__
    raise RuntimeError("Dataset not found or corrupted. You can use download=True to download it")
RuntimeError: Dataset not found or corrupted. You can use download=True to download it

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/content/main.py", line 128, in <module>
    main()
  File "/content/main.py", line 124, in main
    p.run(run, config=config)
  File "/usr/local/lib/python3.10/dist-packages/ignite/distributed/launcher.py", line 316, in run
    func(local_rank, *args, **kwargs)
  File "/content/main.py", line 36, in run
    dataloader_train, dataloader_eval = setup_data(config)
  File "/content/data.py", line 87, in setup_data
    raise RuntimeError(
RuntimeError: Dataset not found. You can use `download_datasets` from data.py function to download it.

So, I suggest correcting download=False to download=True in code-generator/src/templates/template-vision-segmentation/data.py for running it immediately.

@vfdev-5
Copy link
Member

vfdev-5 commented Jul 27, 2023

@Jar199 thanks for reporting! Yes, we were also thinking at some point about enabling automatic dataset downloading. We didn't do that due to the fact that the dataset size is about several GBs and automatically downloading it can be seen as an unexpected behaviour vs using already downloaded dataset.

Maybe, we can add additional line to the README and into colab cell:

python -c "from data import download_datasets; download_datasets('/path/to/data')"

What do you think ?

@Jar199
Copy link
Author

Jar199 commented Jul 27, 2023

I think that's a good idea!
That's a much better way to add command line like that than to change the code 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants