diff --git a/README.md b/README.md index ca0ba4b0..2d1914ff 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Logo](./docs/source/_static/lightning_logo_medium.png) +![Logo](./docs/source/_static/lightning_logo_small.png) # PyTorch Lightning @@ -123,7 +123,7 @@ trainer = Trainer(experiment=exp, max_nb_epochs=1, train_percent_check=0.1) trainer.fit(model) # view tensorflow logs -print(f'View tensorboard logs by running\ntensorboard --logdir {os.getcwd()}') +print('View tensorboard logs by running\ntensorboard --logdir %s' % os.getcwd()) print('and going to http://localhost:6006 on your browser') ``` diff --git a/docs/Trainer/Distributed training.md b/docs/Trainer/Distributed training.md index aedbd20e..cafc719d 100644 --- a/docs/Trainer/Distributed training.md +++ b/docs/Trainer/Distributed training.md @@ -94,7 +94,7 @@ cluster.add_command('export NCCL_SOCKET_IFNAME=^docker0,lo') cluster.add_command('export NCCL_DEBUG=INFO') # setting a master port here is a good idea. -cluster.add_command(f'export MASTER_PORT={PORT}') +cluster.add_command('export MASTER_PORT=%r' % PORT) # good to load the latest NCCL version cluster.load_modules(['NCCL/2.4.7-1-cuda.10.0']) diff --git a/examples/new_project_templates/single_cpu_template.py b/examples/new_project_templates/single_cpu_template.py index 29c25598..c9ad4435 100644 --- a/examples/new_project_templates/single_cpu_template.py +++ b/examples/new_project_templates/single_cpu_template.py @@ -102,5 +102,5 @@ if __name__ == '__main__': # RUN TRAINING # --------------------- # run on HPC cluster - print(f'RUNNING ON CPU') + print('RUNNING ON CPU') main(hyperparams) diff --git a/examples/new_project_templates/single_gpu_node_16bit_template.py b/examples/new_project_templates/single_gpu_node_16bit_template.py index 14db484e..c2bf6674 100644 --- a/examples/new_project_templates/single_gpu_node_16bit_template.py +++ b/examples/new_project_templates/single_gpu_node_16bit_template.py @@ -105,5 +105,5 @@ if __name__ == '__main__': # RUN TRAINING # --------------------- # run on HPC cluster - print(f'RUNNING INTERACTIVE MODE ON GPUS. gpu ids: {hyperparams.gpus}') + print('RUNNING INTERACTIVE MODE ON GPUS. gpu ids: %i' % hyperparams.gpus) main(hyperparams) diff --git a/examples/new_project_templates/single_gpu_node_ddp_template.py b/examples/new_project_templates/single_gpu_node_ddp_template.py index 56e301b2..358b8c94 100644 --- a/examples/new_project_templates/single_gpu_node_ddp_template.py +++ b/examples/new_project_templates/single_gpu_node_ddp_template.py @@ -105,5 +105,5 @@ if __name__ == '__main__': # RUN TRAINING # --------------------- # run on HPC cluster - print(f'RUNNING INTERACTIVE MODE ON GPUS. gpu ids: {hyperparams.gpus}') + print('RUNNING INTERACTIVE MODE ON GPUS. gpu ids: %i' % hyperparams.gpus) main(hyperparams) diff --git a/examples/new_project_templates/single_gpu_node_dp_template.py b/examples/new_project_templates/single_gpu_node_dp_template.py index 9d699253..65692441 100644 --- a/examples/new_project_templates/single_gpu_node_dp_template.py +++ b/examples/new_project_templates/single_gpu_node_dp_template.py @@ -104,5 +104,5 @@ if __name__ == '__main__': # RUN TRAINING # --------------------- # run on HPC cluster - print(f'RUNNING INTERACTIVE MODE ON GPUS. gpu ids: {hyperparams.gpus}') + print('RUNNING INTERACTIVE MODE ON GPUS. gpu ids: %i' % hyperparams.gpus) main(hyperparams) diff --git a/pytorch_lightning/models/trainer.py b/pytorch_lightning/models/trainer.py index b07b1808..7d2a925c 100644 --- a/pytorch_lightning/models/trainer.py +++ b/pytorch_lightning/models/trainer.py @@ -460,9 +460,11 @@ class Trainer(TrainerIO): # check for this bug (amp + dp + !01 doesn't work) # https://github.com/NVIDIA/apex/issues/227 if self.use_dp and self.use_amp: - m = f'amp level {self.amp_level} with DataParallel is not supported. ' \ - f'See this note from NVIDIA for more info: https://github.com/NVIDIA/apex/issues/227. ' \ - f'We recommend you switch to ddp if you want to use amp' + m = """ + Amp level %r with DataParallel is not supported. + See this note from NVIDIA for more info: https://github.com/NVIDIA/apex/issues/227. + We recommend you switch to ddp if you want to use amp + """ % self.amp_level raise MisconfigurationException(m) model = LightningDataParallel(model, device_ids=self.data_parallel_device_ids) @@ -543,7 +545,7 @@ class Trainer(TrainerIO): port = os.environ['MASTER_PORT'] except Exception: port = 12910 - os.environ['MASTER_PORT'] = f'{port}' + os.environ['MASTER_PORT'] = str(port) # figure out the root node addr try: diff --git a/pytorch_lightning/root_module/memory.py b/pytorch_lightning/root_module/memory.py index a0ec9aa0..3a636b04 100644 --- a/pytorch_lightning/root_module/memory.py +++ b/pytorch_lightning/root_module/memory.py @@ -196,6 +196,6 @@ def get_gpu_memory_map(): gpu_memory = [int(x) for x in result.strip().split('\n')] gpu_memory_map = {} for k, v in zip(range(len(gpu_memory)), gpu_memory): - k = f'gpu_{k}' + k = 'gpu_%i' % k gpu_memory_map[k] = v return gpu_memory_map diff --git a/tests/debug.py b/tests/debug.py index fb0109a0..d068e63e 100644 --- a/tests/debug.py +++ b/tests/debug.py @@ -132,7 +132,7 @@ def run_prediction(dataloader, trained_model): print(val_acc) - assert val_acc > 0.70, f'this model is expected to get > 0.7 in test set (it got {val_acc})' + assert val_acc > 0.70, 'this model is expected to get > 0.7 in test set (it got %f)' % val_acc def main(): diff --git a/tests/test_models.py b/tests/test_models.py index fbf36442..59c4577a 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -670,13 +670,13 @@ def run_prediction(dataloader, trained_model): print(val_acc) - assert val_acc > 0.50, f'this model is expected to get > 0.50 in test set (it got {val_acc})' + assert val_acc > 0.50, 'this model is expected to get > 0.50 in test set (it got %f)' % val_acc def assert_ok_acc(trainer): # this model should get 0.80+ acc acc = trainer.tng_tqdm_dic['val_acc'] - assert acc > 0.50, f'model failed to get expected 0.50 validation accuracy. Got: {acc}' + assert acc > 0.50, 'model failed to get expected 0.50 validation accuracy. Got: %f' % acc if __name__ == '__main__':