I solved this by moving the following statements to the top, with other import statements.
import torch.backends.cudnn as cudnn
import torch.nn.init as init
import torch.utils.data as data
import numpy as np
import argparse
import visdom
viz = visdom.Visdom()
I solved this by moving the following statements to the top, with other import statements.
import torch.backends.cudnn as cudnn
import torch.nn.init as init
import torch.utils.data as data
import numpy as np
import argparse
import visdomviz = visdom.Visdom()
YES!! Worked like below:
import ...
parser.add_argument()
...
args = parser.parse_args()
if args.visdom:
import visdom
viz = visdom.Visdom()
Most helpful comment
I solved this by moving the following statements to the top, with other import statements.
import torch.backends.cudnn as cudnn
import torch.nn.init as init
import torch.utils.data as data
import numpy as np
import argparse
import visdom
viz = visdom.Visdom()