microsoft / nni

An open source AutoML toolkit for automate machine learning lifecycle, including feature engineering, neural architecture search, model compression and hyper-parameter tuning.
https://nni.readthedocs.io
MIT License
14.05k stars 1.81k forks source link

multi-trial nas notebook error #4697

Open NotSure2732 opened 2 years ago

NotSure2732 commented 2 years ago

Describe the issue: While trying to run the example notebook for multi-trial nas in PyCharm, I run into the following error: TypeError: run() missing 1 required positional argument: 'applied_mutators' I could not find a similar error anywhere and since this is an example notebook, I thought it might be an error on my machine, but I could not find any.

Help is highly appreciated!

Environment:

Configuration: Please see nni/examples/notebooks/Retiarii_example_multi-trial_NAS.ipynb

Log message:

How to reproduce it?:

matluster commented 2 years ago

Which example notebook are you using?

NotSure2732 commented 2 years ago

nni/examples/notebooks/Retiarii_example_multi-trial_NAS.ipynb

matluster commented 2 years ago

I didn't really see what's wrong.

Could you please provide the full traceback of your error?

NotSure2732 commented 2 years ago

[2022-03-30 11:14:04] INFO (torch.distributed.nn.jit.instantiator/MainThread) Created a temporary directory at /var/folders/89/587vv7m93tq_8_d3094mgwnc0000gn/T/tmp7yx2up8i [2022-03-30 11:14:04] INFO (torch.distributed.nn.jit.instantiator/MainThread) Writing /var/folders/89/587vv7m93tq_8_d3094mgwnc0000gn/T/tmp7yx2up8i/_remote_module_non_sriptable.py [2022-03-30 11:14:04] INFO (pytorch_lightning.utilities.distributed/MainThread) GPU available: False, used: False [2022-03-30 11:14:04] INFO (pytorch_lightning.utilities.distributed/MainThread) TPU available: False, using: 0 TPU cores [2022-03-30 11:14:04] INFO (pytorch_lightning.utilities.distributed/MainThread) IPU available: False, using: 0 IPUs [2022-03-30 11:14:04] INFO (nni.experiment/MainThread) Creating experiment, Experiment ID: 7dqyixlk [2022-03-30 11:14:04] INFO (nni.experiment/MainThread) Connecting IPC pipe... [2022-03-30 11:14:05] INFO (nni.experiment/MainThread) Starting web server... [2022-03-30 11:14:06] INFO (nni.experiment/MainThread) Setting up... [2022-03-30 11:14:06] INFO (nni.runtime.msg_dispatcher_base/Thread-3) Dispatcher started [2022-03-30 11:14:06] INFO (nni.retiarii.experiment.pytorch/MainThread) Web UI URLs: http://127.0.0.1:8745 http://192.168.1.71:8745 [2022-03-30 11:14:07] INFO (nni.retiarii.experiment.pytorch/MainThread) Start strategy... [2022-03-30 11:14:07] INFO (root/MainThread) Successfully update searchSpace. Traceback (most recent call last): File "/Users/sh/PycharmProjects/testingNAS/main.py", line 68, in exp.run(exp_config, 8745) File "/Users/sh/PycharmProjects/testingNAS/venv/lib/python3.7/site-packages/nni/retiarii/experiment/pytorch.py", line 309, in run self.start(port, debug) File "/Users/sh/PycharmProjects/testingNAS/venv/lib/python3.7/site-packages/nni/retiarii/experiment/pytorch.py", line 281, in start self._start_strategy() File "/Users/sh/PycharmProjects/testingNAS/venv/lib/python3.7/site-packages/nni/retiarii/experiment/pytorch.py", line 207, in _start_strategy self.strategy.run(base_model_ir, self.applied_mutators) TypeError: run() missing 1 required positional argument: 'applied_mutators'

ultmaster commented 2 years ago

That was weird. Could you print the strategy you sent to RetiariiExperiment?

NotSure2732 commented 2 years ago

This is the outcome of printing the strategy: <class 'nni.retiarii.strategy.tpe_strategy.TPEStrategy'> After playing around with the notebook in different environments (PyCharm, JupyterNotebooks, Google Collab...) I managed to get the example notebook running on JupyterNotebook! I am not exactly sure what the difference is, but I believe it had something to do with how I specified not to use gpu. Either in the trainer (pl.Classification) or in the exp_config... I will look and try to figure out where exactly the difference in my code is and update this issue when I found it!

ultmaster commented 2 years ago

You might need an instance of strategy rather than a type of strategy. That means, it should be TPEStrategy() rather than TPEStrategy