facebookresearch / vissl

VISSL is FAIR's library of extensible, modular and scalable components for SOTA Self-Supervised Learning with images.
https://vissl.ai
MIT License
3.26k stars 334 forks source link

error : "Missing key TRUNK_PARAMS full_key: config.MODEL.TRUNK.TRUNK_PARAMS" in simclr_8node_resnet.yaml #409

Closed amro-kamal closed 3 years ago

amro-kamal commented 3 years ago

The cfg file simclr_8node_resnet.yaml doesn't include the key config.MODEL.TRUNK.TRUNK_PARAMS, while the library is expecting to find it. This gives me the error "Missing key TRUNK_PARAMS full_key: config.MODEL.TRUNK.TRUNK_PARAMS"

I am following this tutorial Using a pretrained VISSL model for inference

Here is the code in the tutorial I used to download and modify the cfg file:

!mkdir -p configs/config/simclr
!mkdir -p vissl/
!wget -q -O configs/config/simclr/simclr_8node_resnet.yaml https://raw.githubusercontent.com/facebookresearch/vissl/master/configs/config/pretrain/simclr/simclr_8node_resnet.yaml
!wget -q -O vissl/config/defaults.yaml https://raw.githubusercontent.com/facebookresearch/vissl/master/vissl/config/defaults.yaml
from omegaconf import OmegaConf
from vissl.utils.hydra_config import AttrDict

config = OmegaConf.load("configs/config/simclr/simclr_8node_resnet.yaml")
default_config = OmegaConf.load("vissl/config/defaults.yaml")
cfg = OmegaConf.merge(default_config, config)
cfg = AttrDict(cfg)
cfg.config.MODEL.WEIGHTS_INIT.PARAMS_FILE = "resnet_simclr.torch"
cfg.config.MODEL.FEATURE_EVAL_SETTINGS.EVAL_MODE_ON = True
cfg.config.MODEL.FEATURE_EVAL_SETTINGS.FREEZE_TRUNK_ONLY = True
cfg.config.MODEL.FEATURE_EVAL_SETTINGS.EXTRACT_TRUNK_FEATURES_ONLY = True
cfg.config.MODEL.FEATURE_EVAL_SETTINGS.SHOULD_FLATTEN_FEATS = False
cfg.config.MODEL.FEATURE_EVAL_SETTINGS.LINEAR_EVAL_FEAT_POOL_OPS_MAP = [["res5avg", ["Identity", []]]]

The error appears when I run this code from the tutorial

from vissl.models import build_model
model = build_model(cfg.config.MODEL, cfg.config.OPTIMIZER) 

error : "Missing key TRUNK_PARAMS full_key: config.MODEL.TRUNK.TRUNK_PARAMS"

iseessel commented 3 years ago

Hi @amro-kamal, thanks for reaching out!

What is the hydra version? Can you try to downgrade to 1.0.6? See https://github.com/facebookresearch/vissl/issues/396#issuecomment-897878465.

iseessel commented 3 years ago

We have released a new version of VISSL that should have fixed this: https://github.com/facebookresearch/vissl/releases/tag/v0.1.6