facebookresearch/swav

question in running eval_linear.py

Opened this issue · 4 comments

I run in eval_linear.py have a error. how to slove the error?

  • [Traceback (most recent call last):
    File "eval_linear.py", line 392, in
    main()
    File "eval_linear.py", line 97, in main
    logger, training_stats = initialize_exp(
    File "/home/libing/1/SWAV/swav-master/src/utils.py", line 92, in initialize_exp
    training_stats = PD_Stats(
    File "/home/libing/1/SWAV/swav-master/src/logger.py", line 84, in init
    assert list(self.stats.columns) == list(columns)
    AssertionError
    Traceback (most recent call last):
    File "/home/libing/anaconda3/envs/simsiam/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
    File "/home/libing/anaconda3/envs/simsiam/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
    File "/home/libing/anaconda3/envs/simsiam/lib/python3.8/site-packages/torch/distributed/launch.py", line 260, in
    main()
    File "/home/libing/anaconda3/envs/simsiam/lib/python3.8/site-packages/torch/distributed/launch.py", line 255, in main
    raise subprocess.CalledProcessError(returncode=process.returncode,
    subprocess.CalledProcessError: Command '['/home/libing/anaconda3/envs/simsiam/bin/python', '-u', 'eval_linear.py', '--local_rank=0', '--data_path', './nem7.3', '--pretrained', './checkpoints/ckp-399.pth']' returned non-zero exit status 1. ]

Hi @18456432930

The error happens because the eval_linear.py is trying to logging into a previous logging file which I assume was the logging file from the pretraining. Can you try relaunching by removing the logging files (*.pkl) from the repo where the code writes the log?

Which part should I modify? Can you say it in more detail

you can relaunch the eval_linear.py by specifying a different experiment logging path:
mkdir -p $HOME/experiment_linear_eval

python -m torch.distributed.launch --nproc_per_node=8 eval_linear.py \
--dump_path $HOME/experiment_linear_eval \
--data_path /path/to/imagenet \
--pretrained /path/to/checkpoints/swav_800ep_pretrain.pth.tar

thank you,But I have the following problems
File "eval_linear.py", line 219, in main
training_stats.update(scores + scores_val)
File "/home/libing/1/SWAV/swav-master/src/logger.py", line 91, in update
self.stats.loc[len(self.stats.index)] = row
File "/home/libing/anaconda3/envs/simsiam/lib/python3.8/site-packages/pandas/core/indexing.py", line 692, in setitem
iloc._setitem_with_indexer(indexer, value, self.name)
File "/home/libing/anaconda3/envs/simsiam/lib/python3.8/site-packages/pandas/core/indexing.py", line 1629, in _setitem_with_indexer
self._setitem_with_indexer_missing(indexer, value)
File "/home/libing/anaconda3/envs/simsiam/lib/python3.8/site-packages/pandas/core/indexing.py", line 1918, in _setitem_with_indexer_missing
raise ValueError("cannot set a row with mismatched columns")
ValueError: cannot set a row with mismatched columns