Skip to content

segmentation-tutorial.ipynb crashes without Apex #437

@kormalev

Description

@kormalev

Describe the bug
In examples/notebooks/segmentation-tutorial.ipynb, if you skip NVIDIA Apex installation (as per the comment in the first code cell saying if Your machine doesn't support FP16, comment this lines), the notebook will crash on runner.train(...).

To Reproduce
Steps to reproduce the behavior:

  1. Comment out
!git clone https://github.com/NVIDIA/apex
!pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./apex
  1. Run all cells.

Expected behavior
Successful execution.

Additional context
Traceback (tested on a Colab instance with K80):

---------------------------------------------------------------------------

ModuleNotFoundError                       Traceback (most recent call last)

/usr/local/lib/python3.6/dist-packages/catalyst/utils/torch.py in assert_fp16_available()
    105     try:
--> 106         __import__("apex")
    107     except ImportError:

ModuleNotFoundError: No module named 'apex'


During handling of the above exception, another exception occurred:

AssertionError                            Traceback (most recent call last)

8 frames

/usr/local/lib/python3.6/dist-packages/catalyst/dl/core/runner.py in run_experiment(self, experiment, check)
    227             for stage in self.experiment.stages:
--> 228                 self._run_stage(stage)
    229         except (Exception, KeyboardInterrupt) as ex:

/usr/local/lib/python3.6/dist-packages/catalyst/dl/core/runner.py in _run_stage(self, stage)
    191     def _run_stage(self, stage: str):
--> 192         self._prepare_for_stage(stage)
    193         loaders = self.experiment.get_loaders(stage)

/usr/local/lib/python3.6/dist-packages/catalyst/dl/core/runner.py in _prepare_for_stage(self, stage)
     78         self.model, criterion, optimizer, scheduler, self.device = \
---> 79             self._get_experiment_components(stage)
     80 

/usr/local/lib/python3.6/dist-packages/catalyst/dl/core/runner.py in _get_experiment_components(self, stage)
     61                 scheduler=scheduler,
---> 62                 distributed_params=self.experiment.distributed_params
     63             )

/usr/local/lib/python3.6/dist-packages/catalyst/dl/utils/torch.py in process_components(model, criterion, optimizer, scheduler, distributed_params)
     34         assert isinstance(model, nn.Module)
---> 35         utils.assert_fp16_available()
     36         from apex import amp

/usr/local/lib/python3.6/dist-packages/catalyst/utils/torch.py in assert_fp16_available()
    108         assert False, \
--> 109             "NVidia Apex package must be installed. " \
    110             "See https://github.com/NVIDIA/apex."

AssertionError: NVidia Apex package must be installed. See https://github.com/NVIDIA/apex.


During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)

<ipython-input-25-ee9db9bd610d> in <module>()
     54 
     55     # prints train logs
---> 56     verbose=True
     57 )

/usr/local/lib/python3.6/dist-packages/catalyst/dl/runner/supervised.py in train(self, model, criterion, optimizer, loaders, logdir, callbacks, scheduler, resume, num_epochs, valid_loader, main_metric, minimize_metric, verbose, state_kwargs, checkpoint_data, fp16, monitoring_params, check)
    195             monitoring_params=monitoring_params
    196         )
--> 197         self.run_experiment(experiment, check=check)
    198 
    199     def infer(

/usr/local/lib/python3.6/dist-packages/catalyst/dl/core/runner.py in run_experiment(self, experiment, check)
    228                 self._run_stage(stage)
    229         except (Exception, KeyboardInterrupt) as ex:
--> 230             self.state.exception = ex
    231             self._run_event("exception")
    232 

AttributeError: 'NoneType' object has no attribute 'exception'

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions