open-mmlab / mmengine

OpenMMLab Foundational Library for Training Deep Learning Models
https://mmengine.readthedocs.io/
Apache License 2.0
1.17k stars 353 forks source link

[Bug] The generated configuration file in work_dir is empty when I use the demo in "15 minutes to get started with MMEngine". #1155

Closed YQisme closed 1 year ago

YQisme commented 1 year ago

Prerequisite

Environment

OrderedDict([('sys.platform', 'linux'), ('Python', '3.8.15 | packaged by conda-forge | (default, Nov 22 2022, 08:49:35) [GCC 10.4.0]'), ('CUDA available', True), ('numpy_random_seed', 2147483648), ('GPU 0', 'NVIDIA GeForce RTX 2060'), ('CUDA_HOME', None), ('GCC', 'gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0'), ('PyTorch', '1.10.0+cu111'), ('PyTorch compiling details', 'PyTorch built with:\n - GCC 7.3\n - C++ Version: 201402\n - Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications\n - Intel(R) MKL-DNN v2.2.3 (Git Hash 7336ca9f055cf1bfa13efb658fe15dc9b41f0740)\n - OpenMP 201511 (a.k.a. OpenMP 4.5)\n - LAPACK is enabled (usually provided by MKL)\n - NNPACK is enabled\n - CPU capability usage: AVX2\n - CUDA Runtime 11.1\n - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86\n - CuDNN 8.0.5\n - Magma 2.5.2\n - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.1, CUDNN_VERSION=8.0.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.10.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, \n'), ('TorchVision', '0.11.1+cu111'), ('OpenCV', '4.7.0'), ('MMEngine', '0.7.3')])

Reproduces the problem - code sample

import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
from torch.optim import SGD
from torch.utils.data import DataLoader

from mmengine.evaluator import BaseMetric
from mmengine.model import BaseModel
from mmengine.runner import Runner

class MMResNet50(BaseModel):
    def __init__(self):
        super().__init__()
        self.resnet = torchvision.models.resnet50()

    def forward(self, imgs, labels, mode):
        x = self.resnet(imgs)
        if mode == 'loss':
            return {'loss': F.cross_entropy(x, labels)}
        elif mode == 'predict':
            return x, labels

class Accuracy(BaseMetric):
    def process(self, data_batch, data_samples):
        score, gt = data_samples
        self.results.append({
            'batch_size': len(gt),
            'correct': (score.argmax(dim=1) == gt).sum().cpu(),
        })

    def compute_metrics(self, results):
        total_correct = sum(item['correct'] for item in results)
        total_size = sum(item['batch_size'] for item in results)
        return dict(accuracy=100 * total_correct / total_size)

norm_cfg = dict(mean=[0.491, 0.482, 0.447], std=[0.202, 0.199, 0.201])
train_dataloader = DataLoader(batch_size=32,
                              shuffle=True,
                              dataset=torchvision.datasets.CIFAR10(
                                  'data/cifar10',
                                  train=True,
                                  download=True,
                                  transform=transforms.Compose([
                                      transforms.RandomCrop(32, padding=4),
                                      transforms.RandomHorizontalFlip(),
                                      transforms.ToTensor(),
                                      transforms.Normalize(**norm_cfg)
                                  ])))

val_dataloader = DataLoader(batch_size=32,
                            shuffle=False,
                            dataset=torchvision.datasets.CIFAR10(
                                'data/cifar10',
                                train=False,
                                download=True,
                                transform=transforms.Compose([
                                    transforms.ToTensor(),
                                    transforms.Normalize(**norm_cfg)
                                ])))

runner = Runner(
    model=MMResNet50(),
    work_dir='./work_dir',
    train_dataloader=train_dataloader,
    optim_wrapper=dict(optimizer=dict(type=SGD, lr=0.001, momentum=0.9)),
    train_cfg=dict(by_epoch=True, max_epochs=1, val_interval=1),
    val_dataloader=val_dataloader,
    val_cfg=dict(),
    val_evaluator=dict(type=Accuracy),
)
runner.train()

Reproduces the problem - command or script

python main.py

Reproduces the problem - error message

2023/05/19 13:41:05 - mmengine - INFO -

System environment: sys.platform: linux Python: 3.8.15 | packaged by conda-forge | (default, Nov 22 2022, 08:49:35) [GCC 10.4.0] CUDA available: True numpy_random_seed: 1160385709 GPU 0: NVIDIA GeForce RTX 2060 CUDA_HOME: None GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 1.10.0+cu111 PyTorch compiling details: PyTorch built with:

Runtime environment: dist_cfg: {'backend': 'nccl'} seed: None Distributed launcher: none Distributed training: False GPU number: 1

2023/05/19 13:41:08 - mmengine - INFO - Distributed training is not used, all SyncBatchNorm (SyncBN) layers in the model will be automatically reverted to BatchNormXd layers if they are used. 2023/05/19 13:41:08 - mmengine - INFO - Hooks will be executed in the following order: before_run: (VERY_HIGH ) RuntimeInfoHook
(BELOW_NORMAL) LoggerHook


before_train: (VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(VERY_LOW ) CheckpointHook


before_train_epoch: (VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(NORMAL ) DistSamplerSeedHook


before_train_iter: (VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook


after_train_iter: (VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(BELOW_NORMAL) LoggerHook
(LOW ) ParamSchedulerHook
(VERY_LOW ) CheckpointHook


after_train_epoch: (NORMAL ) IterTimerHook
(LOW ) ParamSchedulerHook
(VERY_LOW ) CheckpointHook


before_val_epoch: (NORMAL ) IterTimerHook


before_val_iter: (NORMAL ) IterTimerHook


after_val_iter: (NORMAL ) IterTimerHook
(BELOW_NORMAL) LoggerHook


after_val_epoch: (VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(BELOW_NORMAL) LoggerHook
(LOW ) ParamSchedulerHook
(VERY_LOW ) CheckpointHook


after_train: (VERY_LOW ) CheckpointHook


before_test_epoch: (NORMAL ) IterTimerHook


before_test_iter: (NORMAL ) IterTimerHook


after_test_iter: (NORMAL ) IterTimerHook
(BELOW_NORMAL) LoggerHook


after_test_epoch: (VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(BELOW_NORMAL) LoggerHook


after_run: (BELOW_NORMAL) LoggerHook


2023/05/19 13:41:08 - mmengine - WARNING - Dataset CIFAR10 has no metainfo. dataset_meta in visualizer will be None. 2023/05/19 13:41:08 - mmengine - WARNING - The prefix is not set in metric class Accuracy. 2023/05/19 13:41:08 - mmengine - WARNING - Dataset CIFAR10 has no metainfo. dataset_meta in evaluator, metric and visualizer will be None. Name of parameter - Initialization information

resnet.conv1.weight - torch.Size([64, 3, 7, 7]): The value is the same before and after calling init_weights of MMResNet50

resnet.bn1.weight - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.bn1.bias - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.0.conv1.weight - torch.Size([64, 64, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.0.bn1.weight - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.0.bn1.bias - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.0.conv2.weight - torch.Size([64, 64, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.0.bn2.weight - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.0.bn2.bias - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.0.conv3.weight - torch.Size([256, 64, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.0.bn3.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.0.bn3.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.0.downsample.0.weight - torch.Size([256, 64, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.0.downsample.1.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.0.downsample.1.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.1.conv1.weight - torch.Size([64, 256, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.1.bn1.weight - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.1.bn1.bias - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.1.conv2.weight - torch.Size([64, 64, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.1.bn2.weight - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.1.bn2.bias - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.1.conv3.weight - torch.Size([256, 64, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.1.bn3.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.1.bn3.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.2.conv1.weight - torch.Size([64, 256, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.2.bn1.weight - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.2.bn1.bias - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.2.conv2.weight - torch.Size([64, 64, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.2.bn2.weight - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.2.bn2.bias - torch.Size([64]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.2.conv3.weight - torch.Size([256, 64, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.2.bn3.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer1.2.bn3.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.0.conv1.weight - torch.Size([128, 256, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.0.bn1.weight - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.0.bn1.bias - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.0.conv2.weight - torch.Size([128, 128, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.0.bn2.weight - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.0.bn2.bias - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.0.conv3.weight - torch.Size([512, 128, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.0.bn3.weight - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.0.bn3.bias - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.0.downsample.0.weight - torch.Size([512, 256, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.0.downsample.1.weight - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.0.downsample.1.bias - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.1.conv1.weight - torch.Size([128, 512, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.1.bn1.weight - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.1.bn1.bias - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.1.conv2.weight - torch.Size([128, 128, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.1.bn2.weight - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.1.bn2.bias - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.1.conv3.weight - torch.Size([512, 128, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.1.bn3.weight - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.1.bn3.bias - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.2.conv1.weight - torch.Size([128, 512, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.2.bn1.weight - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.2.bn1.bias - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.2.conv2.weight - torch.Size([128, 128, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.2.bn2.weight - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.2.bn2.bias - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.2.conv3.weight - torch.Size([512, 128, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.2.bn3.weight - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.2.bn3.bias - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.3.conv1.weight - torch.Size([128, 512, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.3.bn1.weight - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.3.bn1.bias - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.3.conv2.weight - torch.Size([128, 128, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.3.bn2.weight - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.3.bn2.bias - torch.Size([128]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.3.conv3.weight - torch.Size([512, 128, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.3.bn3.weight - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer2.3.bn3.bias - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.0.conv1.weight - torch.Size([256, 512, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.0.bn1.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.0.bn1.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.0.conv2.weight - torch.Size([256, 256, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.0.bn2.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.0.bn2.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.0.conv3.weight - torch.Size([1024, 256, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.0.bn3.weight - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.0.bn3.bias - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.0.downsample.0.weight - torch.Size([1024, 512, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.0.downsample.1.weight - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.0.downsample.1.bias - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.1.conv1.weight - torch.Size([256, 1024, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.1.bn1.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.1.bn1.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.1.conv2.weight - torch.Size([256, 256, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.1.bn2.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.1.bn2.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.1.conv3.weight - torch.Size([1024, 256, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.1.bn3.weight - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.1.bn3.bias - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.2.conv1.weight - torch.Size([256, 1024, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.2.bn1.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.2.bn1.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.2.conv2.weight - torch.Size([256, 256, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.2.bn2.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.2.bn2.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.2.conv3.weight - torch.Size([1024, 256, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.2.bn3.weight - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.2.bn3.bias - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.3.conv1.weight - torch.Size([256, 1024, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.3.bn1.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.3.bn1.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.3.conv2.weight - torch.Size([256, 256, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.3.bn2.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.3.bn2.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.3.conv3.weight - torch.Size([1024, 256, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.3.bn3.weight - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.3.bn3.bias - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.4.conv1.weight - torch.Size([256, 1024, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.4.bn1.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.4.bn1.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.4.conv2.weight - torch.Size([256, 256, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.4.bn2.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.4.bn2.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.4.conv3.weight - torch.Size([1024, 256, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.4.bn3.weight - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.4.bn3.bias - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.5.conv1.weight - torch.Size([256, 1024, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.5.bn1.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.5.bn1.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.5.conv2.weight - torch.Size([256, 256, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.5.bn2.weight - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.5.bn2.bias - torch.Size([256]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.5.conv3.weight - torch.Size([1024, 256, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.5.bn3.weight - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer3.5.bn3.bias - torch.Size([1024]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.0.conv1.weight - torch.Size([512, 1024, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.0.bn1.weight - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.0.bn1.bias - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.0.conv2.weight - torch.Size([512, 512, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.0.bn2.weight - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.0.bn2.bias - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.0.conv3.weight - torch.Size([2048, 512, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.0.bn3.weight - torch.Size([2048]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.0.bn3.bias - torch.Size([2048]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.0.downsample.0.weight - torch.Size([2048, 1024, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.0.downsample.1.weight - torch.Size([2048]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.0.downsample.1.bias - torch.Size([2048]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.1.conv1.weight - torch.Size([512, 2048, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.1.bn1.weight - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.1.bn1.bias - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.1.conv2.weight - torch.Size([512, 512, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.1.bn2.weight - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.1.bn2.bias - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.1.conv3.weight - torch.Size([2048, 512, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.1.bn3.weight - torch.Size([2048]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.1.bn3.bias - torch.Size([2048]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.2.conv1.weight - torch.Size([512, 2048, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.2.bn1.weight - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.2.bn1.bias - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.2.conv2.weight - torch.Size([512, 512, 3, 3]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.2.bn2.weight - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.2.bn2.bias - torch.Size([512]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.2.conv3.weight - torch.Size([2048, 512, 1, 1]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.2.bn3.weight - torch.Size([2048]): The value is the same before and after calling init_weights of MMResNet50

resnet.layer4.2.bn3.bias - torch.Size([2048]): The value is the same before and after calling init_weights of MMResNet50

resnet.fc.weight - torch.Size([1000, 2048]): The value is the same before and after calling init_weights of MMResNet50

resnet.fc.bias - torch.Size([1000]): The value is the same before and after calling init_weights of MMResNet50
2023/05/19 13:41:08 - mmengine - WARNING - "FileClient" will be deprecated in future. Please use io functions in https://mmengine.readthedocs.io/en/latest/api/fileio.html#file-io 2023/05/19 13:41:08 - mmengine - WARNING - "HardDiskBackend" is the alias of "LocalBackend" and the former will be deprecated in future. 2023/05/19 13:41:08 - mmengine - INFO - Checkpoints will be saved to /home/yq/_myCode/mmengine/_myCode/work_dir. 2023/05/19 13:41:08 - mmengine - INFO - Epoch(train) [1][ 10/1563] lr: 1.0000e-03 eta: 0:01:15 time: 0.0484 data_time: 0.0075 memory: 402 loss: 5.3511 2023/05/19 13:41:09 - mmengine - INFO - Epoch(train) [1][ 20/1563] lr: 1.0000e-03 eta: 0:01:10 time: 0.0427 data_time: 0.0074 memory: 402 loss: 2.7090 2023/05/19 13:41:09 - mmengine - INFO - Epoch(train) [1][ 30/1563] lr: 1.0000e-03 eta: 0:01:08 time: 0.0421 data_time: 0.0074 memory: 402 loss: 2.5299 2023/05/19 13:41:10 - mmengine - INFO - Epoch(train) [1][ 40/1563] lr: 1.0000e-03 eta: 0:01:06 time: 0.0417 data_time: 0.0072 memory: 402 loss: 2.6026 2023/05/19 13:41:10 - mmengine - INFO - Epoch(train) [1][ 50/1563] lr: 1.0000e-03 eta: 0:01:05 time: 0.0423 data_time: 0.0073 memory: 402 loss: 2.6824 2023/05/19 13:41:11 - mmengine - INFO - Epoch(train) [1][ 60/1563] lr: 1.0000e-03 eta: 0:01:04 time: 0.0421 data_time: 0.0074 memory: 402 loss: 2.5870 2023/05/19 13:41:11 - mmengine - INFO - Epoch(train) [1][ 70/1563] lr: 1.0000e-03 eta: 0:01:04 time: 0.0421 data_time: 0.0074 memory: 402 loss: 2.6073 2023/05/19 13:41:11 - mmengine - INFO - Epoch(train) [1][ 80/1563] lr: 1.0000e-03 eta: 0:01:03 time: 0.0423 data_time: 0.0074 memory: 402 loss: 2.6252 2023/05/19 13:41:12 - mmengine - INFO - Epoch(train) [1][ 90/1563] lr: 1.0000e-03 eta: 0:01:03 time: 0.0424 data_time: 0.0075 memory: 402 loss: 2.6235 2023/05/19 13:41:12 - mmengine - INFO - Epoch(train) [1][ 100/1563] lr: 1.0000e-03 eta: 0:01:03 time: 0.0461 data_time: 0.0076 memory: 402 loss: 2.5009 2023/05/19 13:41:13 - mmengine - INFO - Epoch(train) [1][ 110/1563] lr: 1.0000e-03 eta: 0:01:03 time: 0.0451 data_time: 0.0077 memory: 402 loss: 2.7303 2023/05/19 13:41:13 - mmengine - INFO - Epoch(train) [1][ 120/1563] lr: 1.0000e-03 eta: 0:01:02 time: 0.0457 data_time: 0.0079 memory: 402 loss: 2.5268 2023/05/19 13:41:14 - mmengine - INFO - Epoch(train) [1][ 130/1563] lr: 1.0000e-03 eta: 0:01:03 time: 0.0494 data_time: 0.0091 memory: 402 loss: 2.6513 2023/05/19 13:41:14 - mmengine - INFO - Epoch(train) [1][ 140/1563] lr: 1.0000e-03 eta: 0:01:02 time: 0.0434 data_time: 0.0075 memory: 402 loss: 2.4555 2023/05/19 13:41:15 - mmengine - INFO - Epoch(train) [1][ 150/1563] lr: 1.0000e-03 eta: 0:01:02 time: 0.0440 data_time: 0.0077 memory: 402 loss: 2.4535 2023/05/19 13:41:15 - mmengine - INFO - Epoch(train) [1][ 160/1563] lr: 1.0000e-03 eta: 0:01:01 time: 0.0441 data_time: 0.0074 memory: 402 loss: 2.8105 2023/05/19 13:41:15 - mmengine - INFO - Epoch(train) [1][ 170/1563] lr: 1.0000e-03 eta: 0:01:01 time: 0.0419 data_time: 0.0073 memory: 402 loss: 2.3116 2023/05/19 13:41:16 - mmengine - INFO - Epoch(train) [1][ 180/1563] lr: 1.0000e-03 eta: 0:01:00 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.5994 2023/05/19 13:41:16 - mmengine - INFO - Epoch(train) [1][ 190/1563] lr: 1.0000e-03 eta: 0:00:59 time: 0.0411 data_time: 0.0070 memory: 402 loss: 2.5304 2023/05/19 13:41:17 - mmengine - INFO - Epoch(train) [1][ 200/1563] lr: 1.0000e-03 eta: 0:00:59 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.5770 2023/05/19 13:41:17 - mmengine - INFO - Epoch(train) [1][ 210/1563] lr: 1.0000e-03 eta: 0:00:58 time: 0.0410 data_time: 0.0069 memory: 402 loss: 2.4663 2023/05/19 13:41:18 - mmengine - INFO - Epoch(train) [1][ 220/1563] lr: 1.0000e-03 eta: 0:00:58 time: 0.0409 data_time: 0.0069 memory: 402 loss: 2.6125 2023/05/19 13:41:18 - mmengine - INFO - Epoch(train) [1][ 230/1563] lr: 1.0000e-03 eta: 0:00:57 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.6790 2023/05/19 13:41:18 - mmengine - INFO - Epoch(train) [1][ 240/1563] lr: 1.0000e-03 eta: 0:00:56 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.4663 2023/05/19 13:41:19 - mmengine - INFO - Epoch(train) [1][ 250/1563] lr: 1.0000e-03 eta: 0:00:56 time: 0.0409 data_time: 0.0069 memory: 402 loss: 2.5550 2023/05/19 13:41:19 - mmengine - INFO - Epoch(train) [1][ 260/1563] lr: 1.0000e-03 eta: 0:00:55 time: 0.0406 data_time: 0.0068 memory: 402 loss: 2.5105 2023/05/19 13:41:20 - mmengine - INFO - Epoch(train) [1][ 270/1563] lr: 1.0000e-03 eta: 0:00:55 time: 0.0407 data_time: 0.0068 memory: 402 loss: 2.3655 2023/05/19 13:41:20 - mmengine - INFO - Epoch(train) [1][ 280/1563] lr: 1.0000e-03 eta: 0:00:54 time: 0.0407 data_time: 0.0068 memory: 402 loss: 2.4505 2023/05/19 13:41:20 - mmengine - INFO - Epoch(train) [1][ 290/1563] lr: 1.0000e-03 eta: 0:00:54 time: 0.0407 data_time: 0.0068 memory: 402 loss: 2.3336 2023/05/19 13:41:21 - mmengine - INFO - Epoch(train) [1][ 300/1563] lr: 1.0000e-03 eta: 0:00:53 time: 0.0407 data_time: 0.0068 memory: 402 loss: 2.3620 2023/05/19 13:41:21 - mmengine - INFO - Epoch(train) [1][ 310/1563] lr: 1.0000e-03 eta: 0:00:53 time: 0.0408 data_time: 0.0069 memory: 402 loss: 2.3812 2023/05/19 13:41:22 - mmengine - INFO - Epoch(train) [1][ 320/1563] lr: 1.0000e-03 eta: 0:00:52 time: 0.0409 data_time: 0.0069 memory: 402 loss: 2.4255 2023/05/19 13:41:22 - mmengine - INFO - Epoch(train) [1][ 330/1563] lr: 1.0000e-03 eta: 0:00:52 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.2745 2023/05/19 13:41:22 - mmengine - INFO - Epoch(train) [1][ 340/1563] lr: 1.0000e-03 eta: 0:00:51 time: 0.0409 data_time: 0.0069 memory: 402 loss: 2.2934 2023/05/19 13:41:23 - mmengine - INFO - Epoch(train) [1][ 350/1563] lr: 1.0000e-03 eta: 0:00:51 time: 0.0409 data_time: 0.0069 memory: 402 loss: 2.4369 2023/05/19 13:41:23 - mmengine - INFO - Epoch(train) [1][ 360/1563] lr: 1.0000e-03 eta: 0:00:50 time: 0.0409 data_time: 0.0069 memory: 402 loss: 2.2780 2023/05/19 13:41:24 - mmengine - INFO - Epoch(train) [1][ 370/1563] lr: 1.0000e-03 eta: 0:00:50 time: 0.0409 data_time: 0.0069 memory: 402 loss: 2.3443 2023/05/19 13:41:24 - mmengine - INFO - Epoch(train) [1][ 380/1563] lr: 1.0000e-03 eta: 0:00:49 time: 0.0409 data_time: 0.0069 memory: 402 loss: 2.3311 2023/05/19 13:41:24 - mmengine - INFO - Epoch(train) [1][ 390/1563] lr: 1.0000e-03 eta: 0:00:49 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.3777 2023/05/19 13:41:25 - mmengine - INFO - Epoch(train) [1][ 400/1563] lr: 1.0000e-03 eta: 0:00:49 time: 0.0410 data_time: 0.0069 memory: 402 loss: 2.2806 2023/05/19 13:41:25 - mmengine - INFO - Epoch(train) [1][ 410/1563] lr: 1.0000e-03 eta: 0:00:48 time: 0.0410 data_time: 0.0069 memory: 402 loss: 2.2718 2023/05/19 13:41:26 - mmengine - INFO - Epoch(train) [1][ 420/1563] lr: 1.0000e-03 eta: 0:00:48 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.3595 2023/05/19 13:41:26 - mmengine - INFO - Epoch(train) [1][ 430/1563] lr: 1.0000e-03 eta: 0:00:47 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.3680 2023/05/19 13:41:27 - mmengine - INFO - Epoch(train) [1][ 440/1563] lr: 1.0000e-03 eta: 0:00:47 time: 0.0409 data_time: 0.0069 memory: 402 loss: 2.2793 2023/05/19 13:41:27 - mmengine - INFO - Epoch(train) [1][ 450/1563] lr: 1.0000e-03 eta: 0:00:46 time: 0.0409 data_time: 0.0069 memory: 402 loss: 2.4269 2023/05/19 13:41:27 - mmengine - INFO - Epoch(train) [1][ 460/1563] lr: 1.0000e-03 eta: 0:00:46 time: 0.0410 data_time: 0.0069 memory: 402 loss: 2.3564 2023/05/19 13:41:28 - mmengine - INFO - Epoch(train) [1][ 470/1563] lr: 1.0000e-03 eta: 0:00:45 time: 0.0410 data_time: 0.0069 memory: 402 loss: 2.4342 2023/05/19 13:41:28 - mmengine - INFO - Epoch(train) [1][ 480/1563] lr: 1.0000e-03 eta: 0:00:45 time: 0.0415 data_time: 0.0071 memory: 402 loss: 2.2780 2023/05/19 13:41:29 - mmengine - INFO - Epoch(train) [1][ 490/1563] lr: 1.0000e-03 eta: 0:00:44 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.3522 2023/05/19 13:41:29 - mmengine - INFO - Epoch(train) [1][ 500/1563] lr: 1.0000e-03 eta: 0:00:44 time: 0.0417 data_time: 0.0071 memory: 402 loss: 2.2248 2023/05/19 13:41:29 - mmengine - INFO - Epoch(train) [1][ 510/1563] lr: 1.0000e-03 eta: 0:00:44 time: 0.0413 data_time: 0.0070 memory: 402 loss: 2.2594 2023/05/19 13:41:30 - mmengine - INFO - Epoch(train) [1][ 520/1563] lr: 1.0000e-03 eta: 0:00:43 time: 0.0419 data_time: 0.0073 memory: 402 loss: 2.2553 2023/05/19 13:41:30 - mmengine - INFO - Epoch(train) [1][ 530/1563] lr: 1.0000e-03 eta: 0:00:43 time: 0.0416 data_time: 0.0071 memory: 402 loss: 2.1705 2023/05/19 13:41:31 - mmengine - INFO - Epoch(train) [1][ 540/1563] lr: 1.0000e-03 eta: 0:00:42 time: 0.0413 data_time: 0.0070 memory: 402 loss: 2.2205 2023/05/19 13:41:31 - mmengine - INFO - Epoch(train) [1][ 550/1563] lr: 1.0000e-03 eta: 0:00:42 time: 0.0416 data_time: 0.0072 memory: 402 loss: 2.3183 2023/05/19 13:41:31 - mmengine - INFO - Epoch(train) [1][ 560/1563] lr: 1.0000e-03 eta: 0:00:42 time: 0.0414 data_time: 0.0070 memory: 402 loss: 2.3192 2023/05/19 13:41:32 - mmengine - INFO - Epoch(train) [1][ 570/1563] lr: 1.0000e-03 eta: 0:00:41 time: 0.0413 data_time: 0.0071 memory: 402 loss: 2.1888 2023/05/19 13:41:32 - mmengine - INFO - Epoch(train) [1][ 580/1563] lr: 1.0000e-03 eta: 0:00:41 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.2247 2023/05/19 13:41:33 - mmengine - INFO - Epoch(train) [1][ 590/1563] lr: 1.0000e-03 eta: 0:00:40 time: 0.0413 data_time: 0.0070 memory: 402 loss: 2.1420 2023/05/19 13:41:33 - mmengine - INFO - Epoch(train) [1][ 600/1563] lr: 1.0000e-03 eta: 0:00:40 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.2798 2023/05/19 13:41:34 - mmengine - INFO - Epoch(train) [1][ 610/1563] lr: 1.0000e-03 eta: 0:00:39 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.4175 2023/05/19 13:41:34 - mmengine - INFO - Epoch(train) [1][ 620/1563] lr: 1.0000e-03 eta: 0:00:39 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.2465 2023/05/19 13:41:34 - mmengine - INFO - Epoch(train) [1][ 630/1563] lr: 1.0000e-03 eta: 0:00:39 time: 0.0412 data_time: 0.0069 memory: 402 loss: 2.2404 2023/05/19 13:41:35 - mmengine - INFO - Epoch(train) [1][ 640/1563] lr: 1.0000e-03 eta: 0:00:38 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.3494 2023/05/19 13:41:35 - mmengine - INFO - Epoch(train) [1][ 650/1563] lr: 1.0000e-03 eta: 0:00:38 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.2638 2023/05/19 13:41:36 - mmengine - INFO - Epoch(train) [1][ 660/1563] lr: 1.0000e-03 eta: 0:00:37 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.3225 2023/05/19 13:41:36 - mmengine - INFO - Epoch(train) [1][ 670/1563] lr: 1.0000e-03 eta: 0:00:37 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.4124 2023/05/19 13:41:36 - mmengine - INFO - Epoch(train) [1][ 680/1563] lr: 1.0000e-03 eta: 0:00:36 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.2916 2023/05/19 13:41:37 - mmengine - INFO - Epoch(train) [1][ 690/1563] lr: 1.0000e-03 eta: 0:00:36 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.1160 2023/05/19 13:41:37 - mmengine - INFO - Epoch(train) [1][ 700/1563] lr: 1.0000e-03 eta: 0:00:36 time: 0.0413 data_time: 0.0070 memory: 402 loss: 2.2391 2023/05/19 13:41:38 - mmengine - INFO - Epoch(train) [1][ 710/1563] lr: 1.0000e-03 eta: 0:00:35 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.2634 2023/05/19 13:41:38 - mmengine - INFO - Epoch(train) [1][ 720/1563] lr: 1.0000e-03 eta: 0:00:35 time: 0.0412 data_time: 0.0069 memory: 402 loss: 2.1726 2023/05/19 13:41:38 - mmengine - INFO - Epoch(train) [1][ 730/1563] lr: 1.0000e-03 eta: 0:00:34 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.1635 2023/05/19 13:41:39 - mmengine - INFO - Epoch(train) [1][ 740/1563] lr: 1.0000e-03 eta: 0:00:34 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.1486 2023/05/19 13:41:39 - mmengine - INFO - Epoch(train) [1][ 750/1563] lr: 1.0000e-03 eta: 0:00:33 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.2824 2023/05/19 13:41:40 - mmengine - INFO - Epoch(train) [1][ 760/1563] lr: 1.0000e-03 eta: 0:00:33 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.3144 2023/05/19 13:41:40 - mmengine - INFO - Epoch(train) [1][ 770/1563] lr: 1.0000e-03 eta: 0:00:33 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.1422 2023/05/19 13:41:41 - mmengine - INFO - Epoch(train) [1][ 780/1563] lr: 1.0000e-03 eta: 0:00:32 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.0965 2023/05/19 13:41:41 - mmengine - INFO - Epoch(train) [1][ 790/1563] lr: 1.0000e-03 eta: 0:00:32 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.1706 2023/05/19 13:41:41 - mmengine - INFO - Epoch(train) [1][ 800/1563] lr: 1.0000e-03 eta: 0:00:31 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.0549 2023/05/19 13:41:42 - mmengine - INFO - Epoch(train) [1][ 810/1563] lr: 1.0000e-03 eta: 0:00:31 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.0784 2023/05/19 13:41:42 - mmengine - INFO - Epoch(train) [1][ 820/1563] lr: 1.0000e-03 eta: 0:00:30 time: 0.0412 data_time: 0.0070 memory: 402 loss: 2.1630 2023/05/19 13:41:43 - mmengine - INFO - Epoch(train) [1][ 830/1563] lr: 1.0000e-03 eta: 0:00:30 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.1042 2023/05/19 13:41:43 - mmengine - INFO - Epoch(train) [1][ 840/1563] lr: 1.0000e-03 eta: 0:00:30 time: 0.0407 data_time: 0.0068 memory: 402 loss: 2.1631 2023/05/19 13:41:43 - mmengine - INFO - Epoch(train) [1][ 850/1563] lr: 1.0000e-03 eta: 0:00:29 time: 0.0407 data_time: 0.0068 memory: 402 loss: 2.1260 2023/05/19 13:41:44 - mmengine - INFO - Epoch(train) [1][ 860/1563] lr: 1.0000e-03 eta: 0:00:29 time: 0.0407 data_time: 0.0068 memory: 402 loss: 2.2317 2023/05/19 13:41:44 - mmengine - INFO - Epoch(train) [1][ 870/1563] lr: 1.0000e-03 eta: 0:00:28 time: 0.0407 data_time: 0.0068 memory: 402 loss: 2.1906 2023/05/19 13:41:45 - mmengine - INFO - Epoch(train) [1][ 880/1563] lr: 1.0000e-03 eta: 0:00:28 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.3000 2023/05/19 13:41:45 - mmengine - INFO - Epoch(train) [1][ 890/1563] lr: 1.0000e-03 eta: 0:00:27 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.2299 2023/05/19 13:41:45 - mmengine - INFO - Epoch(train) [1][ 900/1563] lr: 1.0000e-03 eta: 0:00:27 time: 0.0411 data_time: 0.0069 memory: 402 loss: 2.0608 2023/05/19 13:41:46 - mmengine - INFO - Epoch(train) [1][ 910/1563] lr: 1.0000e-03 eta: 0:00:27 time: 0.0413 data_time: 0.0070 memory: 402 loss: 2.1648 2023/05/19 13:41:46 - mmengine - INFO - Epoch(train) [1][ 920/1563] lr: 1.0000e-03 eta: 0:00:26 time: 0.0410 data_time: 0.0068 memory: 402 loss: 2.1665 2023/05/19 13:41:47 - mmengine - INFO - Epoch(train) [1][ 930/1563] lr: 1.0000e-03 eta: 0:00:26 time: 0.0410 data_time: 0.0069 memory: 402 loss: 2.1154 2023/05/19 13:41:47 - mmengine - INFO - Epoch(train) [1][ 940/1563] lr: 1.0000e-03 eta: 0:00:25 time: 0.0411 data_time: 0.0069 memory: 402 loss: 2.1991 2023/05/19 13:41:48 - mmengine - INFO - Epoch(train) [1][ 950/1563] lr: 1.0000e-03 eta: 0:00:25 time: 0.0408 data_time: 0.0068 memory: 402 loss: 1.9364 2023/05/19 13:41:48 - mmengine - INFO - Epoch(train) [1][ 960/1563] lr: 1.0000e-03 eta: 0:00:25 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.0065 2023/05/19 13:41:48 - mmengine - INFO - Epoch(train) [1][ 970/1563] lr: 1.0000e-03 eta: 0:00:24 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.0669 2023/05/19 13:41:49 - mmengine - INFO - Epoch(train) [1][ 980/1563] lr: 1.0000e-03 eta: 0:00:24 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.0584 2023/05/19 13:41:49 - mmengine - INFO - Epoch(train) [1][ 990/1563] lr: 1.0000e-03 eta: 0:00:23 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.0071 2023/05/19 13:41:50 - mmengine - INFO - Exp name: 20230519_134105 2023/05/19 13:41:50 - mmengine - INFO - Epoch(train) [1][1000/1563] lr: 1.0000e-03 eta: 0:00:23 time: 0.0408 data_time: 0.0068 memory: 402 loss: 1.9867 2023/05/19 13:41:50 - mmengine - INFO - Epoch(train) [1][1010/1563] lr: 1.0000e-03 eta: 0:00:22 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.1919 2023/05/19 13:41:50 - mmengine - INFO - Epoch(train) [1][1020/1563] lr: 1.0000e-03 eta: 0:00:22 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.1846 2023/05/19 13:41:51 - mmengine - INFO - Epoch(train) [1][1030/1563] lr: 1.0000e-03 eta: 0:00:22 time: 0.0408 data_time: 0.0067 memory: 402 loss: 2.2081 2023/05/19 13:41:51 - mmengine - INFO - Epoch(train) [1][1040/1563] lr: 1.0000e-03 eta: 0:00:21 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.2746 2023/05/19 13:41:52 - mmengine - INFO - Epoch(train) [1][1050/1563] lr: 1.0000e-03 eta: 0:00:21 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.1566 2023/05/19 13:41:52 - mmengine - INFO - Epoch(train) [1][1060/1563] lr: 1.0000e-03 eta: 0:00:20 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.0213 2023/05/19 13:41:52 - mmengine - INFO - Epoch(train) [1][1070/1563] lr: 1.0000e-03 eta: 0:00:20 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.1012 2023/05/19 13:41:53 - mmengine - INFO - Epoch(train) [1][1080/1563] lr: 1.0000e-03 eta: 0:00:20 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.1399 2023/05/19 13:41:53 - mmengine - INFO - Epoch(train) [1][1090/1563] lr: 1.0000e-03 eta: 0:00:19 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.0853 2023/05/19 13:41:54 - mmengine - INFO - Epoch(train) [1][1100/1563] lr: 1.0000e-03 eta: 0:00:19 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.0117 2023/05/19 13:41:54 - mmengine - INFO - Epoch(train) [1][1110/1563] lr: 1.0000e-03 eta: 0:00:18 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.1412 2023/05/19 13:41:54 - mmengine - INFO - Epoch(train) [1][1120/1563] lr: 1.0000e-03 eta: 0:00:18 time: 0.0408 data_time: 0.0067 memory: 402 loss: 2.0119 2023/05/19 13:41:55 - mmengine - INFO - Epoch(train) [1][1130/1563] lr: 1.0000e-03 eta: 0:00:17 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.0498 2023/05/19 13:41:55 - mmengine - INFO - Epoch(train) [1][1140/1563] lr: 1.0000e-03 eta: 0:00:17 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.1294 2023/05/19 13:41:56 - mmengine - INFO - Epoch(train) [1][1150/1563] lr: 1.0000e-03 eta: 0:00:17 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.0404 2023/05/19 13:41:56 - mmengine - INFO - Epoch(train) [1][1160/1563] lr: 1.0000e-03 eta: 0:00:16 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.0142 2023/05/19 13:41:56 - mmengine - INFO - Epoch(train) [1][1170/1563] lr: 1.0000e-03 eta: 0:00:16 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.1452 2023/05/19 13:41:57 - mmengine - INFO - Epoch(train) [1][1180/1563] lr: 1.0000e-03 eta: 0:00:15 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.0637 2023/05/19 13:41:57 - mmengine - INFO - Epoch(train) [1][1190/1563] lr: 1.0000e-03 eta: 0:00:15 time: 0.0409 data_time: 0.0068 memory: 402 loss: 1.9393 2023/05/19 13:41:58 - mmengine - INFO - Epoch(train) [1][1200/1563] lr: 1.0000e-03 eta: 0:00:15 time: 0.0409 data_time: 0.0068 memory: 402 loss: 1.9394 2023/05/19 13:41:58 - mmengine - INFO - Epoch(train) [1][1210/1563] lr: 1.0000e-03 eta: 0:00:14 time: 0.0408 data_time: 0.0068 memory: 402 loss: 1.9118 2023/05/19 13:41:59 - mmengine - INFO - Epoch(train) [1][1220/1563] lr: 1.0000e-03 eta: 0:00:14 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.0070 2023/05/19 13:41:59 - mmengine - INFO - Epoch(train) [1][1230/1563] lr: 1.0000e-03 eta: 0:00:13 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.0780 2023/05/19 13:41:59 - mmengine - INFO - Epoch(train) [1][1240/1563] lr: 1.0000e-03 eta: 0:00:13 time: 0.0408 data_time: 0.0068 memory: 402 loss: 1.9939 2023/05/19 13:42:00 - mmengine - INFO - Epoch(train) [1][1250/1563] lr: 1.0000e-03 eta: 0:00:12 time: 0.0410 data_time: 0.0068 memory: 402 loss: 2.0040 2023/05/19 13:42:00 - mmengine - INFO - Epoch(train) [1][1260/1563] lr: 1.0000e-03 eta: 0:00:12 time: 0.0409 data_time: 0.0068 memory: 402 loss: 1.9739 2023/05/19 13:42:01 - mmengine - INFO - Epoch(train) [1][1270/1563] lr: 1.0000e-03 eta: 0:00:12 time: 0.0408 data_time: 0.0068 memory: 402 loss: 1.9774 2023/05/19 13:42:01 - mmengine - INFO - Epoch(train) [1][1280/1563] lr: 1.0000e-03 eta: 0:00:11 time: 0.0409 data_time: 0.0068 memory: 402 loss: 1.9021 2023/05/19 13:42:01 - mmengine - INFO - Epoch(train) [1][1290/1563] lr: 1.0000e-03 eta: 0:00:11 time: 0.0408 data_time: 0.0068 memory: 402 loss: 1.9686 2023/05/19 13:42:02 - mmengine - INFO - Epoch(train) [1][1300/1563] lr: 1.0000e-03 eta: 0:00:10 time: 0.0409 data_time: 0.0068 memory: 402 loss: 2.0066 2023/05/19 13:42:02 - mmengine - INFO - Epoch(train) [1][1310/1563] lr: 1.0000e-03 eta: 0:00:10 time: 0.0408 data_time: 0.0068 memory: 402 loss: 2.1698 2023/05/19 13:42:03 - mmengine - INFO - Epoch(train) [1][1320/1563] lr: 1.0000e-03 eta: 0:00:10 time: 0.0410 data_time: 0.0068 memory: 402 loss: 2.0662 2023/05/19 13:42:03 - mmengine - INFO - Epoch(train) [1][1330/1563] lr: 1.0000e-03 eta: 0:00:09 time: 0.0410 data_time: 0.0068 memory: 402 loss: 2.1188 2023/05/19 13:42:03 - mmengine - INFO - Epoch(train) [1][1340/1563] lr: 1.0000e-03 eta: 0:00:09 time: 0.0411 data_time: 0.0069 memory: 402 loss: 1.9731 2023/05/19 13:42:04 - mmengine - INFO - Epoch(train) [1][1350/1563] lr: 1.0000e-03 eta: 0:00:08 time: 0.0410 data_time: 0.0069 memory: 402 loss: 1.9836 2023/05/19 13:42:04 - mmengine - INFO - Epoch(train) [1][1360/1563] lr: 1.0000e-03 eta: 0:00:08 time: 0.0410 data_time: 0.0069 memory: 402 loss: 2.0465 2023/05/19 13:42:05 - mmengine - INFO - Epoch(train) [1][1370/1563] lr: 1.0000e-03 eta: 0:00:07 time: 0.0411 data_time: 0.0069 memory: 402 loss: 1.9632 2023/05/19 13:42:05 - mmengine - INFO - Epoch(train) [1][1380/1563] lr: 1.0000e-03 eta: 0:00:07 time: 0.0410 data_time: 0.0069 memory: 402 loss: 2.0196 2023/05/19 13:42:06 - mmengine - INFO - Epoch(train) [1][1390/1563] lr: 1.0000e-03 eta: 0:00:07 time: 0.0410 data_time: 0.0069 memory: 402 loss: 1.9897 2023/05/19 13:42:06 - mmengine - INFO - Epoch(train) [1][1400/1563] lr: 1.0000e-03 eta: 0:00:06 time: 0.0411 data_time: 0.0069 memory: 402 loss: 2.0237 2023/05/19 13:42:06 - mmengine - INFO - Epoch(train) [1][1410/1563] lr: 1.0000e-03 eta: 0:00:06 time: 0.0411 data_time: 0.0069 memory: 402 loss: 1.9719 2023/05/19 13:42:07 - mmengine - INFO - Epoch(train) [1][1420/1563] lr: 1.0000e-03 eta: 0:00:05 time: 0.0410 data_time: 0.0068 memory: 402 loss: 1.9368 2023/05/19 13:42:07 - mmengine - INFO - Epoch(train) [1][1430/1563] lr: 1.0000e-03 eta: 0:00:05 time: 0.0411 data_time: 0.0068 memory: 402 loss: 1.8614 2023/05/19 13:42:08 - mmengine - INFO - Epoch(train) [1][1440/1563] lr: 1.0000e-03 eta: 0:00:05 time: 0.0411 data_time: 0.0069 memory: 402 loss: 2.0261 2023/05/19 13:42:08 - mmengine - INFO - Epoch(train) [1][1450/1563] lr: 1.0000e-03 eta: 0:00:04 time: 0.0410 data_time: 0.0069 memory: 402 loss: 2.1406 2023/05/19 13:42:08 - mmengine - INFO - Epoch(train) [1][1460/1563] lr: 1.0000e-03 eta: 0:00:04 time: 0.0410 data_time: 0.0069 memory: 402 loss: 1.9719 2023/05/19 13:42:09 - mmengine - INFO - Epoch(train) [1][1470/1563] lr: 1.0000e-03 eta: 0:00:03 time: 0.0411 data_time: 0.0069 memory: 402 loss: 2.0576 2023/05/19 13:42:09 - mmengine - INFO - Epoch(train) [1][1480/1563] lr: 1.0000e-03 eta: 0:00:03 time: 0.0411 data_time: 0.0069 memory: 402 loss: 1.8874 2023/05/19 13:42:10 - mmengine - INFO - Epoch(train) [1][1490/1563] lr: 1.0000e-03 eta: 0:00:03 time: 0.0413 data_time: 0.0070 memory: 402 loss: 1.8535 2023/05/19 13:42:10 - mmengine - INFO - Epoch(train) [1][1500/1563] lr: 1.0000e-03 eta: 0:00:02 time: 0.0414 data_time: 0.0070 memory: 402 loss: 1.7792 2023/05/19 13:42:10 - mmengine - INFO - Epoch(train) [1][1510/1563] lr: 1.0000e-03 eta: 0:00:02 time: 0.0414 data_time: 0.0070 memory: 402 loss: 1.8535 2023/05/19 13:42:11 - mmengine - INFO - Epoch(train) [1][1520/1563] lr: 1.0000e-03 eta: 0:00:01 time: 0.0413 data_time: 0.0069 memory: 402 loss: 1.9720 2023/05/19 13:42:11 - mmengine - INFO - Epoch(train) [1][1530/1563] lr: 1.0000e-03 eta: 0:00:01 time: 0.0413 data_time: 0.0070 memory: 402 loss: 1.9065 2023/05/19 13:42:12 - mmengine - INFO - Epoch(train) [1][1540/1563] lr: 1.0000e-03 eta: 0:00:00 time: 0.0414 data_time: 0.0070 memory: 402 loss: 1.9185 2023/05/19 13:42:12 - mmengine - INFO - Epoch(train) [1][1550/1563] lr: 1.0000e-03 eta: 0:00:00 time: 0.0414 data_time: 0.0070 memory: 402 loss: 1.9104 2023/05/19 13:42:13 - mmengine - INFO - Epoch(train) [1][1560/1563] lr: 1.0000e-03 eta: 0:00:00 time: 0.0414 data_time: 0.0070 memory: 402 loss: 1.8288 2023/05/19 13:42:13 - mmengine - INFO - Exp name: 20230519_134105 2023/05/19 13:42:13 - mmengine - INFO - Saving checkpoint at 1 epochs 2023/05/19 13:42:13 - mmengine - WARNING - save_param_scheduler is True but self.param_schedulers is None, so skip saving parameter schedulers 2023/05/19 13:42:15 - mmengine - INFO - Epoch(val) [1][ 10/313] eta: 0:00:05 time: 0.0183 data_time: 0.0044 memory: 402
2023/05/19 13:42:15 - mmengine - INFO - Epoch(val) [1][ 20/313] eta: 0:00:05 time: 0.0167 data_time: 0.0044 memory: 323
2023/05/19 13:42:16 - mmengine - INFO - Epoch(val) [1][ 30/313] eta: 0:00:04 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:16 - mmengine - INFO - Epoch(val) [1][ 40/313] eta: 0:00:04 time: 0.0163 data_time: 0.0044 memory: 323
2023/05/19 13:42:16 - mmengine - INFO - Epoch(val) [1][ 50/313] eta: 0:00:04 time: 0.0163 data_time: 0.0044 memory: 323
2023/05/19 13:42:16 - mmengine - INFO - Epoch(val) [1][ 60/313] eta: 0:00:04 time: 0.0163 data_time: 0.0044 memory: 323
2023/05/19 13:42:16 - mmengine - INFO - Epoch(val) [1][ 70/313] eta: 0:00:04 time: 0.0164 data_time: 0.0045 memory: 323
2023/05/19 13:42:16 - mmengine - INFO - Epoch(val) [1][ 80/313] eta: 0:00:03 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:17 - mmengine - INFO - Epoch(val) [1][ 90/313] eta: 0:00:03 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:17 - mmengine - INFO - Epoch(val) [1][100/313] eta: 0:00:03 time: 0.0164 data_time: 0.0045 memory: 323
2023/05/19 13:42:17 - mmengine - INFO - Epoch(val) [1][110/313] eta: 0:00:03 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:17 - mmengine - INFO - Epoch(val) [1][120/313] eta: 0:00:03 time: 0.0164 data_time: 0.0045 memory: 323
2023/05/19 13:42:17 - mmengine - INFO - Epoch(val) [1][130/313] eta: 0:00:03 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:17 - mmengine - INFO - Epoch(val) [1][140/313] eta: 0:00:02 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:17 - mmengine - INFO - Epoch(val) [1][150/313] eta: 0:00:02 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:18 - mmengine - INFO - Epoch(val) [1][160/313] eta: 0:00:02 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:18 - mmengine - INFO - Epoch(val) [1][170/313] eta: 0:00:02 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:18 - mmengine - INFO - Epoch(val) [1][180/313] eta: 0:00:02 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:18 - mmengine - INFO - Epoch(val) [1][190/313] eta: 0:00:02 time: 0.0163 data_time: 0.0044 memory: 323
2023/05/19 13:42:18 - mmengine - INFO - Epoch(val) [1][200/313] eta: 0:00:01 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:18 - mmengine - INFO - Epoch(val) [1][210/313] eta: 0:00:01 time: 0.0163 data_time: 0.0044 memory: 323
2023/05/19 13:42:19 - mmengine - INFO - Epoch(val) [1][220/313] eta: 0:00:01 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:19 - mmengine - INFO - Epoch(val) [1][230/313] eta: 0:00:01 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:19 - mmengine - INFO - Epoch(val) [1][240/313] eta: 0:00:01 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:19 - mmengine - INFO - Epoch(val) [1][250/313] eta: 0:00:01 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:19 - mmengine - INFO - Epoch(val) [1][260/313] eta: 0:00:00 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:19 - mmengine - INFO - Epoch(val) [1][270/313] eta: 0:00:00 time: 0.0163 data_time: 0.0044 memory: 323
2023/05/19 13:42:20 - mmengine - INFO - Epoch(val) [1][280/313] eta: 0:00:00 time: 0.0164 data_time: 0.0045 memory: 323
2023/05/19 13:42:20 - mmengine - INFO - Epoch(val) [1][290/313] eta: 0:00:00 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:20 - mmengine - INFO - Epoch(val) [1][300/313] eta: 0:00:00 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:20 - mmengine - INFO - Epoch(val) [1][310/313] eta: 0:00:00 time: 0.0164 data_time: 0.0044 memory: 323
2023/05/19 13:42:20 - mmengine - INFO - Epoch(val) [1][313/313] accuracy: 36.7000 data_time: 0.0044 time: 0.0164

Additional information

Why is the configuration file in work_dir empty even though the runner's __init__ function called self.dump_config()

zhouzaida commented 1 year ago

Hi @YQisme , because cfg parameter is not passed in Runner.

https://github.com/open-mmlab/mmengine/blob/4bc2fe1aaec2d7d1464b11d50f6165494f62ef18/mmengine/runner/runner.py#L271

YQisme commented 1 year ago

Hi @YQisme , because cfg parameter is not passed in Runner.

https://github.com/open-mmlab/mmengine/blob/4bc2fe1aaec2d7d1464b11d50f6165494f62ef18/mmengine/runner/runner.py#L271

Is there a way or tool to export the configuration of this runner to a .py file?

YQisme commented 1 year ago

@zhouzaida
I modified the code to accept the cfg parameter as input, is that correct? However, there will be an error message. What should I do?

from mmengine.runner import Runner
from torch.optim import SGD

cfg = dict(
    model=MMResNet50(),
    work_dir='./work_dir',
    train_dataloader=train_dataloader,
    optim_wrapper=dict(optimizer=dict(type=SGD, lr=0.001, momentum=0.9)),
    train_cfg=dict(by_epoch=True, max_epochs=1, val_interval=1),
    val_dataloader=val_dataloader,
    val_cfg=dict(),
    val_evaluator=dict(type=Accuracy),
   )
runner = Runner.from_cfg(cfg)
runner.train()

AttributeError                            Traceback (most recent call last)
Cell In[9], line 14
      2 from torch.optim import SGD
      4 cfg = dict(
      5     model=MMResNet50(),
      6     work_dir='[./work_dir](https://vscode-remote+ssh-002dremote-002b2060.vscode-resource.vscode-cdn.net/home/yq/_myCode/mmengine/_myCode/work_dir)',
   (...)
     12     val_evaluator=dict(type=Accuracy),
     13    )
---> 14 runner = Runner.from_cfg(cfg)
     15 runner.train()
     16 # runner.test()

File [~/_myCode/mmengine/mmengine/runner/runner.py:439](https://vscode-remote+ssh-002dremote-002b2060.vscode-resource.vscode-cdn.net/home/yq/_myCode/mmengine/_myCode/~/_myCode/mmengine/mmengine/runner/runner.py:439), in Runner.from_cfg(cls, cfg)
    429 """Build a runner from config.
    430 
    431 Args:
   (...)
    436     Runner: A runner build from ``cfg``.
    437 """
    438 cfg = copy.deepcopy(cfg)
--> 439 runner = cls(
    440     model=cfg['model'],
    441     work_dir=cfg['work_dir'],
    442     train_dataloader=cfg.get('train_dataloader'),
    443     val_dataloader=cfg.get('val_dataloader'),
    444     test_dataloader=cfg.get('test_dataloader'),
    445     train_cfg=cfg.get('train_cfg'),
    446     val_cfg=cfg.get('val_cfg'),
    447     test_cfg=cfg.get('test_cfg'),
    448     auto_scale_lr=cfg.get('auto_scale_lr'),
    449     optim_wrapper=cfg.get('optim_wrapper'),
    450     param_scheduler=cfg.get('param_scheduler'),
    451     val_evaluator=cfg.get('val_evaluator'),
    452     test_evaluator=cfg.get('test_evaluator'),
    453     default_hooks=cfg.get('default_hooks'),
    454     custom_hooks=cfg.get('custom_hooks'),
    455     data_preprocessor=cfg.get('data_preprocessor'),
    456     load_from=cfg.get('load_from'),
    457     resume=cfg.get('resume', False),
    458     launcher=cfg.get('launcher', 'none'),
    459     env_cfg=cfg.get('env_cfg'),  # type: ignore
    460     log_processor=cfg.get('log_processor'),
    461     log_level=cfg.get('log_level', 'INFO'),
    462     visualizer=cfg.get('visualizer'),
    463     default_scope=cfg.get('default_scope', 'mmengine'),
    464     randomness=cfg.get('randomness', dict(seed=None)),
    465     experiment_name=cfg.get('experiment_name'),
    466     cfg=cfg,
    467 )
    469 return runner

File [~/_myCode/mmengine/mmengine/runner/runner.py:353](https://vscode-remote+ssh-002dremote-002b2060.vscode-resource.vscode-cdn.net/home/yq/_myCode/mmengine/_myCode/~/_myCode/mmengine/mmengine/runner/runner.py:353), in Runner.__init__(self, model, work_dir, train_dataloader, val_dataloader, test_dataloader, train_cfg, val_cfg, test_cfg, auto_scale_lr, optim_wrapper, param_scheduler, val_evaluator, test_evaluator, default_hooks, custom_hooks, data_preprocessor, load_from, resume, launcher, env_cfg, log_processor, log_level, visualizer, default_scope, randomness, experiment_name, cfg)
    348     self._distributed = True
    350 # self._timestamp will be set in the `setup_env` method. Besides,
    351 # it also will initialize multi-process and (or) distributed
    352 # environment.
--> 353 self.setup_env(env_cfg)
    354 # self._deterministic and self._seed will be set in the
    355 # `set_randomness`` method
    356 self._randomness_cfg = randomness

File [~/_myCode/mmengine/mmengine/runner/runner.py:643](https://vscode-remote+ssh-002dremote-002b2060.vscode-resource.vscode-cdn.net/home/yq/_myCode/mmengine/_myCode/~/_myCode/mmengine/mmengine/runner/runner.py:643), in Runner.setup_env(self, env_cfg)
    625 def setup_env(self, env_cfg: Dict) -> None:
    626     """Setup environment.
    627 
    628     An example of ``env_cfg``::
   (...)
    641         env_cfg (dict): Config for setting environment.
    642     """
--> 643     if env_cfg.get('cudnn_benchmark'):
    644         torch.backends.cudnn.benchmark = True
    646     mp_cfg: dict = env_cfg.get('mp_cfg', {})

AttributeError: 'NoneType' object has no attribute 'get'
zhouzaida commented 1 year ago

Hi, if env_cfg is not passed in, it will be None so an AttributeError will be raised.

https://github.com/open-mmlab/mmengine/blob/4bc2fe1aaec2d7d1464b11d50f6165494f62ef18/mmengine/runner/runner.py#L459

We can also add a default value for it.

- env_cfg=cfg.get('env_cfg'),  # type: ignore
+ env_cfg=cfg.get('env_cfg', dict(dist_cfg=dict(backend='nccl'))),  # type: ignore

Are you interested in making a PR to fix this issue?

zhouzaida commented 1 year ago

Hi @YQisme , because cfg parameter is not passed in Runner. https://github.com/open-mmlab/mmengine/blob/4bc2fe1aaec2d7d1464b11d50f6165494f62ef18/mmengine/runner/runner.py#L271

Is there a way or tool to export the configuration of this runner to a .py file?

Hi, it can be achieved but not very easily because objects (initialized model or dataloader) may be passed in rather a string or dict.

YQisme commented 1 year ago

Hi, if env_cfg is not passed in, it will be None so an AttributeError will be raised.

https://github.com/open-mmlab/mmengine/blob/4bc2fe1aaec2d7d1464b11d50f6165494f62ef18/mmengine/runner/runner.py#L459

We can also add a default value for it.

- env_cfg=cfg.get('env_cfg'),  # type: ignore
+ env_cfg=cfg.get('env_cfg', dict(dist_cfg=dict(backend='nccl'))),  # type: ignore

Are you interested in making a PR to fix this issue?

I modified the code as you said, but still reported an error. YapfError: :2:26: invalid syntax

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

Traceback (most recent call last):
  File "/home/yq/anaconda3/envs/mmdet/lib/python3.8/site-packages/yapf/pytree/pytree_utils.py", line 116, in ParseCodeToTree
    tree = parser_driver.parse_string(code, debug=False)
  File "/home/yq/anaconda3/envs/mmdet/lib/python3.8/lib2to3/pgen2/driver.py", line 103, in parse_string
    return self.parse_tokens(tokens, debug)
  File "/home/yq/anaconda3/envs/mmdet/lib/python3.8/lib2to3/pgen2/driver.py", line 71, in parse_tokens
    if p.addtoken(type, value, (prefix, start)):
  File "/home/yq/anaconda3/envs/mmdet/lib/python3.8/lib2to3/pgen2/parse.py", line 162, in addtoken
    raise ParseError("bad input", type, value, context)
lib2to3.pgen2.parse.ParseError: bad input: type=11, value=':', context=('', (2, 25))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/yq/anaconda3/envs/mmdet/lib/python3.8/site-packages/yapf/pytree/pytree_utils.py", line 122, in ParseCodeToTree
    tree = parser_driver.parse_string(code, debug=False)
  File "/home/yq/anaconda3/envs/mmdet/lib/python3.8/lib2to3/pgen2/driver.py", line 103, in parse_string
    return self.parse_tokens(tokens, debug)
  File "/home/yq/anaconda3/envs/mmdet/lib/python3.8/lib2to3/pgen2/driver.py", line 71, in parse_tokens
    if p.addtoken(type, value, (prefix, start)):
  File "/home/yq/anaconda3/envs/mmdet/lib/python3.8/lib2to3/pgen2/parse.py", line 162, in addtoken
    raise ParseError("bad input", type, value, context)
lib2to3.pgen2.parse.ParseError: bad input: type=11, value=':', context=('', (2, 25))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/yq/anaconda3/envs/mmdet/lib/python3.8/site-packages/yapf/yapflib/yapf_api.py", line 212, in FormatCode
    tree = pytree_utils.ParseCodeToTree(unformatted_source)
  File "/home/yq/anaconda3/envs/mmdet/lib/python3.8/site-packages/yapf/pytree/pytree_utils.py", line 128, in ParseCodeToTree
    raise e
  File "/home/yq/anaconda3/envs/mmdet/lib/python3.8/site-packages/yapf/pytree/pytree_utils.py", line 126, in ParseCodeToTree
    ast.parse(code)
  File "/home/yq/anaconda3/envs/mmdet/lib/python3.8/ast.py", line 47, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 2
    (data_preprocessor): BaseDataPreprocessor()
                       ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train.py", line 75, in <module>
    runner = Runner.from_cfg(cfg)
  File "/home/yq/_myCode/mmengine/mmengine/runner/runner.py", line 439, in from_cfg
    runner = cls(
  File "/home/yq/_myCode/mmengine/mmengine/runner/runner.py", line 380, in __init__
    self._log_env(env_cfg)
  File "/home/yq/_myCode/mmengine/mmengine/runner/runner.py", line 2324, in _log_env
    self.logger.info(f'Config:\n{self.cfg.pretty_text}')
  File "/home/yq/_myCode/mmengine/mmengine/config/config.py", line 892, in pretty_text
    text, _ = FormatCode(text, style_config=yapf_style, verify=True)
  File "/home/yq/anaconda3/envs/mmdet/lib/python3.8/site-packages/yapf/yapflib/yapf_api.py", line 215, in FormatCode
    raise errors.YapfError(errors.FormatErrorMsg(e))
yapf.yapflib.errors.YapfError: <unknown>:2:26: invalid syntax
zhouzaida commented 1 year ago

Because the cfg contains some objects which can not be dumped.

Currently, you should call Runner(xxx) rather than Runner.from_cfg(xxx) to avoid this error and we will find a way in the future to support dumping the initialization parameter of Runner to a file.