c7fc32d37d74dc7ea085f4885f6f17eb213d1e68,optuna/integration/pytorch_lightning.py,,,#,3
Before Change
from typing import Dict // NOQA
from typing import Optional // NOQA
try:
from pytorch_lightning.callbacks import EarlyStopping
from pytorch_lightning import LightningModule
from pytorch_lightning import Trainer
_available = True
except (ImportError, SyntaxError) as e:
// SyntaxError is raised with Python versions below 3.6 since PyTorch Lightning does not
// support them.
_import_error = e
// PyTorchLightningPruningCallback is disabled because PyTorch Lightning is not available.
_available = False
EarlyStopping = object
class PyTorchLightningPruningCallback(EarlyStopping):
PyTorch Lightning callback to prune unpromising trials.
See `the example <https://github.com/optuna/optuna/blob/master/
After Change
from typing import Dict // NOQA
from typing import Optional // NOQA
with optuna._imports.try_import(catch=(ImportError, SyntaxError)) as _imports:
from pytorch_lightning.callbacks import EarlyStopping
from pytorch_lightning import LightningModule
from pytorch_lightning import Trainer
if not _imports.is_successful():
EarlyStopping = object // NOQA
In pattern: SUPERPATTERN
Frequency: 7
Non-data size: 12
Instances
Project Name: pfnet/optuna
Commit Name: c7fc32d37d74dc7ea085f4885f6f17eb213d1e68
Time: 2020-06-01
Author: hiroyuki.vincent.yamazaki@gmail.com
File Name: optuna/integration/pytorch_lightning.py
Class Name:
Method Name:
Project Name: pfnet/optuna
Commit Name: c7fc32d37d74dc7ea085f4885f6f17eb213d1e68
Time: 2020-06-01
Author: hiroyuki.vincent.yamazaki@gmail.com
File Name: optuna/integration/chainer.py
Class Name:
Method Name:
Project Name: pfnet/optuna
Commit Name: c7fc32d37d74dc7ea085f4885f6f17eb213d1e68
Time: 2020-06-01
Author: hiroyuki.vincent.yamazaki@gmail.com
File Name: optuna/integration/keras.py
Class Name:
Method Name:
Project Name: pfnet/optuna
Commit Name: c7fc32d37d74dc7ea085f4885f6f17eb213d1e68
Time: 2020-06-01
Author: hiroyuki.vincent.yamazaki@gmail.com
File Name: optuna/integration/xgboost.py
Class Name:
Method Name:
Project Name: pfnet/optuna
Commit Name: c7fc32d37d74dc7ea085f4885f6f17eb213d1e68
Time: 2020-06-01
Author: hiroyuki.vincent.yamazaki@gmail.com
File Name: optuna/integration/tfkeras.py
Class Name:
Method Name:
Project Name: pfnet/optuna
Commit Name: c7fc32d37d74dc7ea085f4885f6f17eb213d1e68
Time: 2020-06-01
Author: hiroyuki.vincent.yamazaki@gmail.com
File Name: optuna/integration/skopt.py
Class Name:
Method Name:
Project Name: pfnet/optuna
Commit Name: c7fc32d37d74dc7ea085f4885f6f17eb213d1e68
Time: 2020-06-01
Author: hiroyuki.vincent.yamazaki@gmail.com
File Name: optuna/integration/pytorch_ignite.py
Class Name:
Method Name: