facebookresearch / mmf

A modular framework for vision & language multimodal research from Facebook AI Research (FAIR)
https://mmf.sh/
Other
5.5k stars 939 forks source link

Can't run concat bert tutorial on colab #1172

Open siddharthabhakta opened 2 years ago

siddharthabhakta commented 2 years ago

I tried to create a new model following the guideline in Tutorial: Adding a model - Concat BERT | MMF 2 but I am always getting below error. Please guide me how to resolve it. I have given further details below.

------command— !mmf_run config=projects/hateful_memes/configs/concat_bert_tutorial/defaults.yaml \

model=concat_bert_tutorial \

dataset=hateful_memes \

run_type=train –error---- Namespace(config_override=None, local_rank=None, opts=[‘config=projects/hateful_memes/configs/concat_bert_tutorial/defaults.yaml’, ‘model=concat_bert_tutorial’, ‘dataset=hateful_memes’, ‘run_type=train’]) /usr/local/lib/python3.7/dist-packages/mmf/utils/configuration.py:284: UserWarning: No model named ‘concat_bert_tutorial’ has been registered warnings.warn(warning) Overriding option config to projects/hateful_memes/configs/concat_bert_tutorial/defaults.yaml Overriding option model to concat_bert_tutorial Overriding option datasets to hateful_memes Overriding option run_type to train Using seed 47956903 Logging to: ./save/logs/train_2021-12-08T11:48:47.log Downloading extras.tar.gz: 100% 211k/211k [00:00<00:00, 1.15MB/s] /root/.cache/torch/mmf/glove.6B.zip: 862MB [16:38, 863kB/s] 100% 399999/400000 [00:37<00:00, 10755.19it/s] Traceback (most recent call last): File “/usr/local/bin/mmf_run”, line 8, in sys.exit(run()) File “/usr/local/lib/python3.7/dist-packages/mmf_cli/run.py”, line 111, in run main(configuration, predict=predict) File “/usr/local/lib/python3.7/dist-packages/mmf_cli/run.py”, line 40, in main trainer.load() File “/usr/local/lib/python3.7/dist-packages/mmf/trainers/base_trainer.py”, line 60, in load self.load_model_and_optimizer() File “/usr/local/lib/python3.7/dist-packages/mmf/trainers/base_trainer.py”, line 112, in load_model_and_optimizer self.model = build_model(attributes) File “/usr/local/lib/python3.7/dist-packages/mmf/utils/build.py”, line 62, in build_model model = model_class(config) TypeError: ‘NoneType’ object is not callable I have modified mmf\mmf\modelsinit.py like this from .concat_bert_tutorial import ConcatBERTTutorial all = [ “TopDownBottomUp”, “Pythia”, “LoRRA”, “BAN”, “BaseModel”, “BUTD”, “MMBTForClassification”, “MMBTForPreTraining”, “FusionBase”, “ConcatBoW”, “ConcatBERT”, “LateFusion”, “CNNLSTM”, “M4C”, “M4CCaptioner”, “MMBT”, “MMFTransformer”, “VisualBERT”, “ViLBERT”, “UnimodalBase”, “UnimodalModal”, “UnimodalText”, “AlbefVitEncoder”, “ViLT”, “ConcatBERTTutorial”, ]

I have created mmf\mmf\models\concat_bert_tutorial.py as defined in Tutorial: Adding a model - Concat BERT | MMF 2. I checked that it has the following line:

@registry.register_model(“concat_bert_tutorial”) class ConcatBERTTutorial(BaseModel):

The projects/hateful_memes/configs/concat_bert_tutorial/defaults.yaml file is created as defined in Tutorial: Adding a model - Concat BERT | MMF 2

apsdehal commented 2 years ago

Confirmed on a separate thread that author is running this on colab. So, that is why it is not picking it up. You will not use from mmf_cli.run import run to run MMF in colab. The problem is mmf_run is a binary and is not aware of the changes you made in your interactive environment and hence not able to find the changes. See Running the experiment section in this notebook: Google Colab