AttributeError: 'NoneType' object has no attribute 'run'
I train conformer model using aishell recipe(ESPnet2) , but when in training stage , I got this:

2022-05-26 21:31:26,160 (trainer:328) INFO: 50epoch results: [train] iter_time=6.764e-05, forward_time=0.043, loss_ctc=0.331, loss_att=0.502, acc=0.993, loss=0.225, backward_time=0.040, optim_step_time=0.038, optim0_lr0=1.133e-04, train_time=0.264, time=51 minutes and 57 seconds, total_count=1181200, gpu_max_cached_mem_GB=5.084, [valid] loss_ctc=6.020, cer_ctc=0.112, loss_att=3.802, acc=0.916, cer=0.107, wer=0.466, loss=4.467, time=23.6 seconds, total_count=25950, gpu_max_cached_mem_GB=5.084, [att_plot] time=31.79 seconds, total_count=0, gpu_max_cached_mem_GB=5.084
2022-05-26 21:32:34,718 (trainer:374) INFO: There are no improvements in this epoch
2022-05-26 21:32:34,731 (trainer:449) INFO: The training was finished at 50 epochs 
2022-05-26 21:32:34,755 (average_nbest_models:70) INFO: Averaging 10best models: criterion="valid.acc": exp/asr_train_asr_conformer_raw_zh_char/valid.acc.ave_10best.pth
Traceback (most recent call last):
  File "/Share/lli/espnet/tools/anaconda/envs/espnet/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Share/lli/espnet/tools/anaconda/envs/espnet/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Share/lli/espnet/espnet2/bin/asr_train.py", line 23, in <module>
    main()
  File "/Share/lli/espnet/espnet2/bin/asr_train.py", line 19, in main
    ASRTask.main(cmd=cmd)
  File "/Share/lli/espnet/espnet2/tasks/abs_task.py", line 1011, in main
    cls.main_worker(args)
  File "/Share/lli/espnet/espnet2/tasks/abs_task.py", line 1318, in main_worker
    if wandb.run:
AttributeError: 'NoneType' object has no attribute 'run'
Accounting: time=170861 threads=1
Ended (code 1) at Thu May 26 21:35:06 CST 2022, elapsed time 170861 seconds

Basic environments:
OS information: Linux
python version: 3.7.4
espnet version: 202204
pytorch version 1.6.0
Task information:

Task: ASR
Recipe: aishell
ESPnet2
Could you please help me?
diff --git a/espnet2/tasks/abs_task.py b/espnet2/tasks/abs_task.py
index 06d2663ef..d0c6f7519 100644
--- a/espnet2/tasks/abs_task.py
+++ b/espnet2/tasks/abs_task.py
@@ -1315,7 +1315,7 @@ class AbsTask(ABC):
                 distributed_option=distributed_option,
             )
 
-            if wandb.run:
+            if args.use_wandb and wandb.run:
                 wandb.finish()
 
     @classmethod
['espnet2/tasks/abs_task.py']