fix optuna config and prevent double logging
This commit is contained in:
1 parent
b1e0bf9717
commit
5f57eb7875
4 files changed
+12
-23
No files matched your search
@@ -237,9 +237,6 @@ python train.py callbacks=default_callbacks
|
|||||||
|
|
||||||
> *PyTorch Lightning provides about [40+ useful trainer flags](https://pytorch-lightning.readthedocs.io/en/latest/common/trainer.html#trainer-flags).*
|
> *PyTorch Lightning provides about [40+ useful trainer flags](https://pytorch-lightning.readthedocs.io/en/latest/common/trainer.html#trainer-flags).*
|
||||||
```yaml
|
```yaml
|
||||||
# accumulate gradients from 10 training steps
|
|
||||||
python train.py trainer.accumulate_grad_batches=10
|
|
||||||
|
|
||||||
# gradient clipping may be enabled to avoid exploding gradients
|
# gradient clipping may be enabled to avoid exploding gradients
|
||||||
python train.py trainer.gradient_clip_val=0.5
|
python train.py trainer.gradient_clip_val=0.5
|
||||||
|
|
||||||
@@ -248,6 +245,9 @@ python train.py trainer.stochastic_weight_avg=True
|
|||||||
|
|
||||||
# run validation loop 4 times during a training epoch
|
# run validation loop 4 times during a training epoch
|
||||||
python train.py trainer.val_check_interval=0.25
|
python train.py trainer.val_check_interval=0.25
|
||||||
|
|
||||||
|
# accumulate gradients
|
||||||
|
python train.py trainer.accumulate_grad_batches=10
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -267,8 +267,8 @@ python train.py trainer.weights_summary="full"
|
|||||||
# print execution time profiling after training ends
|
# print execution time profiling after training ends
|
||||||
python train.py trainer.profiler="simple"
|
python train.py trainer.profiler="simple"
|
||||||
|
|
||||||
# try overfitting to 10 batches
|
# try overfitting to 1 batch
|
||||||
python train.py trainer.overfit_batches=10
|
python train.py trainer.overfit_batches=1 trainer.max_epochs=20
|
||||||
|
|
||||||
# use only 20% of the data
|
# use only 20% of the data
|
||||||
python train.py trainer.limit_train_batches=0.2 \
|
python train.py trainer.limit_train_batches=0.2 \
|
||||||
@@ -297,7 +297,7 @@ python train.py trainer.resume_from_checkpoint="/absolute/path/to/ckpt/name.ckpt
|
|||||||
```yaml
|
```yaml
|
||||||
# this will run 6 experiments one after the other,
|
# this will run 6 experiments one after the other,
|
||||||
# each with different combination of batch_size and learning rate
|
# each with different combination of batch_size and learning rate
|
||||||
python train.py -m datamodule.batch_size=32,64,128 model.lr=0.001,0.0005
|
python train.py -m datamodule.batch_size=32,64,128 optimizer.lr=0.001,0.0005
|
||||||
```
|
```
|
||||||
> *Currently sweeps aren't failure resistant (if one job crashes than the whole sweep crashes), but it will be supported in future Hydra release.*
|
> *Currently sweeps aren't failure resistant (if one job crashes than the whole sweep crashes), but it will be supported in future Hydra release.*
|
||||||
|
|
||||||
@@ -708,20 +708,7 @@ Train model with default configuration:
|
|||||||
python train.py
|
python train.py
|
||||||
```
|
```
|
||||||
|
|
||||||
Train model with chosen logger like Weights&Biases:
|
Train model with chosen experiment configuration:
|
||||||
```yaml
|
|
||||||
# set project and entity names in `configs/logger/wandb.yaml`
|
|
||||||
wandb:
|
|
||||||
project: "your_project_name"
|
|
||||||
entity: "your_wandb_team_name"
|
|
||||||
```
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# train model with Weights&Biases
|
|
||||||
python train.py logger=wandb
|
|
||||||
```
|
|
||||||
|
|
||||||
Train model with chosen experiment config:
|
|
||||||
```yaml
|
```yaml
|
||||||
# experiment configurations are placed in folder `configs/experiment/`
|
# experiment configurations are placed in folder `configs/experiment/`
|
||||||
python train.py +experiment=exp_example_simple
|
python train.py +experiment=exp_example_simple
|
||||||
@@ -736,7 +723,6 @@ To train on GPU:
|
|||||||
```yaml
|
```yaml
|
||||||
python train.py trainer.gpus=1
|
python train.py trainer.gpus=1
|
||||||
```
|
```
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ hydra:
|
|||||||
datamodule.batch_size:
|
datamodule.batch_size:
|
||||||
type: categorical
|
type: categorical
|
||||||
choices: [32, 64, 128]
|
choices: [32, 64, 128]
|
||||||
model.lr:
|
optimizer.lr:
|
||||||
type: float
|
type: float
|
||||||
low: 0.0001
|
low: 0.0001
|
||||||
high: 0.2
|
high: 0.2
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ def extras(config: DictConfig):
|
|||||||
|
|
||||||
# make it possible to add new keys to config
|
# make it possible to add new keys to config
|
||||||
OmegaConf.set_struct(config, False)
|
OmegaConf.set_struct(config, False)
|
||||||
|
|
||||||
|
# fix double logging bug (this will be removed when lightning releases patch)
|
||||||
|
pl_logger = logging.getLogger('lightning')
|
||||||
|
pl_logger.propagate = False
|
||||||
|
|
||||||
# [OPTIONAL] Disable python warnings if <config.disable_warnings=True>
|
# [OPTIONAL] Disable python warnings if <config.disable_warnings=True>
|
||||||
if config.get("disable_warnings"):
|
if config.get("disable_warnings"):
|
||||||
|
|||||||
@@ -107,7 +107,6 @@ def train(config: DictConfig):
|
|||||||
|
|
||||||
@hydra.main(config_path="configs/", config_name="config.yaml")
|
@hydra.main(config_path="configs/", config_name="config.yaml")
|
||||||
def main(config: DictConfig):
|
def main(config: DictConfig):
|
||||||
pass
|
|
||||||
return train(config)
|
return train(config)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user