├── .coveralls.yml ├── .gitignore ├── .lgtm.yml ├── .travis.yml ├── LICENSE ├── README.md ├── configs ├── cifar100 │ ├── cifar100_classification_convnet_softmax.yml │ └── default_cifar100.yml ├── clevr │ ├── clevr_all_vgg_glove_lstm_concat_ffn.yml │ ├── clevr_image_convnet_ffn.yml │ ├── clevr_question_glove_lstm.yml │ └── default_clevr.yml ├── default │ ├── components │ │ ├── language │ │ │ ├── bow_encoder.yml │ │ │ ├── label_indexer.yml │ │ │ ├── sentence_indexer.yml │ │ │ ├── sentence_one_hot_encoder.yml │ │ │ ├── sentence_tokenizer.yml │ │ │ └── word_decoder.yml │ │ ├── losses │ │ │ └── nll_loss.yml │ │ ├── masking │ │ │ ├── join_masked_predictions.yml │ │ │ └── string_to_mask.yml │ │ ├── models │ │ │ ├── general_usage │ │ │ │ ├── attention_decoder.yml │ │ │ │ ├── feed_forward_network.yml │ │ │ │ ├── recurrent_neural_network.yml │ │ │ │ └── seq2seq.yml │ │ │ ├── language │ │ │ │ ├── index_embeddings.yml │ │ │ │ └── sentence_embeddings.yml │ │ │ ├── multi_modal_reasoning │ │ │ │ ├── compact_bilinear_pooling.yml │ │ │ │ ├── factorized_bilinear_pooling.yml │ │ │ │ ├── low_rank_bilinear_pooling.yml │ │ │ │ ├── question_driven_attention.yml │ │ │ │ ├── relational_network.yml │ │ │ │ └── self_attention.yml │ │ │ └── vision │ │ │ │ ├── convnet_encoder.yml │ │ │ │ ├── generic_image_encoder.yml │ │ │ │ └── lenet5.yml │ │ ├── publishers │ │ │ ├── global_variable_publisher.yml │ │ │ └── stream_file_exporter.yml │ │ ├── statistics │ │ │ ├── accuracy_statistics.yml │ │ │ ├── batch_size_statistics.yml │ │ │ ├── bleu_statistics.yml │ │ │ └── precision_recall_statistics.yml │ │ ├── tasks │ │ │ ├── image_text_to_class │ │ │ │ ├── clevr.yml │ │ │ │ ├── gqa.yml │ │ │ │ └── vqa_med_2019.yml │ │ │ ├── image_to_class │ │ │ │ ├── cifar_100.yml │ │ │ │ ├── mnist.yml │ │ │ │ └── simple_molecules.yml │ │ │ ├── text_to_class │ │ │ │ ├── dummy_language_identification.yml │ │ │ │ ├── wily_language_identification.yml │ │ │ │ └── wily_ngram_language_modeling.yml │ │ │ └── text_to_text │ │ │ │ ├── translation_pairs.yml │ │ │ │ └── wikitext_language_modeling.yml │ │ ├── transforms │ │ │ ├── concatenate_tensor.yml │ │ │ ├── list_to_tensor.yml │ │ │ ├── non_linearity.yml │ │ │ ├── reduce_tensor.yml │ │ │ └── reshape_tensor.yml │ │ └── viewers │ │ │ ├── image_viewer.yml │ │ │ └── stream_viewer.yml │ └── workers │ │ ├── offline_trainer.yml │ │ ├── online_trainer.yml │ │ └── processor.yml ├── mnist │ ├── default_mnist.yml │ ├── mnist_classification_convnet_softmax.yml │ ├── mnist_classification_kfold_softmax.yml │ ├── mnist_classification_lenet5.yml │ ├── mnist_classification_softmax.yml │ ├── mnist_classification_vf_2lenet5_2losses.yml │ └── mnist_classification_vf_shared_convnet_2softmaxes_2losses.yml ├── molecule_classification │ ├── default_molecule_classification.yml │ ├── molecule_classification_convnet_softmax.yml │ └── molecule_classification_vgg16_molecules.yml ├── translation │ └── eng_fra_translation_enc_attndec.yml ├── tutorials │ └── mnist_classification_convnet_softmax.yml ├── vqa_med_2019 │ ├── c1_classification │ │ ├── c1_classification_all_bow_vgg16_concat.yml │ │ ├── c1_classification_all_rnn_vgg16_concat.yml │ │ ├── c1_classification_image_cnn_softmax.yml │ │ ├── c1_classification_image_size_softmax.yml │ │ ├── c1_classification_question_mimic_rnn.yml │ │ ├── c1_classification_question_onehot_bow.yml │ │ ├── c1_classification_question_rnn.yml │ │ ├── c1_classification_vf_question_rnn_separate_q_categorization.yml │ │ └── default_c1_classification.yml │ ├── c2_classification │ │ ├── c2_class_lstm_resnet152_ewm_cat_is.yml │ │ ├── c2_class_lstm_resnet152_rn_cat_is.yml │ │ ├── c2_class_lstm_resnet50_attn_cat_is.yml │ │ ├── c2_class_lstm_resnet50_coattn_mfb_cat_is.yml │ │ ├── c2_class_lstm_resnet50_ewm_cat_is.yml │ │ ├── c2_class_lstm_resnet50_mfb_cat_is.yml │ │ ├── c2_class_lstm_resnet50_rn_cat_is.yml │ │ ├── c2_class_lstm_selfattn.yml │ │ ├── c2_class_lstm_vgg16_rn.yml │ │ ├── c2_class_lstm_vgg16_rn_cat_is.yml │ │ ├── c2_classification_all_rnn_vgg16_concat.yml │ │ ├── c2_classification_all_rnn_vgg16_ewm.yml │ │ ├── c2_classification_all_rnn_vgg16_ewm_size.yml │ │ ├── c2_classification_all_rnn_vgg16_mcb.yml │ │ ├── c2_word_answer_onehot_bow.yml │ │ └── default_c2_classification.yml │ ├── c3_classification │ │ ├── c3_classification_all_bow_vgg16_concat.yml │ │ ├── c3_classification_all_concat.yml │ │ ├── c3_classification_all_rnn_vgg16_concat.yml │ │ ├── c3_classification_image_cnn_softmax.yml │ │ ├── c3_classification_image_plus_size_concat.yml │ │ ├── c3_classification_image_size_softmax.yml │ │ ├── c3_classification_image_softmax.yml │ │ ├── c3_classification_image_vgg16_softmax.yml │ │ ├── c3_classification_question_onehot_bow.yml │ │ ├── c3_classification_question_rnn.yml │ │ └── default_c3_classification.yml │ ├── c4_classification │ │ ├── c4_classification_all_rnn_vgg16_ewm_size.yml │ │ ├── c4_enc_attndec.yml │ │ ├── c4_enc_attndec_resnet152_ewm_cat_is.yml │ │ ├── c4_frozen_if_gru_dec.yml │ │ ├── c4_word_answer_glove_sum.yml │ │ ├── c4_word_answer_mimic_sum.yml │ │ ├── c4_word_answer_onehot_bow.yml │ │ ├── c4_word_answer_onehot_sum.yml │ │ └── default_c4_classification.yml │ ├── default_vqa_med_2019.yml │ ├── evaluation │ │ ├── deepta │ │ │ ├── glove_gru_resnet50_coattn_mfb_is_cat_ffn_c123_loss.yml │ │ │ └── glove_gru_vgg16_coattn_mfb_is_cat_ffn_c1234_loss.yml │ │ ├── example_mimic_lstm_vgg16_ewm_is_cat_ffn_c123_loss.yml │ │ ├── frozen_if_ffn_c1234_loss.yml │ │ ├── frozen_if_ffn_c123_loss.yml │ │ ├── frozen_if_vf_5ffn_c1234yn_5losses.yml │ │ ├── frozen_if_vf_5ffn_support_c1234yn_5losses.yml │ │ └── tom │ │ │ ├── glove_lstm_resnet152_att_is_cat_ffn_c123_loss.yml │ │ │ ├── glove_lstm_resnet152_mcb_is_cat_ffn_c123_loss.yml │ │ │ ├── glove_lstm_vgg16_att_is_cat_ffn_c123_loss.yml │ │ │ ├── glove_lstm_vgg16_ewm_is_cat_ffn_c123_loss.yml │ │ │ └── glove_lstm_vgg16_mcb_is_cat_ffn_c123_loss.yml │ ├── extend_answers.yml │ ├── extend_answers_c4.yml │ ├── frozen_pipelines │ │ ├── frozen_input_fusion_glove_lstm_vgg_att_is_cat.yml │ │ ├── frozen_question_categorization_glove_rnn_ffn.yml │ │ ├── frozen_word_answer_glove_sum.yml │ │ └── input_fusion_processor_io.yml │ ├── question_categorization │ │ ├── default_question_categorization.yml │ │ ├── question_categorization_onehot_bow.yml │ │ ├── question_categorization_onehot_rnn.yml │ │ ├── question_categorization_rnn.yml │ │ └── question_categorization_rnn_ffn.yml │ └── vf │ │ ├── c1_binary_vf_cat_hard_shared_question_rnn_two_ffns_losses.yml │ │ ├── c1_binary_vf_cat_rnn_shared_all_encoders_two_ffns_losses.yml │ │ ├── c1_binary_vf_cat_rnn_shared_question_rnn_two_ffns_losses.yml │ │ ├── c1_c2_c3_binary_vf_cat_rnn_shared_all_encoders_four_ffns_losses.yml │ │ ├── c1_c3_binary_vf_cat_rnn_shared_all_encoders_three_ffns_losses.yml │ │ ├── lstm_resnet152_is_cat_ffn_c123_no_binary_loss.yml │ │ ├── lstm_resnet50_ewm_is_cat_ffn_c123_loss_ffn_yn_loss.yml │ │ ├── lstm_resnet50_ewm_is_cat_ffn_c123_no_binary_loss.yml │ │ ├── lstm_resnet50_is_cat_ffn_c123_no_binary_loss.yml │ │ ├── lstm_vgg16_is_cat_ffn_c123_binary_yn_loss.yml │ │ ├── lstm_vgg16_is_cat_ffn_c123_no_yn_loss.yml │ │ └── lstm_vgg16_is_cat_ffn_only_yn_loss.yml ├── wikitext │ ├── wikitext_language_modeling_encoder_attndecoder.yml │ ├── wikitext_language_modeling_rnn.yml │ ├── wikitext_language_modeling_seq2seq.yml │ └── wikitext_language_modeling_seq2seq_simple.yml └── wily │ ├── dummy_language_identification_bow.yml │ ├── wily_language_identification_bow.yml │ └── wily_ngram_language_modeling.yml ├── docs └── source │ └── img │ ├── 1_tutorials │ ├── data_flow_tutorial_mnist_1_training.png │ └── data_flow_tutorial_mnist_2_test.png │ ├── components │ ├── ptp_components.png │ ├── ptp_components_others.png │ ├── ptp_models.png │ └── ptp_tasks.png │ └── data_flow_vqa_5_attention_gpu_loaders.png ├── ptp ├── __init__.py ├── application │ ├── __init__.py │ ├── component_factory.py │ ├── pipeline_manager.py │ ├── sampler_factory.py │ └── task_manager.py ├── components │ ├── component.py │ ├── language │ │ ├── __init__.py │ │ ├── bow_encoder.py │ │ ├── label_indexer.py │ │ ├── sentence_indexer.py │ │ ├── sentence_one_hot_encoder.py │ │ ├── sentence_tokenizer.py │ │ └── word_decoder.py │ ├── losses │ │ ├── __init__.py │ │ ├── loss.py │ │ └── nll_loss.py │ ├── masking │ │ ├── __init__.py │ │ ├── join_masked_predictions.py │ │ └── string_to_mask.py │ ├── mixins │ │ ├── embeddings.py │ │ ├── io.py │ │ └── word_mappings.py │ ├── models │ │ ├── __init__.py │ │ ├── general_usage │ │ │ ├── attention_decoder.py │ │ │ ├── feed_forward_network.py │ │ │ ├── recurrent_neural_network.py │ │ │ └── seq2seq.py │ │ ├── language │ │ │ ├── index_embeddings.py │ │ │ └── sentence_embeddings.py │ │ ├── model.py │ │ ├── multi_modal_reasoning │ │ │ ├── compact_bilinear_pooling.py │ │ │ ├── factorized_bilinear_pooling.py │ │ │ ├── low_rank_bilinear_pooling.py │ │ │ ├── question_driven_attention.py │ │ │ ├── relational_network.py │ │ │ └── self_attention.py │ │ └── vision │ │ │ ├── convnet_encoder.py │ │ │ ├── generic_image_encoder.py │ │ │ └── lenet5.py │ ├── publishers │ │ ├── __init__.py │ │ ├── global_variable_publisher.py │ │ └── stream_file_exporter.py │ ├── statistics │ │ ├── __init__.py │ │ ├── accuracy_statistics.py │ │ ├── batch_size_statistics.py │ │ ├── bleu_statistics.py │ │ └── precision_recall_statistics.py │ ├── tasks │ │ ├── image_text_to_class │ │ │ ├── __init__.py │ │ │ ├── clevr.py │ │ │ ├── gqa.py │ │ │ └── vqa_med_2019.py │ │ ├── image_to_class │ │ │ ├── __init__.py │ │ │ ├── cifar_100.py │ │ │ ├── mnist.py │ │ │ └── simple_molecules.py │ │ ├── task.py │ │ ├── text_to_class │ │ │ ├── __init__.py │ │ │ ├── dummy_language_identification.py │ │ │ ├── language_identification.py │ │ │ ├── wily_language_identification.py │ │ │ └── wily_ngram_language_modeling.py │ │ └── text_to_text │ │ │ ├── __init__.py │ │ │ ├── translation_pairs.py │ │ │ └── wikitext_language_modeling.py │ ├── transforms │ │ ├── __init__.py │ │ ├── concatenate_tensor.py │ │ ├── list_to_tensor.py │ │ ├── reduce_tensor.py │ │ └── reshape_tensor.py │ └── viewers │ │ ├── __init__.py │ │ ├── image_viewer.py │ │ └── stream_viewer.py ├── configuration │ ├── __init__.py │ ├── config_interface.py │ ├── config_parsing.py │ ├── config_registry.py │ └── configuration_error.py ├── data_types │ ├── __init__.py │ ├── data_definition.py │ └── data_streams.py ├── utils │ ├── __init__.py │ ├── app_state.py │ ├── data_streams_parallel.py │ ├── globals_facade.py │ ├── key_mappings_facade.py │ ├── logger.py │ ├── samplers.py │ ├── singleton.py │ ├── statistics_aggregator.py │ ├── statistics_collector.py │ └── termination_condition.py └── workers │ ├── __init__.py │ ├── offline_trainer.py │ ├── online_trainer.py │ ├── processor.py │ ├── test_data_dict_parallel.py │ ├── trainer.py │ └── worker.py ├── setup.py └── tests ├── __init__.py ├── application ├── pipeline_tests.py ├── sampler_factory_tests.py └── samplers_tests.py ├── components ├── component_tests.py └── tasks │ ├── clevr_tests.py │ ├── gqa_tests.py │ └── task_tests.py ├── configuration ├── config_interface_tests.py ├── config_registry_tests.py └── handshaking_tests.py ├── data_types ├── data_definition_tests.py └── data_streams_tests.py └── utils ├── app_state_tests.py └── statistics_tests.py /.coveralls.yml: -------------------------------------------------------------------------------- 1 | service_name: travis-ci -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | 106 | # vscode 107 | .vscode/ -------------------------------------------------------------------------------- /.lgtm.yml: -------------------------------------------------------------------------------- 1 | extraction: 2 | python: 3 | python_setup: 4 | version: 3 5 | index: 6 | exclude: 7 | - .git 8 | #after_prepare: 9 | # - python3 -m pip install --upgrade --user flake8 10 | #before_index: 11 | # - python3 -m flake8 --version # flake8 3.6.0 on CPython 3.6.5 on Linux 12 | # # stop the build if there are Python syntax errors or undefined names 13 | # - python3 -m flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics 14 | # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide 15 | # - python3 -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics 16 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Copyright (C) tkornuta, IBM Corporation 2019 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | language: python 16 | python: 3.6 17 | 18 | # Safelist: focus Travis' attention on the master and develop branches only. 19 | branches: 20 | only: 21 | - master 22 | - develop 23 | 24 | #install: 25 | # - pip3 install -r requirements.txt 26 | 27 | before_install: 28 | - sudo apt-get update 29 | # Install conda. 30 | - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; 31 | - bash miniconda.sh -b -p $HOME/miniconda 32 | - export PATH="$HOME/miniconda/bin:$PATH" 33 | # Set conda to always "--yes" mode. 34 | - conda config --set always_yes yes --set changeps1 no 35 | - conda update -q conda 36 | # Create env and install pytorch 37 | - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION pytorch scipy -c pytorch 38 | - source activate test-environment 39 | # Coveralls 40 | - pip install coveralls 41 | 42 | install: 43 | - python setup.py install 44 | 45 | script: 46 | # Test plake8 compatibility. 47 | #- python3 -m flake8 --version # flake8 3.6.0 on CPython 3.6.5 on Linux 48 | # stop the build if there are Python syntax errors or undefined names 49 | #- python3 -m flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics 50 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide 51 | #- python3 -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics 52 | # Run unittests in ptp/test. 53 | #- python -m unittest ptp 54 | - coverage run -m unittest #discover -s ptp 55 | # Build documentation. 56 | # TODO. 57 | 58 | after_success: 59 | # Coverals. 60 | - coveralls -------------------------------------------------------------------------------- /configs/cifar100/cifar100_classification_convnet_softmax.yml: -------------------------------------------------------------------------------- 1 | # Load config defining CIFAR100 tasks for training, validation and testing. 2 | default_configs: cifar100/default_cifar100.yml 3 | 4 | # Definition of the pipeline. 5 | pipeline: 6 | 7 | # Model consisting of two components. 8 | image_encoder: 9 | priority: 1.1 10 | type: ConvNetEncoder 11 | 12 | # Reshape inputs 13 | reshaper: 14 | priority: 1.2 15 | type: ReshapeTensor 16 | input_dims: [-1, 16, 2, 2] 17 | output_dims: [-1, 64] 18 | streams: 19 | inputs: feature_maps 20 | outputs: reshaped_maps 21 | globals: 22 | output_size: reshaped_maps_size 23 | 24 | # Image classifier. 25 | classifier: 26 | priority: 1.3 27 | type: FeedForwardNetwork 28 | streams: 29 | inputs: reshaped_maps 30 | globals: 31 | input_size: reshaped_maps_size 32 | prediction_size: num_fine_classes 33 | 34 | #: pipeline 35 | -------------------------------------------------------------------------------- /configs/cifar100/default_cifar100.yml: -------------------------------------------------------------------------------- 1 | # Training parameters: 2 | training: 3 | task: 4 | type: CIFAR100 5 | batch_size: &b 1024 6 | use_train_data: True 7 | # Use sampler that operates on a subset. 8 | dataloader: 9 | num_workers: 10 10 | # shuffle: False 11 | sampler: 12 | type: SubsetRandomSampler 13 | indices: [0, 45000] 14 | # optimizer parameters: 15 | optimizer: 16 | type: Adam 17 | lr: 0.001 18 | # settings parameters 19 | terminal_conditions: 20 | loss_stop_threshold: 0.05 21 | early_stop_validations: -1 22 | episode_limit: 10000 23 | epoch_limit: 10 24 | 25 | # Validation parameters: 26 | validation: 27 | #partial_validation_interval: 100 28 | task: 29 | type: CIFAR100 30 | batch_size: *b 31 | use_train_data: True # True because we are splitting the training set to: validation and training 32 | #resize: [32, 32] 33 | # Use sampler that operates on a subset. 34 | sampler: 35 | type: SubsetRandomSampler 36 | indices: [45000, 50000] 37 | 38 | # Testing parameters: 39 | test: 40 | task: 41 | type: MNIST 42 | batch_size: *b 43 | use_train_data: False 44 | #resize: [32, 32] 45 | 46 | pipeline: 47 | disable: image_viewer 48 | 49 | # Loss 50 | nllloss: 51 | type: NLLLoss 52 | priority: 10.0 53 | streams: 54 | targets: fine_targets 55 | 56 | # Statistics. 57 | batch_size: 58 | priority: 100.0 59 | type: BatchSizeStatistics 60 | streams: 61 | targets: fine_targets 62 | 63 | accuracy: 64 | priority: 100.1 65 | type: AccuracyStatistics 66 | streams: 67 | targets: fine_targets 68 | 69 | 70 | precision_recall: 71 | priority: 100.2 72 | type: PrecisionRecallStatistics 73 | use_word_mappings: True 74 | #show_class_scores: True 75 | globals: 76 | word_mappings: fine_label_word_mappings 77 | streams: 78 | targets: fine_targets 79 | 80 | answer_decoder: 81 | priority: 100.3 82 | type: WordDecoder 83 | import_word_mappings_from_globals: True 84 | globals: 85 | word_mappings: fine_label_word_mappings 86 | streams: 87 | inputs: predictions 88 | outputs: answers 89 | 90 | stream_viewer: 91 | priority: 100.4 92 | type: StreamViewer 93 | input_streams: coarse_targets, coarse_labels, fine_targets, fine_labels, answers 94 | 95 | image_viewer: 96 | priority: 100.5 97 | type: ImageViewer 98 | streams: 99 | images: inputs 100 | labels: fine_labels 101 | answers: coarse_labels 102 | 103 | -------------------------------------------------------------------------------- /configs/clevr/clevr_image_convnet_ffn.yml: -------------------------------------------------------------------------------- 1 | # Load config defining CLEVR tasks for training, validation and testing. 2 | default_configs: clevr/default_clevr.yml 3 | 4 | # Definition of the pipeline. 5 | pipeline: 6 | 7 | # Model consisting of two components. 8 | image_encoder: 9 | priority: 1.1 10 | type: ConvNetEncoder 11 | streams: 12 | inputs: images 13 | 14 | # Reshape inputs 15 | reshaper: 16 | priority: 1.2 17 | type: ReshapeTensor 18 | input_dims: [-1, 16, 58, 38] 19 | output_dims: [-1, 35264] 20 | streams: 21 | inputs: feature_maps 22 | outputs: reshaped_maps 23 | globals: 24 | output_size: reshaped_maps_size 25 | 26 | # Image classifier. 27 | classifier: 28 | priority: 1.3 29 | type: FeedForwardNetwork 30 | hidden_sizes: [1000] 31 | streams: 32 | inputs: reshaped_maps 33 | globals: 34 | input_size: reshaped_maps_size 35 | prediction_size: num_answers 36 | 37 | #: pipeline 38 | -------------------------------------------------------------------------------- /configs/clevr/clevr_question_glove_lstm.yml: -------------------------------------------------------------------------------- 1 | # Load config defining CLEVR tasks for training, validation and testing. 2 | default_configs: clevr/default_clevr.yml 3 | 4 | # This is unimodal (questino-based) baseline, thus stop streaming images - in all sets. 5 | training: 6 | task: 7 | stream_images: False 8 | 9 | validation: 10 | task: 11 | stream_images: False 12 | 13 | test: 14 | task: 15 | stream_images: False 16 | 17 | # Definition of the pipeline. 18 | pipeline: 19 | 20 | # Questions encoding. 21 | question_tokenizer: 22 | priority: 1.1 23 | type: SentenceTokenizer 24 | # Lowercase all letters + remove punctuation (reduced vocabulary of 80 words instead of 87) 25 | preprocessing: all 26 | streams: 27 | inputs: questions 28 | outputs: tokenized_questions 29 | 30 | # Model 1: Embeddings 31 | question_embeddings: 32 | priority: 1.2 33 | type: SentenceEmbeddings 34 | embeddings_size: 50 35 | pretrained_embeddings_file: glove.6B.50d.txt 36 | data_folder: ~/data/CLEVR_v1.0 37 | word_mappings_file: questions.all.word.mappings.lowercase.csv 38 | export_word_mappings_to_globals: True 39 | globals: 40 | word_mappings: question_word_mappings 41 | vocabulary_size: num_question_words 42 | streams: 43 | inputs: tokenized_questions 44 | outputs: embedded_questions 45 | 46 | # Model 2: RNN 47 | lstm: 48 | priority: 1.3 49 | type: RecurrentNeuralNetwork 50 | cell_type: LSTM 51 | prediction_mode: Last 52 | initial_state: Zero 53 | hidden_size: 50 54 | streams: 55 | inputs: embedded_questions 56 | globals: 57 | input_size: embeddings_size 58 | prediction_size: num_answers 59 | 60 | 61 | #: pipeline 62 | -------------------------------------------------------------------------------- /configs/clevr/default_clevr.yml: -------------------------------------------------------------------------------- 1 | # Training parameters: 2 | training: 3 | task: 4 | type: CLEVR 5 | batch_size: &b 64 6 | split: training 7 | #resize_image: [224, 224] 8 | # optimizer parameters: 9 | optimizer: 10 | type: Adam 11 | lr: 0.0001 12 | # settings parameters 13 | terminal_conditions: 14 | loss_stop_threshold: 0.05 15 | early_stop_validations: -1 16 | episode_limit: 10000 17 | epoch_limit: 10 18 | 19 | # Validation parameters: 20 | validation: 21 | task: 22 | type: CLEVR 23 | batch_size: *b 24 | split: validation 25 | #resize_image: [224, 224] 26 | 27 | # Testing parameters: 28 | test: 29 | task: 30 | type: CLEVR 31 | batch_size: *b 32 | split: test 33 | #resize_image: [224, 224] 34 | 35 | pipeline: 36 | name: tmp 37 | disable: image_viewer 38 | 39 | label_to_target: 40 | type: LabelIndexer 41 | priority: 0.1 42 | # Load word mappings for answers. 43 | data_folder: ~/data/CLEVR_v1.0 44 | word_mappings_file: answers.all.word.mappings.csv 45 | export_word_mappings_to_globals: True 46 | globals: 47 | word_mappings: answer_word_mappings 48 | vocabulary_size: num_answers 49 | streams: 50 | inputs: answers 51 | outputs: target_answers 52 | 53 | 54 | # Loss 55 | nllloss: 56 | type: NLLLoss 57 | priority: 10.1 58 | streams: 59 | targets: target_answers 60 | 61 | # Statistics. 62 | batch_size: 63 | priority: 100.0 64 | type: BatchSizeStatistics 65 | 66 | accuracy: 67 | priority: 100.1 68 | type: AccuracyStatistics 69 | streams: 70 | targets: target_answers 71 | 72 | precision_recall: 73 | priority: 100.2 74 | type: PrecisionRecallStatistics 75 | use_word_mappings: True 76 | show_class_scores: True 77 | globals: 78 | word_mappings: answer_word_mappings 79 | streams: 80 | targets: target_answers 81 | 82 | answer_decoder: 83 | priority: 100.3 84 | type: WordDecoder 85 | import_word_mappings_from_globals: True 86 | globals: 87 | word_mappings: answer_word_mappings 88 | streams: 89 | inputs: predictions 90 | outputs: predicted_answers 91 | 92 | stream_viewer: 93 | priority: 100.4 94 | type: StreamViewer 95 | input_streams: indices, questions, target_answers, predicted_answers 96 | 97 | #image_viewer: 98 | # priority: 100.5 99 | # type: ImageViewer 100 | # streams: 101 | # images: inputs 102 | # labels: labels 103 | # answers: answers 104 | 105 | -------------------------------------------------------------------------------- /configs/default/components/language/bow_encoder.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for BOW Encoder. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | streams: 8 | #################################################################### 9 | # 2. Keymappings associated with INPUT and OUTPUT streams. 10 | #################################################################### 11 | 12 | # Stream containing input tensor (INPUT) 13 | inputs: inputs 14 | 15 | # Stream containing output tensor (OUTPUT) 16 | outputs: outputs 17 | 18 | globals: 19 | #################################################################### 20 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 21 | #################################################################### 22 | 23 | # Length of the bag-of-word vector. 24 | bow_size: bow_size 25 | 26 | #################################################################### 27 | # 4. Keymappings associated with GLOBAL variables that will be SET. 28 | #################################################################### 29 | 30 | #################################################################### 31 | # 5. Keymappings associated with statistics that will be ADDED. 32 | #################################################################### 33 | 34 | -------------------------------------------------------------------------------- /configs/default/components/language/label_indexer.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for LabelIndexer. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Folder where task will store data (LOADED) 8 | data_folder: '~/data/' 9 | 10 | # Source files that will be used to create the vocabulary (LOADED) 11 | source_vocabulary_files: '' 12 | 13 | # Additional tokens that will be added to vocabulary (LOADED) 14 | additional_tokens: '' 15 | 16 | # File containing word (LOADED) 17 | word_mappings_file: 'word_mappings.csv' 18 | 19 | # HACK: This key is useless here, but needed by parent class. Should be removed/fixed in the future 20 | export_pad_index_to_globals: False 21 | 22 | # If set, component will always (re)generate the vocabulary (LOADED) 23 | regenerate: False 24 | 25 | # Flag informing whether word mappings will be imported from globals (LOADED) 26 | import_word_mappings_from_globals: False 27 | 28 | # Flag informing whether word mappings will be exported to globals (LOADED) 29 | export_word_mappings_to_globals: False 30 | 31 | # Value that will be used when word is out of vocabulary (LOADED) 32 | # (Mask for that element will be 0 as well) 33 | # -100 is the default value used by PyTroch loss functions to specify 34 | # target values that will ignored and does not contribute to the input gradient. 35 | # (ignore_index=-100) 36 | out_of_vocabulary_value: -100 37 | 38 | streams: 39 | #################################################################### 40 | # 2. Keymappings associated with INPUT and OUTPUT streams. 41 | #################################################################### 42 | 43 | # Stream containing input tensor (INPUT) 44 | inputs: inputs 45 | 46 | # Stream containing output tensor (OUTPUT) 47 | outputs: outputs 48 | 49 | globals: 50 | #################################################################### 51 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 52 | #################################################################### 53 | 54 | #################################################################### 55 | # 4. Keymappings associated with GLOBAL variables that will be SET. 56 | #################################################################### 57 | 58 | # The loaded/exported word mappings (RETRIEVED/SET) 59 | # This depends on the import/export configuration flags above. 60 | word_mappings: word_mappings 61 | 62 | # Size of the vocabulary (RETRIEVED/SET) 63 | # This depends on the import/export configuration flags above. 64 | vocabulary_size: vocabulary_size 65 | 66 | #################################################################### 67 | # 5. Keymappings associated with statistics that will be ADDED. 68 | #################################################################### 69 | 70 | -------------------------------------------------------------------------------- /configs/default/components/language/sentence_one_hot_encoder.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for Sentence 1-hot Encoder. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Folder where task will store data (LOADED) 8 | data_folder: '~/data/' 9 | 10 | # Source files that will be used to create the vocabulary (LOADED) 11 | source_vocabulary_files: '' 12 | 13 | # Additional tokens that will be added to vocabulary (LOADED) 14 | additional_tokens: '' 15 | 16 | # File containing word (LOADED) 17 | word_mappings_file: 'word_mappings.csv' 18 | 19 | # HACK: This key is useless here, but needed by parent class. Should be removed/fixed in the future 20 | export_pad_index_to_globals: False 21 | 22 | # If set, component will always (re)generate the vocabulary (LOADED) 23 | regenerate: False 24 | 25 | # Flag informing whether word mappings will be imported from globals (LOADED) 26 | import_word_mappings_from_globals: False 27 | 28 | # Flag informing whether word mappings will be exported to globals (LOADED) 29 | export_word_mappings_to_globals: False 30 | 31 | streams: 32 | #################################################################### 33 | # 2. Keymappings associated with INPUT and OUTPUT streams. 34 | #################################################################### 35 | 36 | # Stream containing input tensor (INPUT) 37 | inputs: inputs 38 | 39 | # Stream containing output tensor (OUTPUT) 40 | outputs: outputs 41 | 42 | globals: 43 | #################################################################### 44 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 45 | #################################################################### 46 | 47 | #################################################################### 48 | # 4. Keymappings associated with GLOBAL variables that will be SET. 49 | #################################################################### 50 | 51 | # The loaded/exported word mappings (RETRIEVED/SET) 52 | # This depends on the import/export configuration flags above. 53 | word_mappings: word_mappings 54 | 55 | # Size of the vocabulary (RETRIEVED/SET) 56 | # This depends on the import/export configuration flags above. 57 | vocabulary_size: vocabulary_size 58 | 59 | #################################################################### 60 | # 5. Keymappings associated with statistics that will be ADDED. 61 | #################################################################### 62 | 63 | -------------------------------------------------------------------------------- /configs/default/components/language/sentence_tokenizer.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for Sentence Tokenizer. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Operation mode (LOADED) 8 | # False: sentence -> list of strings, True: list of strings -> sentence. 9 | detokenize: False 10 | 11 | # Select applied preprocessing/augmentations (LOADED) 12 | # Use one (or more) of the transformations: 13 | # none | lowercase | remove_punctuation | all 14 | # Accepted formats: a,b,c or [a,b,c] 15 | preprocessing: none 16 | 17 | # List of characters to be removed 18 | remove_characters: '' 19 | 20 | streams: 21 | #################################################################### 22 | # 2. Keymappings associated with INPUT and OUTPUT streams. 23 | #################################################################### 24 | 25 | # Stream containing input (detokenized or tokenized) sentences (INPUT) 26 | inputs: inputs 27 | 28 | # Stream containing output (tokenized or detokenized) sentences (OUTPUT) 29 | outputs: outputs 30 | 31 | globals: 32 | #################################################################### 33 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 34 | #################################################################### 35 | 36 | #################################################################### 37 | # 4. Keymappings associated with GLOBAL variables that will be SET. 38 | #################################################################### 39 | 40 | #################################################################### 41 | # 5. Keymappings associated with statistics that will be ADDED. 42 | #################################################################### 43 | 44 | -------------------------------------------------------------------------------- /configs/default/components/language/word_decoder.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for Word Decoder. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Folder where task will store data (LOADED) 8 | data_folder: '~/data/' 9 | 10 | # Source files that will be used to create the vocabulary (LOADED) 11 | source_vocabulary_files: '' 12 | 13 | # Additional tokens that will be added to vocabulary (LOADED) 14 | additional_tokens: '' 15 | 16 | # HACK: This key is useless here, but needed by parent class. Should be removed/fixed in the future 17 | export_pad_index_to_globals: False 18 | 19 | # File containing word (LOADED) 20 | word_mappings_file: 'word_mappings.csv' 21 | 22 | # If set, component will always (re)generate the vocabulary (LOADED) 23 | regenerate: False 24 | 25 | # Flag informing whether word mappings will be imported from globals (LOADED) 26 | import_word_mappings_from_globals: False 27 | 28 | # Flag informing whether word mappings will be exported to globals (LOADED) 29 | export_word_mappings_to_globals: False 30 | 31 | streams: 32 | #################################################################### 33 | # 2. Keymappings associated with INPUT and OUTPUT streams. 34 | #################################################################### 35 | 36 | # Stream containing input tensor (INPUT) 37 | inputs: inputs 38 | 39 | # Stream containing output words (OUTPUT) 40 | outputs: outputs 41 | 42 | globals: 43 | #################################################################### 44 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 45 | #################################################################### 46 | 47 | #################################################################### 48 | # 4. Keymappings associated with GLOBAL variables that will be SET. 49 | #################################################################### 50 | 51 | # The loaded/exported word mappings (RETRIEVED/SET) 52 | # This depends on the import/export configuration flags above. 53 | word_mappings: word_mappings 54 | 55 | # Size of the vocabulary (RETRIEVED/SET) 56 | # This depends on the import/export configuration flags above. 57 | vocabulary_size: vocabulary_size 58 | 59 | #################################################################### 60 | # 5. Keymappings associated with statistics that will be ADDED. 61 | #################################################################### 62 | 63 | -------------------------------------------------------------------------------- /configs/default/components/losses/nll_loss.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the NLL Loss. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Number of dimensions of targets, so the loss can work with 8 | # diffent inputs/targets (LOADED) 9 | num_targets_dims: 1 10 | 11 | # Loss function (LOADED) 12 | # Options: NLLLoss | CrossEntropyLoss (NOT OPERATIONAL YET!) 13 | # loss_function: NLLLoss 14 | 15 | # When set to True, performs masking of selected samples from batch (LOADED) 16 | use_masking: False 17 | 18 | streams: 19 | #################################################################### 20 | # 2. Keymappings associated with INPUT and OUTPUT streams. 21 | #################################################################### 22 | 23 | # Stream containing targets (label ids) (INPUT) 24 | targets: targets 25 | 26 | # Stream containing batch of predictions (INPUT) 27 | predictions: predictions 28 | 29 | # Stream containing masks used for masking of selected samples from batch (INPUT) 30 | masks: masks 31 | 32 | # Stream containing loss (OUTPUT) 33 | loss: loss 34 | 35 | globals: 36 | #################################################################### 37 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 38 | #################################################################### 39 | 40 | # Target value to ignore (masking) 41 | ignore_index: ignore_index 42 | 43 | #################################################################### 44 | # 4. Keymappings associated with GLOBAL variables that will be SET. 45 | #################################################################### 46 | 47 | #################################################################### 48 | # 5. Keymappings associated with statistics that will be ADDED. 49 | #################################################################### 50 | 51 | -------------------------------------------------------------------------------- /configs/default/components/masking/join_masked_predictions.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the Join Masked Predictions component. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # List of input stream names, each containing batch of predictions (LOADED) 8 | input_prediction_streams: '' 9 | 10 | # List of input stream names, each containing batch of masks (LOADED) 11 | input_mask_streams: '' 12 | 13 | # List of word mapping names - those will be loaded from globals (LOADED) 14 | input_word_mappings: '' 15 | 16 | streams: 17 | #################################################################### 18 | # 2. Keymappings associated with INPUT and OUTPUT streams. 19 | #################################################################### 20 | 21 | # Stream containing batch of output strings (OUTPUT) 22 | output_strings: output_strings 23 | 24 | # Stream containing batch of output indices (OUTPUT) 25 | # WARNING: As performed operations are not differentiable, 26 | # those indices cannot be used for e.g. calculation of loss!! 27 | output_indices: output_indices 28 | 29 | globals: 30 | #################################################################### 31 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 32 | #################################################################### 33 | 34 | # Vocabulary used to produce output strings (RETRIEVED) 35 | output_word_mappings: output_word_mappings 36 | 37 | #################################################################### 38 | # 4. Keymappings associated with GLOBAL variables that will be SET. 39 | #################################################################### 40 | 41 | #################################################################### 42 | # 5. Keymappings associated with statistics that will be ADDED. 43 | #################################################################### 44 | 45 | -------------------------------------------------------------------------------- /configs/default/components/masking/string_to_mask.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the String To Mask component. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Value that will be used when word is out of vocabulary (LOADED) 8 | # (Mask for that element will be 0 as well) 9 | # -100 is the default value used by PyTroch loss functions to specify 10 | # target values that will ignored and does not contribute to the input gradient. 11 | # (ignore_index=-100) 12 | out_of_vocabulary_value: -100 13 | 14 | streams: 15 | #################################################################### 16 | # 2. Keymappings associated with INPUT and OUTPUT streams. 17 | #################################################################### 18 | 19 | # Stream containing input strings (INPUT) 20 | strings: strings 21 | 22 | # Stream containing output masks (OUTPUT) 23 | masks: masks 24 | 25 | # Stream containing output indices (OUTPUT) 26 | string_indices: string_indices 27 | 28 | globals: 29 | #################################################################### 30 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 31 | #################################################################### 32 | 33 | # Vocabulary used to produce masks and indices (RETRIEVED) 34 | word_mappings: word_mappings 35 | 36 | #################################################################### 37 | # 4. Keymappings associated with GLOBAL variables that will be SET. 38 | #################################################################### 39 | 40 | #################################################################### 41 | # 5. Keymappings associated with statistics that will be ADDED. 42 | #################################################################### 43 | 44 | -------------------------------------------------------------------------------- /configs/default/components/models/general_usage/feed_forward_network.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the Multi-Layer Feed-Forward Network. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Optional (LOADED) 8 | # Number of hidden layers, along with their sizes (numbers of neurons). 9 | # hidden_sizes: [dim hidden 1, dim hidden 2, ...] 10 | 11 | # Dropout rate (LOADED) 12 | # Default: 0 (means that it is turned off) 13 | dropout_rate: 0 14 | 15 | # If true, output of the last layer will be additionally processed with Log Softmax (LOADED) 16 | use_logsoftmax: True 17 | 18 | # Number of dimensions, where: 19 | # - 2 means [Batch size, Input size] 20 | # - n means [Batch size, dim 1, ..., dim n-2, Input size] 21 | # And the FFN is broadcasted over the last (Input Size) Dimension. 22 | # Also, all the dimensions sizes but the last are conserved, as the FFN is applied over the last dimension. 23 | dimensions: 2 24 | 25 | streams: 26 | #################################################################### 27 | # 2. Keymappings associated with INPUT and OUTPUT streams. 28 | #################################################################### 29 | 30 | # Stream containing batch of inputs (INPUT) 31 | inputs: inputs 32 | 33 | # Stream containing predictions (OUTPUT) 34 | predictions: predictions 35 | 36 | globals: 37 | #################################################################### 38 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 39 | #################################################################### 40 | 41 | # Size of the input (RETRIEVED) 42 | input_size: input_size 43 | 44 | # Size of the prediction (RETRIEVED) 45 | prediction_size: prediction_size 46 | 47 | #################################################################### 48 | # 4. Keymappings associated with GLOBAL variables that will be SET. 49 | #################################################################### 50 | 51 | #################################################################### 52 | # 5. Keymappings associated with statistics that will be ADDED. 53 | #################################################################### 54 | 55 | -------------------------------------------------------------------------------- /configs/default/components/models/general_usage/seq2seq.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the RNN model. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Size of the hidden state (LOADED) 8 | hidden_size: 100 9 | 10 | # Flag informing the model to learn the intial state (h0/c0) (LOADED) 11 | # When false, (c0/c0) will be initialized as zeros. 12 | 13 | # Initial state type: 14 | # * Zero (null vector) 15 | # * Trainable (xavier initialization, trainable) 16 | # * Input (the initial hidden state comes from an input stream) 17 | initial_state: Trainable 18 | 19 | # Wether to include the last hidden state in the outputs 20 | output_last_state: False 21 | 22 | # Type of recurrent cell (LOADED) 23 | # Options: LSTM | GRU | RNN_TANH | RNN_RELU 24 | cell_type: LSTM 25 | 26 | # Number of "stacked" layers (LOADED) 27 | num_layers: 1 28 | 29 | # Dropout rate (LOADED) 30 | # Default: 0 (means that it is turned off) 31 | dropout_rate: 0 32 | 33 | # Prediction mode (LOADED) 34 | # Options: 35 | # * Dense (passes every activation through output layer) | 36 | # * Last (passes only the last activation though output layer) | 37 | # * None (all outputs are discarded) 38 | prediction_mode: Dense 39 | 40 | # Input mode 41 | # Options: 42 | # * Dense (every iteration expects an input) 43 | # * Autoregression_First (Autoregression, expects an input for the first iteration) 44 | # * Autoregression_None (Autoregression, first input will be a null vector) 45 | input_mode: Dense 46 | 47 | autoregression_length: 50 48 | 49 | # If true, output of the last layer will be additionally processed with Log Softmax (LOADED) 50 | use_logsoftmax: True 51 | 52 | streams: 53 | #################################################################### 54 | # 2. Keymappings associated with INPUT and OUTPUT streams. 55 | #################################################################### 56 | 57 | # Stream containing batch of images (INPUT) 58 | inputs: inputs 59 | 60 | # Stream containing predictions (OUTPUT) 61 | predictions: predictions 62 | 63 | globals: 64 | #################################################################### 65 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 66 | #################################################################### 67 | 68 | # Size of the input (RETRIEVED) 69 | input_size: input_size 70 | 71 | # Size of the prediction (RETRIEVED) 72 | prediction_size: prediction_size 73 | 74 | #################################################################### 75 | # 4. Keymappings associated with GLOBAL variables that will be SET. 76 | #################################################################### 77 | 78 | #################################################################### 79 | # 5. Keymappings associated with statistics that will be ADDED. 80 | #################################################################### 81 | 82 | -------------------------------------------------------------------------------- /configs/default/components/models/language/index_embeddings.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the Index Embeddings. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Size of the embeddings (LOADED) 8 | # Need to be set by the user. 9 | # embeddings_size: 100 10 | 11 | streams: 12 | #################################################################### 13 | # 2. Keymappings associated with INPUT and OUTPUT streams. 14 | #################################################################### 15 | 16 | # Stream containing batch of inputs (INPUT) 17 | inputs: inputs 18 | 19 | # Stream containing predictions (OUTPUT) 20 | predictions: predictions 21 | 22 | globals: 23 | #################################################################### 24 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 25 | #################################################################### 26 | 27 | # Size of the vocabulary (RETRIEVED) 28 | vocab_size: vocab_size 29 | 30 | #################################################################### 31 | # 4. Keymappings associated with GLOBAL variables that will be SET. 32 | #################################################################### 33 | 34 | # Size of the embeddings (SET) 35 | # It is exported to globals, so other components can use it during 36 | # their initialization. 37 | embeddings_size: embeddings_size 38 | 39 | #################################################################### 40 | # 5. Keymappings associated with statistics that will be ADDED. 41 | #################################################################### 42 | 43 | -------------------------------------------------------------------------------- /configs/default/components/models/multi_modal_reasoning/compact_bilinear_pooling.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the Multimodal Compact Bilinear Pooling model. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Parameter denoting whether projection matrices are trainable (LOADED) 8 | # Setting flag that to true will result in trainable, dense (i.e. not "sketch") projection layers. 9 | trainable_projections: False 10 | 11 | streams: 12 | #################################################################### 13 | # 2. Keymappings associated with INPUT and OUTPUT streams. 14 | #################################################################### 15 | 16 | # Stream containing batch of encoded images (INPUT) 17 | image_encodings: image_encodings 18 | 19 | # Stream containing batch of encoded questions (INPUT) 20 | question_encodings: question_encodings 21 | 22 | # Stream containing outputs (OUTPUT) 23 | outputs: outputs 24 | 25 | globals: 26 | #################################################################### 27 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 28 | #################################################################### 29 | 30 | # Size of the image encodings input (RETRIEVED) 31 | image_encoding_size: image_encoding_size 32 | 33 | # Size of the question encodings input (RETRIEVED) 34 | question_encoding_size: question_encoding_size 35 | 36 | # Size of the output (RETRIEVED) 37 | output_size: output_size 38 | 39 | #################################################################### 40 | # 4. Keymappings associated with GLOBAL variables that will be SET. 41 | #################################################################### 42 | 43 | #################################################################### 44 | # 5. Keymappings associated with statistics that will be ADDED. 45 | #################################################################### 46 | 47 | -------------------------------------------------------------------------------- /configs/default/components/models/multi_modal_reasoning/factorized_bilinear_pooling.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the FactorizedBilinearPooling model. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Dropout rate (LOADED) 8 | # Default: 0 (means that it is turned off) 9 | dropout_rate: 0 10 | 11 | # Size of the latent space (LOADED) 12 | latent_size: 100 13 | 14 | # Factor used for sum pooling (LOADED) 15 | pool_factor: 2 16 | 17 | 18 | streams: 19 | #################################################################### 20 | # 2. Keymappings associated with INPUT and OUTPUT streams. 21 | #################################################################### 22 | 23 | # Stream containing batch of encoded images (INPUT) 24 | image_encodings: image_encodings 25 | 26 | # Stream containing batch of encoded questions (INPUT) 27 | question_encodings: question_encodings 28 | 29 | # Stream containing outputs (OUTPUT) 30 | outputs: outputs 31 | 32 | globals: 33 | #################################################################### 34 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 35 | #################################################################### 36 | 37 | # Size of the image encodings input (RETRIEVED) 38 | image_encoding_size: image_encoding_size 39 | 40 | # Size of the question encodings input (RETRIEVED) 41 | question_encoding_size: question_encoding_size 42 | 43 | #################################################################### 44 | # 4. Keymappings associated with GLOBAL variables that will be SET. 45 | #################################################################### 46 | 47 | # Size of the output (SET) 48 | output_size: output_size 49 | 50 | #################################################################### 51 | # 5. Keymappings associated with statistics that will be ADDED. 52 | #################################################################### 53 | -------------------------------------------------------------------------------- /configs/default/components/models/multi_modal_reasoning/low_rank_bilinear_pooling.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the LowRankBilinearPooling model. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Dropout rate (LOADED) 8 | # Default: 0 (means that it is turned off) 9 | dropout_rate: 0 10 | 11 | streams: 12 | #################################################################### 13 | # 2. Keymappings associated with INPUT and OUTPUT streams. 14 | #################################################################### 15 | 16 | # Stream containing batch of encoded images (INPUT) 17 | image_encodings: image_encodings 18 | 19 | # Stream containing batch of encoded questions (INPUT) 20 | question_encodings: question_encodings 21 | 22 | # Stream containing outputs (OUTPUT) 23 | outputs: outputs 24 | 25 | globals: 26 | #################################################################### 27 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 28 | #################################################################### 29 | 30 | # Size of the image encodings input (RETRIEVED) 31 | image_encoding_size: image_encoding_size 32 | 33 | # Size of the question encodings input (RETRIEVED) 34 | question_encoding_size: question_encoding_size 35 | 36 | # Size of the output (RETRIEVED) 37 | output_size: output_size 38 | 39 | #################################################################### 40 | # 4. Keymappings associated with GLOBAL variables that will be SET. 41 | #################################################################### 42 | 43 | #################################################################### 44 | # 5. Keymappings associated with statistics that will be ADDED. 45 | #################################################################### 46 | 47 | -------------------------------------------------------------------------------- /configs/default/components/models/multi_modal_reasoning/question_driven_attention.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the QuestionDrivenAttention model. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Dropout rate (LOADED) 8 | # Default: 0 (means that it is turned off) 9 | dropout_rate: 0 10 | 11 | # Size of the latent space (LOADED) 12 | latent_size: 100 13 | 14 | # Number of attention heads (LOADED) 15 | num_attention_heads: 2 16 | 17 | # Type of output returned 18 | # Options: Image | Fusion 19 | # Details: attention-weighted image | concatenation of attention-weighted image and RNN encoded question 20 | output_mode: Fusion 21 | 22 | 23 | streams: 24 | #################################################################### 25 | # 2. Keymappings associated with INPUT and OUTPUT streams. 26 | #################################################################### 27 | 28 | # Stream containing batch of encoded images (INPUT) 29 | feature_maps: feature_maps 30 | 31 | # Stream containing batch of encoded questions (INPUT) 32 | question_encodings: question_encodings 33 | 34 | # Stream containing outputs (OUTPUT) 35 | outputs: outputs 36 | 37 | globals: 38 | #################################################################### 39 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 40 | #################################################################### 41 | 42 | # Height of the features tensor (RETRIEVED) 43 | feature_maps_height: feature_maps_height 44 | 45 | # Width of the features tensor (RETRIEVED) 46 | feature_maps_width: feature_maps_width 47 | 48 | # Depth of the features tensor (RETRIEVED) 49 | feature_maps_depth: feature_maps_depth 50 | 51 | # Size of the question encodings input (RETRIEVED) 52 | question_encoding_size: question_encoding_size 53 | 54 | #################################################################### 55 | # 4. Keymappings associated with GLOBAL variables that will be SET. 56 | #################################################################### 57 | 58 | # Size of the output (SET) 59 | output_size: output_size 60 | 61 | #################################################################### 62 | # 5. Keymappings associated with statistics that will be ADDED. 63 | #################################################################### 64 | -------------------------------------------------------------------------------- /configs/default/components/models/multi_modal_reasoning/relational_network.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the LowRankBilinearPooling model. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Dropout rate (LOADED) 8 | # Default: 0 (means that it is turned off) 9 | dropout_rate: 0 10 | 11 | # Number of layers along with their sizes (numbers of neurons) of g_theta network (LOADED) 12 | g_theta_sizes: [256, 256, 256] 13 | 14 | streams: 15 | #################################################################### 16 | # 2. Keymappings associated with INPUT and OUTPUT streams. 17 | #################################################################### 18 | 19 | # Stream containing batch of encoded images (INPUT) 20 | feature_maps: feature_maps 21 | 22 | # Stream containing batch of encoded questions (INPUT) 23 | question_encodings: question_encodings 24 | 25 | # Stream containing outputs (OUTPUT) 26 | outputs: outputs 27 | 28 | globals: 29 | #################################################################### 30 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 31 | #################################################################### 32 | 33 | # Height of the features tensor (RETRIEVED) 34 | feature_maps_height: feature_maps_height 35 | 36 | # Width of the features tensor (RETRIEVED) 37 | feature_maps_width: feature_maps_width 38 | 39 | # Depth of the features tensor (RETRIEVED) 40 | feature_maps_depth: feature_maps_depth 41 | 42 | # Size of the question encodings input (RETRIEVED) 43 | question_encoding_size: question_encoding_size 44 | 45 | #################################################################### 46 | # 4. Keymappings associated with GLOBAL variables that will be SET. 47 | #################################################################### 48 | 49 | # Size of the output (SET) 50 | output_size: output_size 51 | 52 | #################################################################### 53 | # 5. Keymappings associated with statistics that will be ADDED. 54 | #################################################################### 55 | 56 | -------------------------------------------------------------------------------- /configs/default/components/models/multi_modal_reasoning/self_attention.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the Self_Attention model. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Dropout rate (LOADED) 8 | # Default: 0 (means that it is turned off) 9 | dropout_rate: 0 10 | 11 | # Size of the latent space (LOADED) 12 | latent_size: 256 13 | 14 | # Number of attention heads (LOADED) 15 | num_attention_heads: 4 16 | 17 | 18 | streams: 19 | #################################################################### 20 | # 2. Keymappings associated with INPUT and OUTPUT streams. 21 | #################################################################### 22 | 23 | # Stream containing batch of encoded questions (INPUT) 24 | question_encodings: question_encodings 25 | 26 | # Stream containing outputs (OUTPUT) 27 | outputs: outputs 28 | 29 | globals: 30 | #################################################################### 31 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 32 | #################################################################### 33 | 34 | # Size of the question encodings input (RETRIEVED) 35 | question_encoding_size: question_encoding_size 36 | 37 | # Size of the output (RETRIEVED) 38 | output_size: output_size 39 | 40 | #################################################################### 41 | # 4. Keymappings associated with GLOBAL variables that will be SET. 42 | #################################################################### 43 | 44 | #################################################################### 45 | # 5. Keymappings associated with statistics that will be ADDED. 46 | #################################################################### 47 | -------------------------------------------------------------------------------- /configs/default/components/models/vision/convnet_encoder.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the simple 3-layer ConvNet model. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Parameters defining the first convolutional layer (LOADED) 8 | conv1: 9 | out_channels: 64 10 | kernel_size: 3 11 | stride: 1 12 | padding: 0 13 | 14 | # Parameters defining the first max-pooling layer (LOADED) 15 | maxpool1: 16 | kernel_size: 2 17 | 18 | # Parameters defining the second convolutional layer (LOADED) 19 | conv2: 20 | out_channels: 32 21 | kernel_size: 3 22 | stride: 1 23 | padding: 0 24 | 25 | # Parameters defining the second max-pooling layer (LOADED) 26 | maxpool2: 27 | kernel_size: 2 28 | 29 | # Parameters defining the third convolutional layer (LOADED) 30 | conv3: 31 | out_channels: 16 32 | kernel_size: 3 33 | stride: 1 34 | padding: 0 35 | 36 | # Parameters defining the third max-pooling layer (LOADED) 37 | maxpool3: 38 | kernel_size: 2 39 | 40 | streams: 41 | #################################################################### 42 | # 2. Keymappings associated with INPUT and OUTPUT streams. 43 | #################################################################### 44 | 45 | # Stream containing batch of inputs (INPUT) 46 | inputs: inputs 47 | 48 | # Stream containing batch of feature maps (OUTPUT) 49 | feature_maps: feature_maps 50 | 51 | globals: 52 | #################################################################### 53 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 54 | #################################################################### 55 | 56 | # Height dimension of the input (RETRIEVED) 57 | input_height: image_height 58 | 59 | # Width dimension of the image (RETRIEVED) 60 | input_width: image_width 61 | 62 | # Depth dimension of the image (RETRIEVED) 63 | input_depth: image_depth 64 | 65 | #################################################################### 66 | # 4. Keymappings associated with GLOBAL variables that will be SET. 67 | #################################################################### 68 | 69 | # Height of the feature map (SET) 70 | feature_map_height: feature_map_height 71 | 72 | # Width of the feature map (SET) 73 | feature_map_width: feature_map_width 74 | 75 | # Depth of the feature map (SET) 76 | feature_map_depth: feature_map_depth 77 | 78 | #################################################################### 79 | # 5. Keymappings associated with statistics that will be ADDED. 80 | #################################################################### 81 | 82 | -------------------------------------------------------------------------------- /configs/default/components/models/vision/generic_image_encoder.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the component wrapping (pretrained) Torch Vision models. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Model type (LOADED) 8 | # Options: vgg16 | densenet121 | resnet152 | resnet50 9 | model_type: vgg16 10 | 11 | # Parameter denoting whether the component will return (flat) prediction 12 | # or output of last feature layer (LOADED) 13 | return_feature_maps: False 14 | 15 | # Load weights of a model pretrained on ImageNet (LOADED) 16 | pretrained: True 17 | 18 | streams: 19 | #################################################################### 20 | # 2. Keymappings associated with INPUT and OUTPUT streams. 21 | #################################################################### 22 | 23 | # Stream containing batch of images (INPUT) 24 | inputs: inputs 25 | 26 | # Stream containing outputs (features or "predictions") (OUTPUT) 27 | outputs: outputs 28 | 29 | globals: 30 | #################################################################### 31 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 32 | #################################################################### 33 | 34 | # Size of the output (RETRIEVED) 35 | # Used when return_features = False. 36 | output_size: output_size 37 | 38 | #################################################################### 39 | # 4. Keymappings associated with GLOBAL variables that will be SET. 40 | #################################################################### 41 | 42 | # Height of the returned features tensor (SET) 43 | # Used when return_features = True. 44 | feature_maps_height: feature_maps_height 45 | 46 | # Width of the returned features tensor (SET) 47 | # Used when return_features = True. 48 | feature_maps_width: feature_maps_width 49 | 50 | # Depth of the returned features tensor (SET) 51 | # Used when return_features = True. 52 | feature_maps_depth: feature_maps_depth 53 | 54 | #################################################################### 55 | # 5. Keymappings associated with statistics that will be ADDED. 56 | #################################################################### 57 | -------------------------------------------------------------------------------- /configs/default/components/models/vision/lenet5.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the LeNet5 model. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | streams: 8 | #################################################################### 9 | # 2. Keymappings associated with INPUT and OUTPUT streams. 10 | #################################################################### 11 | 12 | # Stream containing batch of images (INPUT) 13 | inputs: inputs 14 | 15 | # Stream containing predictions (OUTPUT) 16 | predictions: predictions 17 | 18 | globals: 19 | #################################################################### 20 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 21 | #################################################################### 22 | 23 | # Size of the prediction (RETRIEVED) 24 | prediction_size: prediction_size 25 | 26 | #################################################################### 27 | # 4. Keymappings associated with GLOBAL variables that will be SET. 28 | #################################################################### 29 | 30 | #################################################################### 31 | # 5. Keymappings associated with statistics that will be ADDED. 32 | #################################################################### 33 | 34 | -------------------------------------------------------------------------------- /configs/default/components/publishers/global_variable_publisher.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the Global Variable Publisher. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # List of keys of variables that will be added to globals (LOADED) 8 | # an be both list of strings or a single string with comma-separated values. 9 | keys: '' 10 | 11 | # List of values - must be a single value or a list (LOADED) 12 | values: '' 13 | 14 | streams: 15 | #################################################################### 16 | # 2. Keymappings associated with INPUT and OUTPUT streams. 17 | #################################################################### 18 | 19 | globals: 20 | #################################################################### 21 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 22 | #################################################################### 23 | 24 | #################################################################### 25 | # 4. Keymappings associated with GLOBAL variables that will be SET. 26 | #################################################################### 27 | 28 | #################################################################### 29 | # 5. Keymappings associated with statistics that will be ADDED. 30 | #################################################################### 31 | 32 | -------------------------------------------------------------------------------- /configs/default/components/publishers/stream_file_exporter.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the Stream File Exporter. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # List of names of streams that will be displayed (LOADED) 8 | # Can be string a single name or or comma separated string with list 9 | input_streams: '' 10 | 11 | # Separator that will be placed between values (LOADED) 12 | separator: ',' 13 | 14 | # Adds additional line to output file enabling Excel to use different separator while loading (LOADED) 15 | export_separator_line_to_csv: False 16 | 17 | # Adds additional line to output with header (LOADED) 18 | export_header_to_csv: False 19 | 20 | # Name of the file containing output values (LOADED) 21 | filename: 'outputs.txt' 22 | 23 | streams: 24 | #################################################################### 25 | # 2. Keymappings associated with INPUT and OUTPUT streams. 26 | #################################################################### 27 | 28 | globals: 29 | #################################################################### 30 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 31 | #################################################################### 32 | 33 | #################################################################### 34 | # 4. Keymappings associated with GLOBAL variables that will be SET. 35 | #################################################################### 36 | 37 | #################################################################### 38 | # 5. Keymappings associated with statistics that will be ADDED. 39 | #################################################################### 40 | 41 | -------------------------------------------------------------------------------- /configs/default/components/statistics/accuracy_statistics.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the Accuracy statistics. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Flag indicating whether prediction are represented as distributions or indices (LOADED) 8 | # Options: True (expects distribution for each preditions) 9 | # False (expects indices (max args)) 10 | use_prediction_distributions: True 11 | 12 | # When set to True, performs masking of selected samples from batch (LOADED) 13 | use_masking: False 14 | 15 | streams: 16 | #################################################################### 17 | # 2. Keymappings associated with INPUT and OUTPUT streams. 18 | #################################################################### 19 | 20 | # Stream containing targets (label ids) (INPUT) 21 | targets: targets 22 | 23 | # Stream containing batch of predictions (INPUT) 24 | predictions: predictions 25 | 26 | # Stream containing masks used for masking of selected samples from batch (INPUT) 27 | masks: masks 28 | 29 | globals: 30 | #################################################################### 31 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 32 | #################################################################### 33 | 34 | #################################################################### 35 | # 4. Keymappings associated with GLOBAL variables that will be SET. 36 | #################################################################### 37 | 38 | statistics: 39 | #################################################################### 40 | # 5. Keymappings associated with statistics that will be ADDED. 41 | #################################################################### 42 | 43 | # Name used for collected statistics (ADDED). 44 | accuracy: accuracy 45 | 46 | 47 | -------------------------------------------------------------------------------- /configs/default/components/statistics/batch_size_statistics.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the Batch size statistics. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | streams: 8 | #################################################################### 9 | # 2. Keymappings associated with INPUT and OUTPUT streams. 10 | #################################################################### 11 | 12 | # Stream containing batch of indices (INPUT) 13 | indices: indices 14 | 15 | globals: 16 | #################################################################### 17 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 18 | #################################################################### 19 | 20 | #################################################################### 21 | # 4. Keymappings associated with GLOBAL variables that will be SET. 22 | #################################################################### 23 | 24 | #################################################################### 25 | # 5. Keymappings associated with statistics that will be ADDED. 26 | #################################################################### 27 | 28 | -------------------------------------------------------------------------------- /configs/default/components/statistics/bleu_statistics.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the BLEU statistics. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Flag indicating whether prediction are represented as distributions or indices (LOADED) 8 | # Options: True (expects distribution for each preditions) 9 | # False (expects indices (max args)) 10 | use_prediction_distributions: True 11 | 12 | # When set to True, performs masking of selected samples from batch (LOADED) 13 | # TODO! 14 | #use_masking: False 15 | 16 | # Ignored words - useful for ignoring special tokens 17 | ignored_words: ["", ""] 18 | 19 | # Weights of n-grams used when calculating the score. 20 | weights: [0.25, 0.25, 0.25, 0.25] 21 | 22 | streams: 23 | #################################################################### 24 | # 2. Keymappings associated with INPUT and OUTPUT streams. 25 | #################################################################### 26 | 27 | # Stream containing targets (label ids) (INPUT) 28 | targets: targets 29 | 30 | # Stream containing batch of predictions (INPUT) 31 | predictions: predictions 32 | 33 | # Stream containing masks used for masking of selected samples from batch (INPUT) 34 | #masks: masks 35 | 36 | globals: 37 | #################################################################### 38 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 39 | #################################################################### 40 | 41 | # Word mappings used for mappings of predictions/targets into list of words (RERIEVED) 42 | word_mappings: word_mappings 43 | 44 | #################################################################### 45 | # 4. Keymappings associated with GLOBAL variables that will be SET. 46 | #################################################################### 47 | 48 | statistics: 49 | #################################################################### 50 | # 5. Keymappings associated with statistics that will be ADDED. 51 | #################################################################### 52 | 53 | # Name used for collected statistics (ADDED). 54 | bleu: bleu 55 | 56 | 57 | -------------------------------------------------------------------------------- /configs/default/components/statistics/precision_recall_statistics.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the PrecisionRecall statistics. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Flag indicating whether prediction are represented as distributions or indices (LOADED) 8 | # Options: True (expects distribution for each preditions) 9 | # False (expects indices (max args)) 10 | use_prediction_distributions: True 11 | 12 | # Flag indicating whether confusion matrix will be shown (LOADED) 13 | show_confusion_matrix: False 14 | 15 | # Flag indicating whether detailed scores for each class will be shown (LOADED) 16 | show_class_scores: False 17 | 18 | # When set to true, will use the provided word mappings as labels (LOADED) 19 | use_word_mappings: False 20 | 21 | # When set to True, performs masking of selected samples from batch (LOADED) 22 | use_masking: False 23 | 24 | streams: 25 | #################################################################### 26 | # 2. Keymappings associated with INPUT and OUTPUT streams. 27 | #################################################################### 28 | 29 | # Stream containing targets (label ids) (INPUT) 30 | targets: targets 31 | 32 | # Stream containing batch of predictions (INPUT) 33 | predictions: predictions 34 | 35 | # Stream containing masks used for masking of selected samples from batch (INPUT) 36 | masks: masks 37 | 38 | globals: 39 | #################################################################### 40 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 41 | #################################################################### 42 | 43 | # Word mappings (optionally) used as labels (RETRIEVED) 44 | word_mappings: word_mappings 45 | 46 | #################################################################### 47 | # 4. Keymappings associated with GLOBAL variables that will be SET. 48 | #################################################################### 49 | 50 | statistics: 51 | #################################################################### 52 | # 5. Keymappings associated with statistics that will be ADDED. 53 | #################################################################### 54 | 55 | # Names used for collected statistics (ADDED). 56 | precision: precision 57 | recall: recall 58 | f1score: f1score 59 | 60 | 61 | -------------------------------------------------------------------------------- /configs/default/components/tasks/image_text_to_class/gqa.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the GQA task. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Folder where task will store data (LOADED) 8 | data_folder: '~/data/gqa' 9 | 10 | # Defines the set (split) that will be used (LOADED) 11 | # Options: training_0 | training | validation | test_dev | test | challenge | submission (?) 12 | # Note: test_dev should be used for validation. 13 | split: training_0 14 | 15 | # Flag indicating whether the task will load and return images (LOADED) 16 | stream_images: True 17 | 18 | # Resize parameter (LOADED) 19 | # When present, resizes the images from original size to [height, width] 20 | # Depth remains set to 3. 21 | resize_image: [224, 224] 22 | 23 | # Select applied image preprocessing/augmentations (LOADED) 24 | # Use one (or more) of the affine transformations: 25 | # none | normalize | all 26 | # Accepted formats: a,b,c or [a,b,c] 27 | image_preprocessing: none 28 | 29 | streams: 30 | #################################################################### 31 | # 2. Keymappings associated with INPUT and OUTPUT streams. 32 | #################################################################### 33 | 34 | # Stream containing batch of indices (OUTPUT) 35 | # Every task MUST return that stream. 36 | indices: indices 37 | 38 | # Stream containing batch of sample (original) identifiers (OUTPUT) 39 | sample_ids: sample_ids 40 | 41 | # Stream containing batch of images (OUTPUT) 42 | images: images 43 | 44 | # Stream containing batch of image names (OUTPUT) 45 | image_ids: image_ids 46 | 47 | # Stream containing batch of questions (OUTPUT) 48 | questions: questions 49 | 50 | # Stream containing targets answers (labels) (OUTPUT) 51 | answers: answers 52 | 53 | # Stream containing targets answers consisting of many words (OUTPUT) 54 | full_answers: full_answers 55 | 56 | # Stream containing scene descriptions (OUTPUT) 57 | #answers: scene_graphs 58 | 59 | globals: 60 | #################################################################### 61 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 62 | #################################################################### 63 | 64 | #################################################################### 65 | # 4. Keymappings associated with GLOBAL variables that will be SET. 66 | #################################################################### 67 | 68 | # Width of the image (SET) 69 | input_width: image_width 70 | # Height of the image (SET) 71 | input_height: image_height 72 | # Depth of the image (SET) 73 | input_depth: image_depth 74 | 75 | #################################################################### 76 | # 5. Keymappings associated with statistics that will be ADDED. 77 | #################################################################### 78 | -------------------------------------------------------------------------------- /configs/default/components/tasks/image_to_class/cifar_100.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the CIFAR-100 task. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Folder where task will store data (LOADED) 8 | data_folder: '~/data/cifar-100' 9 | 10 | # Defines the set that will be used used (LOADED) 11 | # True: training set | False: test set. 12 | use_train_data: True 13 | 14 | # Optional parameter (LOADED) 15 | # When present, resizes the CIFAR images from [32,32] to [width, height] 16 | #resize_image: [height, width] 17 | 18 | streams: 19 | #################################################################### 20 | # 2. Keymappings associated with INPUT and OUTPUT streams. 21 | #################################################################### 22 | 23 | # Stream containing batch of indices (OUTPUT) 24 | # Every task MUST return that stream. 25 | indices: indices 26 | 27 | # Stream containing batch of images (OUTPUT) 28 | images: images 29 | 30 | # Streams containing targets (label ids) (OUTPUT) 31 | coarse_targets: coarse_targets 32 | fine_targets: fine_targets 33 | 34 | # Streams containing labels (words) (OUTPUT) 35 | coarse_labels: coarse_labels 36 | fine_labels: fine_labels 37 | 38 | globals: 39 | #################################################################### 40 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 41 | #################################################################### 42 | 43 | #################################################################### 44 | # 4. Keymappings associated with GLOBAL variables that will be SET. 45 | #################################################################### 46 | 47 | # Width of the image (SET) 48 | input_width: image_width 49 | # Height of the image (SET) 50 | input_height: image_height 51 | # Depth of the image (SET) 52 | input_depth: image_depth 53 | 54 | # Numbers of output classes (SET) 55 | coarse_num_classes: coarse_num_classes 56 | fine_num_classes: fine_num_classes 57 | 58 | # Labels (word-idx) mappings (SET) 59 | coarse_label_word_mappings: coarse_label_word_mappings 60 | fine_label_word_mappings: fine_label_word_mappings 61 | 62 | #################################################################### 63 | # 5. Keymappings associated with statistics that will be ADDED. 64 | #################################################################### 65 | 66 | -------------------------------------------------------------------------------- /configs/default/components/tasks/image_to_class/mnist.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the MNIST task. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Folder where task will store data (LOADED) 8 | data_folder: '~/data/mnist' 9 | 10 | # Defines the set that will be used used (LOADED) 11 | # True: training set | False: test set. 12 | use_train_data: True 13 | 14 | # Optional parameter (LOADED) 15 | # When present, resizes the MNIST images from [28,28] to [width, height] 16 | #resize_image: [height, width] 17 | 18 | streams: 19 | #################################################################### 20 | # 2. Keymappings associated with INPUT and OUTPUT streams. 21 | #################################################################### 22 | 23 | # Stream containing batch of indices (OUTPUT) 24 | # Every task MUST return that stream. 25 | indices: indices 26 | 27 | # Stream containing batch of images (OUTPUT) 28 | inputs: inputs 29 | 30 | # Stream containing targets (label ids) (OUTPUT) 31 | targets: targets 32 | 33 | # Stream containing labels (words) (OUTPUT) 34 | labels: labels 35 | 36 | globals: 37 | #################################################################### 38 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 39 | #################################################################### 40 | 41 | #################################################################### 42 | # 4. Keymappings associated with GLOBAL variables that will be SET. 43 | #################################################################### 44 | 45 | # Width of the image (SET) 46 | input_width: image_width 47 | # Height of the image (SET) 48 | input_height: image_height 49 | # Depth of the image (SET) 50 | input_depth: image_depth 51 | 52 | # Number of output classes: 10 (SET) 53 | num_classes: num_classes 54 | # Label (word-idx) mappings (SET) 55 | label_word_mappings: label_word_mappings 56 | 57 | #################################################################### 58 | # 5. Keymappings associated with statistics that will be ADDED. 59 | #################################################################### 60 | 61 | -------------------------------------------------------------------------------- /configs/default/components/tasks/image_to_class/simple_molecules.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the MNIST task. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Folder where task will store data (LOADED) 8 | data_folder: '~/data/simple-molecules' 9 | 10 | # Defines the split that will be used used (LOADED) 11 | # Options: training | validation | test | test_mirror_blur | test_on_grid | test_handwritten 12 | split: training 13 | 14 | # Optional parameter (LOADED) 15 | # When present, resizes the MNIST images from [28,28] to [width, height] 16 | #resize_image: [height, width] 17 | 18 | # Depth of the retured image (LOADED) 19 | # Options: 1 | 3 20 | image_depth: 1 21 | 22 | streams: 23 | #################################################################### 24 | # 2. Keymappings associated with INPUT and OUTPUT streams. 25 | #################################################################### 26 | 27 | # Stream containing batch of indices (OUTPUT) 28 | # Every task MUST return that stream. 29 | indices: indices 30 | 31 | # Stream containing batch of images (OUTPUT) 32 | images: images 33 | 34 | # Stream containing targets (label ids) (OUTPUT) 35 | targets: targets 36 | 37 | # Stream containing labels (words) (OUTPUT) 38 | labels: labels 39 | 40 | globals: 41 | #################################################################### 42 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 43 | #################################################################### 44 | 45 | #################################################################### 46 | # 4. Keymappings associated with GLOBAL variables that will be SET. 47 | #################################################################### 48 | 49 | # Width of the image (SET) 50 | input_width: image_width 51 | # Height of the image (SET) 52 | input_height: image_height 53 | # Depth of the image (SET) 54 | input_depth: image_depth 55 | 56 | # Number of output classes: 10 (SET) 57 | num_classes: num_classes 58 | # Label (word-idx) mappings (SET) 59 | label_word_mappings: label_word_mappings 60 | 61 | #################################################################### 62 | # 5. Keymappings associated with statistics that will be ADDED. 63 | #################################################################### 64 | 65 | -------------------------------------------------------------------------------- /configs/default/components/tasks/text_to_class/dummy_language_identification.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the dummy language identification task. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Folder where task will store data (LOADED) 8 | data_folder: '~/data/language_identification/dummy' 9 | 10 | # Defines the set that will be used used (LOADED) 11 | # True: training set | False: test set. 12 | use_train_data: True 13 | 14 | # If set, task will always (re)generate data (LOADED) 15 | regenerate: False 16 | 17 | streams: 18 | #################################################################### 19 | # 2. Keymappings associated with INPUT and OUTPUT streams. 20 | #################################################################### 21 | 22 | # Stream containing batch of indices (OUTPUT) 23 | # Every task MUST return that stream. 24 | indices: indices 25 | 26 | # Stream containing batch of images (OUTPUT) 27 | inputs: inputs 28 | 29 | # Stream containing targets (label ids) (OUTPUT) 30 | targets: targets 31 | 32 | globals: 33 | #################################################################### 34 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 35 | #################################################################### 36 | 37 | #################################################################### 38 | # 4. Keymappings associated with GLOBAL variables that will be SET. 39 | #################################################################### 40 | 41 | #################################################################### 42 | # 5. Keymappings associated with statistics that will be ADDED. 43 | #################################################################### 44 | 45 | -------------------------------------------------------------------------------- /configs/default/components/tasks/text_to_class/wily_language_identification.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the WiLY language identification task. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Folder where task will store data (LOADED) 8 | data_folder: '~/data/language_identification/wily' 9 | 10 | # Defines the set that will be used used (LOADED) 11 | # True: training set | False: test set. 12 | use_train_data: True 13 | 14 | # If set, task will always (re)generate data (LOADED) 15 | regenerate: False 16 | 17 | streams: 18 | #################################################################### 19 | # 2. Keymappings associated with INPUT and OUTPUT streams. 20 | #################################################################### 21 | 22 | # Stream containing batch of indices (OUTPUT) 23 | # Every task MUST return that stream. 24 | indices: indices 25 | 26 | # Stream containing batch of images (OUTPUT) 27 | inputs: inputs 28 | 29 | # Stream containing targets (label ids) (OUTPUT) 30 | targets: targets 31 | 32 | globals: 33 | #################################################################### 34 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 35 | #################################################################### 36 | 37 | #################################################################### 38 | # 4. Keymappings associated with GLOBAL variables that will be SET. 39 | #################################################################### 40 | 41 | #################################################################### 42 | # 5. Keymappings associated with statistics that will be ADDED. 43 | #################################################################### 44 | 45 | -------------------------------------------------------------------------------- /configs/default/components/tasks/text_to_class/wily_ngram_language_modeling.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the ngram language modeling 2 | # using WiLY dataset. 3 | 4 | #################################################################### 5 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 6 | #################################################################### 7 | 8 | # Folder where task will store data (LOADED) 9 | data_folder: '~/data/language_identification/wily' 10 | 11 | # Defines the set that will be used used (LOADED) 12 | # True: training set | False: test set. 13 | use_train_data: True 14 | 15 | # Size of the context (LOADED) 16 | context: 2 17 | 18 | streams: 19 | #################################################################### 20 | # 2. Keymappings associated with INPUT and OUTPUT streams. 21 | #################################################################### 22 | 23 | # Stream containing batch of indices (OUTPUT) 24 | # Every task MUST return that stream. 25 | indices: indices 26 | 27 | # Stream containing batch of images (OUTPUT) 28 | inputs: inputs 29 | 30 | # Stream containing targets (label ids) (OUTPUT) 31 | targets: targets 32 | 33 | globals: 34 | #################################################################### 35 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 36 | #################################################################### 37 | 38 | #################################################################### 39 | # 4. Keymappings associated with GLOBAL variables that will be SET. 40 | #################################################################### 41 | 42 | #################################################################### 43 | # 5. Keymappings associated with statistics that will be ADDED. 44 | #################################################################### 45 | 46 | -------------------------------------------------------------------------------- /configs/default/components/tasks/text_to_text/translation_pairs.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the WikiText language modeling. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Folder where task will store data (LOADED) 8 | data_folder: ~/data/language_modeling/translation_pairs 9 | 10 | # Defines the dataset that will be used used (LOADED) 11 | # Options: eng-fra, eng-pol 12 | dataset: eng-fra 13 | 14 | # Defines the used subset (LOADED) 15 | # Options: train | valid | test 16 | subset: train 17 | 18 | # Length limit of source and target sentence 19 | # if < 0, no limit 20 | sentence_length: 10 21 | 22 | streams: 23 | #################################################################### 24 | # 2. Keymappings associated with INPUT and OUTPUT streams. 25 | #################################################################### 26 | 27 | # Stream containing batch of indices (OUTPUT) 28 | # Every task MUST return that stream. 29 | indices: indices 30 | 31 | # Stream containing batch of tokenized source sentences (OUTPUT) 32 | sources: sources 33 | 34 | # Stream containing batch of tokenized target sentences (OUTPUT) 35 | targets: targets 36 | 37 | globals: 38 | #################################################################### 39 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 40 | #################################################################### 41 | 42 | #################################################################### 43 | # 4. Keymappings associated with GLOBAL variables that will be SET. 44 | #################################################################### 45 | 46 | #################################################################### 47 | # 5. Keymappings associated with statistics that will be ADDED. 48 | #################################################################### 49 | 50 | -------------------------------------------------------------------------------- /configs/default/components/tasks/text_to_text/wikitext_language_modeling.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the WikiText language modeling. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Folder where task will store data (LOADED) 8 | data_folder: ~/data/language_modeling/wikitext 9 | 10 | # Defines the dataset that will be used used (LOADED) 11 | # Options: wikitext-2 | wikitext-103 12 | dataset: wikitext-2 13 | 14 | # Defines the used subset (LOADED) 15 | # Options: train | valid | test 16 | subset: train 17 | 18 | # Length of sentence (i.e. number of tokens in input and target sentences) 19 | sentence_length: 50 20 | 21 | streams: 22 | #################################################################### 23 | # 2. Keymappings associated with INPUT and OUTPUT streams. 24 | #################################################################### 25 | 26 | # Stream containing batch of indices (OUTPUT) 27 | # Every task MUST return that stream. 28 | indices: indices 29 | 30 | # Stream containing batch of tokenized source sentences (OUTPUT) 31 | sources: sources 32 | 33 | # Stream containing batch of tokenized target sentences (OUTPUT) 34 | targets: targets 35 | 36 | globals: 37 | #################################################################### 38 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 39 | #################################################################### 40 | 41 | #################################################################### 42 | # 4. Keymappings associated with GLOBAL variables that will be SET. 43 | #################################################################### 44 | 45 | #################################################################### 46 | # 5. Keymappings associated with statistics that will be ADDED. 47 | #################################################################### 48 | 49 | -------------------------------------------------------------------------------- /configs/default/components/transforms/concatenate_tensor.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the ConcatenateTensor. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # List of names of streams that will be concatenated (LOADED) 8 | # Can be string a single name or or comma separated string with list 9 | input_streams: '' 10 | 11 | # Dimensions of the input tensors (LOADED) 12 | # Specific to a task/model, must be set by user (no DEFAULT) 13 | # List of lists. 14 | # input_dims: [[BATCH x ...], ...] 15 | 16 | # Dimensions of the input tensor (LOADED) 17 | # Specific to a task/model, must be set by user (no DEFAULT) 18 | # output_dims: [BATCH x ...] 19 | 20 | # Dimension along which tensors will be concatenated (LOADED) 21 | dim: 1 22 | 23 | streams: 24 | #################################################################### 25 | # 2. Keymappings associated with INPUT and OUTPUT streams. 26 | #################################################################### 27 | 28 | # Stream containing output tensor (OUTPUT) 29 | outputs: outputs 30 | 31 | globals: 32 | #################################################################### 33 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 34 | #################################################################### 35 | 36 | #################################################################### 37 | # 4. Keymappings associated with GLOBAL variables that will be SET. 38 | #################################################################### 39 | 40 | # Size of the output tensor (SET) 41 | # (all dimensions except batch_size) 42 | output_size: output_size 43 | 44 | #################################################################### 45 | # 5. Keymappings associated with statistics that will be ADDED. 46 | #################################################################### 47 | 48 | -------------------------------------------------------------------------------- /configs/default/components/transforms/list_to_tensor.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the List to Tensor transformation. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Number of input dimensions, including last tensor (LOADED) 8 | num_inputs_dims: 1 9 | 10 | streams: 11 | #################################################################### 12 | # 2. Keymappings associated with INPUT and OUTPUT streams. 13 | #################################################################### 14 | 15 | # Stream containing input tensor (INPUT) 16 | inputs: inputs 17 | 18 | # Stream containing output tensor (OUTPUT) 19 | outputs: outputs 20 | 21 | globals: 22 | #################################################################### 23 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 24 | #################################################################### 25 | 26 | #################################################################### 27 | # 4. Keymappings associated with GLOBAL variables that will be SET. 28 | #################################################################### 29 | 30 | # Size of the intput_item (GET) 31 | # (last dimenstion) 32 | input_size: input_size 33 | 34 | #################################################################### 35 | # 5. Keymappings associated with statistics that will be ADDED. 36 | #################################################################### 37 | 38 | -------------------------------------------------------------------------------- /configs/default/components/transforms/non_linearity.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the NonLinearity. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Dimensions of the input tensor (LOADED) 8 | # Specific to a task/model, must be set by user (no DEFAULT) 9 | # input_dims: [BATCH x ....] 10 | 11 | # Dimensions of the input tensor (LOADED) 12 | # Specific to a task/model, must be set by user (no DEFAULT) 13 | # output_dims: [BATCH x ....] 14 | 15 | streams: 16 | #################################################################### 17 | # 2. Keymappings associated with INPUT and OUTPUT streams. 18 | #################################################################### 19 | 20 | # Stream containing input tensor (INPUT) 21 | inputs: inputs 22 | 23 | # Stream containing output tensor (OUTPUT) 24 | outputs: outputs 25 | 26 | globals: 27 | #################################################################### 28 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 29 | #################################################################### 30 | 31 | #################################################################### 32 | # 4. Keymappings associated with GLOBAL variables that will be SET. 33 | #################################################################### 34 | 35 | # Size of the output tensor (SET) 36 | # (all dimensions except batch_size) 37 | output_size: output_size 38 | 39 | #################################################################### 40 | # 5. Keymappings associated with statistics that will be ADDED. 41 | #################################################################### 42 | 43 | -------------------------------------------------------------------------------- /configs/default/components/transforms/reduce_tensor.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the ReduceTensor transformation. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Number of input dimensions, including batch (LOADED) 8 | num_inputs_dims: 2 9 | 10 | # Dimension along with the reduction will be applied (LOADED) 11 | reduction_dim: 1 12 | 13 | # Reduction type (LOADED) 14 | # Options: sum | mean | min | max | argmin | argmax 15 | reduction_type: sum 16 | 17 | # If True, the output tensor is of the same size as input, except dim where it is of size 1 (LOADED) 18 | keepdim: False 19 | 20 | streams: 21 | #################################################################### 22 | # 2. Keymappings associated with INPUT and OUTPUT streams. 23 | #################################################################### 24 | 25 | # Stream containing input tensor (INPUT) 26 | inputs: inputs 27 | 28 | # Stream containing output tensor (OUTPUT) 29 | outputs: outputs 30 | 31 | globals: 32 | #################################################################### 33 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 34 | #################################################################### 35 | 36 | # Size of the intput_item (GET) 37 | # (last dimenstion) 38 | input_size: input_size 39 | 40 | #################################################################### 41 | # 4. Keymappings associated with GLOBAL variables that will be SET. 42 | #################################################################### 43 | 44 | #################################################################### 45 | # 5. Keymappings associated with statistics that will be ADDED. 46 | #################################################################### 47 | 48 | -------------------------------------------------------------------------------- /configs/default/components/transforms/reshape_tensor.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the Tensor Reshaper. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Dimensions of the input tensor (LOADED) 8 | # Specific to a task/model, must be set by user (no DEFAULT) 9 | # input_dims: [BATCH x ....] 10 | 11 | # Dimensions of the input tensor (LOADED) 12 | # Specific to a task/model, must be set by user (no DEFAULT) 13 | # output_dims: [BATCH x ....] 14 | 15 | streams: 16 | #################################################################### 17 | # 2. Keymappings associated with INPUT and OUTPUT streams. 18 | #################################################################### 19 | 20 | # Stream containing input tensor (INPUT) 21 | inputs: inputs 22 | 23 | # Stream containing output tensor (OUTPUT) 24 | outputs: outputs 25 | 26 | globals: 27 | #################################################################### 28 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 29 | #################################################################### 30 | 31 | #################################################################### 32 | # 4. Keymappings associated with GLOBAL variables that will be SET. 33 | #################################################################### 34 | 35 | # Size of the output tensor (SET) 36 | # (all dimensions except batch_size) 37 | output_size: output_size 38 | 39 | #################################################################### 40 | # 5. Keymappings associated with statistics that will be ADDED. 41 | #################################################################### 42 | 43 | -------------------------------------------------------------------------------- /configs/default/components/viewers/image_viewer.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the ImageViewer. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # Number of sample that will be printed (LOADED) 8 | # Default: -1 (means random) 9 | sample_number: -1 10 | 11 | streams: 12 | #################################################################### 13 | # 2. Keymappings associated with INPUT and OUTPUT streams. 14 | #################################################################### 15 | 16 | # Stream containing inages (INPUT) 17 | images: images 18 | 19 | # Stream containing target labels (strings) (INPUT) 20 | label: labels 21 | 22 | # Stream containing predicted labels (strings) (INPUT) 23 | answers: answers 24 | 25 | 26 | globals: 27 | #################################################################### 28 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 29 | #################################################################### 30 | 31 | #################################################################### 32 | # 4. Keymappings associated with GLOBAL variables that will be SET. 33 | #################################################################### 34 | 35 | #################################################################### 36 | # 5. Keymappings associated with statistics that will be ADDED. 37 | #################################################################### 38 | 39 | -------------------------------------------------------------------------------- /configs/default/components/viewers/stream_viewer.yml: -------------------------------------------------------------------------------- 1 | # This file defines the default values for the Stream Viewer. 2 | 3 | #################################################################### 4 | # 1. CONFIGURATION PARAMETERS that will be LOADED by the component. 5 | #################################################################### 6 | 7 | # List of names of streams that will be displayed (LOADED) 8 | # Can be string a single name or or comma separated string with list 9 | input_streams: '' 10 | 11 | # Number of sample that will be printed (LOADED) 12 | # Default: -1 (means random) 13 | sample_number: -1 14 | 15 | streams: 16 | #################################################################### 17 | # 2. Keymappings associated with INPUT and OUTPUT streams. 18 | #################################################################### 19 | 20 | globals: 21 | #################################################################### 22 | # 3. Keymappings of variables that will be RETRIEVED from GLOBALS. 23 | #################################################################### 24 | 25 | #################################################################### 26 | # 4. Keymappings associated with GLOBAL variables that will be SET. 27 | #################################################################### 28 | 29 | #################################################################### 30 | # 5. Keymappings associated with statistics that will be ADDED. 31 | #################################################################### 32 | 33 | -------------------------------------------------------------------------------- /configs/default/workers/processor.yml: -------------------------------------------------------------------------------- 1 | #################################################################### 2 | # Section defining all the default values of parameters used during testing. 3 | # If you want to use different section during "processing" pass its name as command line argument '--section_name' to trainer (DEFAULT: test) 4 | # Note: the following parameters will be (anyway) used as default values. 5 | default_test: 6 | # Set the random seeds: -1 means that they will be picked randomly. 7 | seed_numpy: -1 8 | seed_torch: -1 9 | 10 | # Default batch size. 11 | batch_size: 64 12 | 13 | # Definition of the task (Mandatory!) 14 | #task: 15 | # One must define its type (Mandatory!) 16 | # type: ? 17 | # The rest of the content of that section is task-specific... 18 | 19 | # Set a default configuration section for data loader. 20 | dataloader: 21 | # Shuffle set by default. 22 | shuffle: True 23 | batch_sampler: None 24 | # Do not use multiprocessing by default. 25 | num_workers: 0 26 | pin_memory: False 27 | # Do not drop last frame by default. 28 | drop_last: False 29 | timeout: 0 30 | 31 | # Definition of sampler (Optional) 32 | # When this section will not be present, worker will use "standard" sampling (please refer to shuffle in dataloader) 33 | #sampler: 34 | # # Type - generally all samplers from PyTorch (plus some new onses) are allowed (Mandatory!) 35 | # # Options: 36 | # type: RandomSampler 37 | # The rest of the content of that section is optimizer-specific... 38 | 39 | # Terminal condition that will be used during processing. 40 | terminal_conditions: 41 | # Terminal condition : maximal number of episodes (Optional, -1 means that processor will perform one pass over the whole dataset/split) 42 | episode_limit: -1 43 | 44 | 45 | #################################################################### 46 | # Section defining all the default values of parameters used during training. 47 | # If you want to use different section for validation pass its name as command line argument '--pipeline_section_name' to trainer (DEFAULT: pipeline) 48 | pipeline: 49 | # Pipeline must contain at least one component. 50 | #name_1: 51 | # Each component must have defined its priority... (Mandatory!) 52 | # priority: 0.1 # Can be float. Smaller means higher priority, up to zero. 53 | # # ... and type (Mandatory!) 54 | # type: ? 55 | # The rest of the content of that section is component-specific... 56 | -------------------------------------------------------------------------------- /configs/mnist/default_mnist.yml: -------------------------------------------------------------------------------- 1 | # Training parameters: 2 | training: 3 | task: 4 | type: MNIST 5 | batch_size: &b 64 6 | use_train_data: True 7 | #resize: [32, 32] 8 | # Use sampler that operates on a subset. 9 | sampler: 10 | type: SubsetRandomSampler 11 | indices: [0, 55000] 12 | # optimizer parameters: 13 | optimizer: 14 | type: Adam 15 | lr: 0.0001 16 | # settings parameters 17 | terminal_conditions: 18 | loss_stop_threshold: 0.05 19 | early_stop_validations: -1 20 | episode_limit: 10000 21 | epoch_limit: 10 22 | 23 | # Validation parameters: 24 | validation: 25 | #partial_validation_interval: 100 26 | task: 27 | type: MNIST 28 | batch_size: *b 29 | use_train_data: True # True because we are splitting the training set to: validation and training 30 | #resize: [32, 32] 31 | # Use sampler that operates on a subset. 32 | sampler: 33 | type: SubsetRandomSampler 34 | indices: [55000, 60000] 35 | 36 | # Testing parameters: 37 | test: 38 | task: 39 | type: MNIST 40 | batch_size: *b 41 | use_train_data: False 42 | #resize: [32, 32] 43 | 44 | pipeline: 45 | disable: image_viewer 46 | 47 | # Loss 48 | nllloss: 49 | type: NLLLoss 50 | priority: 10.0 51 | 52 | # Statistics. 53 | batch_size: 54 | priority: 100.0 55 | type: BatchSizeStatistics 56 | 57 | accuracy: 58 | priority: 100.1 59 | type: AccuracyStatistics 60 | 61 | 62 | precision_recall: 63 | priority: 100.2 64 | type: PrecisionRecallStatistics 65 | use_word_mappings: True 66 | show_class_scores: True 67 | globals: 68 | word_mappings: label_word_mappings 69 | 70 | answer_decoder: 71 | priority: 100.3 72 | type: WordDecoder 73 | import_word_mappings_from_globals: True 74 | globals: 75 | word_mappings: label_word_mappings 76 | streams: 77 | inputs: predictions 78 | outputs: answers 79 | 80 | stream_viewer: 81 | priority: 100.4 82 | type: StreamViewer 83 | input_streams: labels, answers 84 | 85 | image_viewer: 86 | priority: 100.5 87 | type: ImageViewer 88 | streams: 89 | images: inputs 90 | labels: labels 91 | answers: answers 92 | 93 | -------------------------------------------------------------------------------- /configs/mnist/mnist_classification_convnet_softmax.yml: -------------------------------------------------------------------------------- 1 | # Load config defining MNIST tasks for training, validation and testing. 2 | default_configs: mnist/default_mnist.yml 3 | 4 | pipeline: 5 | 6 | # Model consisting of two components. 7 | image_encoder: 8 | type: ConvNetEncoder 9 | priority: 1 10 | 11 | # Reshape inputs 12 | reshaper: 13 | type: ReshapeTensor 14 | input_dims: [-1, 16, 1, 1] 15 | output_dims: [-1, 16] 16 | priority: 2 17 | streams: 18 | inputs: feature_maps 19 | outputs: reshaped_maps 20 | globals: 21 | output_size: reshaped_maps_size 22 | 23 | # Image classifier. 24 | classifier: 25 | type: FeedForwardNetwork 26 | priority: 3 27 | streams: 28 | inputs: reshaped_maps 29 | globals: 30 | input_size: reshaped_maps_size 31 | prediction_size: num_classes 32 | 33 | #: pipeline 34 | -------------------------------------------------------------------------------- /configs/mnist/mnist_classification_kfold_softmax.yml: -------------------------------------------------------------------------------- 1 | # Load config defining MNIST tasks for training, validation and testing. 2 | default_configs: mnist/default_mnist.yml 3 | 4 | # Training parameters: 5 | training: 6 | task: 7 | type: MNIST 8 | batch_size: &b 64 9 | use_train_data: True 10 | # Use k-fold cross-validation random sampler. 11 | sampler: 12 | type: kFoldRandomSampler 13 | folds: 10 # Each with size of 6000 14 | # optimizer parameters: 15 | optimizer: 16 | type: Adam 17 | lr: 0.0001 18 | # settings parameters 19 | terminal_conditions: 20 | loss_stop_threshold: 0.5 21 | episode_limit: 10000 22 | epoch_limit: 5 23 | 24 | # Validation parameters: 25 | validation: 26 | partial_validation_interval: 500 27 | task: 28 | type: MNIST 29 | batch_size: *b 30 | use_train_data: True # True because we are splitting the training set to: validation and training 31 | # Use k-fold cross-validation random sampler. 32 | sampler: 33 | type: kFoldRandomSampler 34 | folds: 10 # Each with size of 6000 35 | 36 | pipeline: 37 | 38 | # Reshapes tensors. 39 | reshaper: 40 | type: ReshapeTensor 41 | input_dims: [-1, 1, 28, 28] 42 | output_dims: [-1, 784] 43 | priority: 1 44 | streams: 45 | outputs: reshaped_images 46 | globals: 47 | output_size: reshaped_image_size 48 | 49 | # Classifier. 50 | classifier: 51 | type: FeedForwardNetwork 52 | priority: 2 53 | dropout_rate: 0.1 54 | hidden_sizes: [100, 100] 55 | streams: 56 | inputs: reshaped_images 57 | globals: 58 | input_size: reshaped_image_size 59 | prediction_size: num_classes 60 | 61 | #: pipeline 62 | -------------------------------------------------------------------------------- /configs/mnist/mnist_classification_lenet5.yml: -------------------------------------------------------------------------------- 1 | # Load config defining MNIST tasks for training, validation and testing. 2 | default_configs: mnist/default_mnist.yml 3 | 4 | # Training parameters - overwrite defaults: 5 | training: 6 | task: 7 | resize_image: [32, 32] 8 | 9 | # Validation parameters - overwrite defaults: 10 | validation: 11 | task: 12 | resize_image: [32, 32] 13 | 14 | # Testing parameters - overwrite defaults: 15 | test: 16 | task: 17 | resize_image: [32, 32] 18 | 19 | # Definition of the pipeline. 20 | pipeline: 21 | 22 | # Image classifier. 23 | image_classifier: 24 | type: LeNet5 25 | priority: 1 26 | globals: 27 | prediction_size: num_classes 28 | 29 | #: pipeline 30 | -------------------------------------------------------------------------------- /configs/mnist/mnist_classification_softmax.yml: -------------------------------------------------------------------------------- 1 | # Load config defining MNIST tasks for training, validation and testing. 2 | default_configs: mnist/default_mnist.yml 3 | 4 | pipeline: 5 | 6 | # Reshapes tensors. 7 | reshaper: 8 | type: ReshapeTensor 9 | input_dims: [-1, 1, 28, 28] 10 | output_dims: [-1, 784] 11 | priority: 1 12 | streams: 13 | outputs: reshaped_images 14 | globals: 15 | output_size: reshaped_image_size 16 | 17 | # Classifier. 18 | classifier: 19 | type: FeedForwardNetwork 20 | priority: 2 21 | dropout_rate: 0.1 22 | hidden_sizes: [100, 100] 23 | streams: 24 | inputs: reshaped_images 25 | globals: 26 | input_size: reshaped_image_size 27 | prediction_size: num_classes 28 | 29 | #: pipeline 30 | -------------------------------------------------------------------------------- /configs/molecule_classification/default_molecule_classification.yml: -------------------------------------------------------------------------------- 1 | # Training parameters: 2 | training: 3 | task: 4 | type: SimpleMolecules 5 | batch_size: &b 64 6 | split: training 7 | resize_image: [87, 87] 8 | # Resizing slows down the batch generation, so let's use many dataloaders. 9 | dataloader: 10 | num_workers: 4 11 | 12 | optimizer: 13 | type: Adam 14 | lr: 0.0001 15 | # settings parameters 16 | terminal_conditions: 17 | loss_stop_threshold: 0.15 18 | early_stop_validations: -1 19 | episode_limit: 10000 20 | epoch_limit: 10 21 | 22 | # Validation parameters: 23 | validation: 24 | task: 25 | type: SimpleMolecules 26 | batch_size: *b 27 | split: validation 28 | resize_image: [87, 87] 29 | dataloader: 30 | num_workers: 4 31 | 32 | # Testing parameters: 33 | test: 34 | task: 35 | type: SimpleMolecules 36 | batch_size: *b 37 | split: test 38 | resize_image: [87, 87] 39 | dataloader: 40 | num_workers: 4 41 | 42 | test_mirror_blur: 43 | task: 44 | type: SimpleMolecules 45 | batch_size: *b 46 | split: test_mirror_blur 47 | resize_image: [87, 87] 48 | dataloader: 49 | num_workers: 4 50 | 51 | test_on_grid: 52 | task: 53 | type: SimpleMolecules 54 | batch_size: *b 55 | split: test_on_grid 56 | resize_image: [87, 87] 57 | dataloader: 58 | num_workers: 4 59 | 60 | test_handwritten: 61 | task: 62 | type: SimpleMolecules 63 | batch_size: *b 64 | split: test_handwritten 65 | resize_image: [87, 87] 66 | dataloader: 67 | num_workers: 4 68 | 69 | 70 | # Default components shared between all molecule classification pipelines. 71 | pipeline: 72 | #disable: image_viewer 73 | 74 | # Loss 75 | nllloss: 76 | type: NLLLoss 77 | priority: 4 78 | streams: 79 | targets: targets 80 | predictions: predictions 81 | 82 | accuracy: 83 | priority: 5 84 | type: AccuracyStatistics 85 | streams: 86 | targets: targets 87 | predictions: predictions 88 | 89 | answer_decoder: 90 | priority: 6 91 | type: WordDecoder 92 | import_word_mappings_from_globals: True 93 | globals: 94 | word_mappings: label_word_mappings 95 | streams: 96 | inputs: predictions 97 | outputs: predicted_answers 98 | 99 | stream_viewer: 100 | priority: 7 101 | type: StreamViewer 102 | input_streams: labels, targets, predictions, predicted_answers 103 | 104 | image_viewer: 105 | priority: 100.5 106 | type: ImageViewer 107 | streams: 108 | images: images 109 | labels: labels 110 | answers: predicted_answers 111 | 112 | -------------------------------------------------------------------------------- /configs/molecule_classification/molecule_classification_convnet_softmax.yml: -------------------------------------------------------------------------------- 1 | # Load config defining MNIST tasks for training, validation and testing. 2 | default_configs: molecule_classification/default_molecule_classification.yml 3 | 4 | # Pipeline - only the model-related components. 5 | pipeline: 6 | # Model 1: 3 CNN layers. 7 | image_encoder: 8 | type: ConvNetEncoder 9 | priority: 1 10 | # Using default stream names, so the following could be removed (leaving it just for the clarity though). 11 | streams: 12 | inputs: images 13 | feature_maps: feature_maps 14 | 15 | # Reshape inputs 16 | reshaper: 17 | type: ReshapeTensor 18 | # TODO: change! 19 | #input_dims: [-1, 16, 107, 107] 20 | #output_dims: [-1, 183184] 21 | input_dims: [-1, 16, 9, 9] 22 | output_dims: [-1, 1296] 23 | priority: 2 24 | streams: 25 | inputs: feature_maps 26 | outputs: reshaped_maps 27 | globals: 28 | output_size: reshaped_maps_size 29 | 30 | # Model 2: 1 Fully connected layer with softmax acitvation. 31 | classifier: 32 | type: FeedForwardNetwork 33 | priority: 3 34 | streams: 35 | inputs: reshaped_maps 36 | # Using default stream name, so the following could be removed (leaving it just for the clarity though). 37 | predictions: predictions 38 | globals: 39 | input_size: reshaped_maps_size 40 | prediction_size: num_classes 41 | 42 | #: pipeline 43 | -------------------------------------------------------------------------------- /configs/molecule_classification/molecule_classification_vgg16_molecules.yml: -------------------------------------------------------------------------------- 1 | # Load config defining MNIST tasks for training, validation and testing. 2 | default_configs: molecule_classification/default_molecule_classification.yml 3 | 4 | # Overrride some training parameters: 5 | training: 6 | task: 7 | resize_image: [224, 224] 8 | image_depth: 3 9 | 10 | # Override some validation parameters: 11 | validation: 12 | task: 13 | resize_image: [224, 224] 14 | image_depth: 3 15 | 16 | # Override some test parameters: 17 | test: 18 | task: 19 | resize_image: [224, 224] 20 | image_depth: 3 21 | 22 | test_mirror_blur: 23 | task: 24 | resize_image: [224, 224] 25 | image_depth: 3 26 | 27 | test_on_grid: 28 | task: 29 | resize_image: [224, 224] 30 | image_depth: 3 31 | 32 | test_handwritten: 33 | task: 34 | resize_image: [224, 224] 35 | image_depth: 3 36 | 37 | 38 | # Pipeline - only the model-related components. 39 | pipeline: 40 | 41 | # Model 1: VGG 42 | image_encoder: 43 | type: GenericImageEncoder 44 | pretrained: False 45 | priority: 1 46 | # Using default stream names, so the following could be removed (leaving it just for the clarity though). 47 | streams: 48 | inputs: images 49 | outputs: vgg_images 50 | globals: 51 | output_size: num_classes 52 | 53 | 54 | # Model 2: 1 Fully connected layer with softmax acitvation. 55 | classifier: 56 | type: FeedForwardNetwork 57 | priority: 3 58 | streams: 59 | inputs: vgg_images 60 | # Using default stream name, so the following could be removed (leaving it just for the clarity though). 61 | predictions: predictions 62 | globals: 63 | input_size: num_classes 64 | prediction_size: num_classes 65 | 66 | #: pipeline 67 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c1_classification/c1_classification_all_bow_vgg16_concat.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c1_classification/default_c1_classification.yml 3 | 4 | pipeline: 5 | 6 | global_publisher: 7 | type: GlobalVariablePublisher 8 | priority: 0 9 | # Add input_size to globals. 10 | keys: [image_size_encoder_input_size, image_size_encoder_output_size, image_encoder_output_size] 11 | values: [2, 10, 100] 12 | 13 | # First subpipeline: question. 14 | # Questions encoding. 15 | question_tokenizer: 16 | type: SentenceTokenizer 17 | priority: 1.1 18 | streams: 19 | inputs: questions 20 | outputs: tokenized_questions 21 | 22 | question_onehot_encoder: 23 | type: SentenceOneHotEncoder 24 | priority: 1.2 25 | data_folder: ~/data/vqa-med 26 | word_mappings_file: questions.all.word.mappings.csv 27 | export_word_mappings_to_globals: True 28 | streams: 29 | inputs: tokenized_questions 30 | outputs: encoded_questions 31 | globals: 32 | vocabulary_size: question_vocabulary_size 33 | 34 | question_bow_encoder: 35 | type: BOWEncoder 36 | priority: 1.3 37 | streams: 38 | inputs: encoded_questions 39 | outputs: question_activations 40 | globals: 41 | bow_size: question_vocabulary_size 42 | 43 | 44 | # 2nd subpipeline: image size. 45 | # Model - image size classifier. 46 | image_size_encoder: 47 | type: FeedForwardNetwork 48 | priority: 2.1 49 | streams: 50 | inputs: image_sizes 51 | predictions: image_size_activations 52 | globals: 53 | input_size: image_size_encoder_input_size 54 | prediction_size: image_size_encoder_output_size 55 | 56 | # 3rd subpipeline: image. 57 | # Image encoder. 58 | image_encoder: 59 | type: GenericImageEncoder 60 | priority: 3.1 61 | streams: 62 | inputs: images 63 | outputs: image_activations 64 | globals: 65 | output_size: image_encoder_output_size 66 | 67 | # 4th subpipeline: concatenation + FF. 68 | concat: 69 | type: ConcatenateTensor 70 | priority: 4.1 71 | input_streams: [question_activations,image_size_activations,image_activations] 72 | # ConcatenateTensor 73 | dim: 1 # default 74 | input_dims: [[-1,99],[-1,10],[-1,100]] 75 | output_dims: [-1,209] 76 | streams: 77 | outputs: concatenated_activations 78 | globals: 79 | output_size: output_size 80 | 81 | 82 | classifier: 83 | type: FeedForwardNetwork 84 | hidden_sizes: [100] 85 | priority: 4.2 86 | streams: 87 | inputs: concatenated_activations 88 | globals: 89 | input_size: output_size 90 | prediction_size: vocabulary_size_c1 91 | 92 | 93 | #: pipeline 94 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c1_classification/c1_classification_image_cnn_softmax.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c1_classification/default_c1_classification.yml 3 | 4 | pipeline: 5 | 6 | # Image encoder. 7 | image_encoder: 8 | type: ConvNetEncoder 9 | priority: 1.1 10 | streams: 11 | inputs: images 12 | 13 | # Reshape inputs 14 | reshaper: 15 | type: ReshapeTensor 16 | input_dims: [-1, 16, 26, 26] 17 | output_dims: [-1, 10816] 18 | priority: 1.2 19 | streams: 20 | inputs: feature_maps 21 | outputs: reshaped_maps 22 | globals: 23 | output_size: reshaped_maps_size 24 | 25 | # Model - softmax classifier. 26 | classifier: 27 | type: FeedForwardNetwork 28 | hidden_sizes: [1000] 29 | priority: 3 30 | streams: 31 | inputs: reshaped_maps 32 | globals: 33 | input_size: reshaped_maps_size 34 | prediction_size: vocabulary_size_c1 35 | 36 | #: pipeline 37 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c1_classification/c1_classification_image_size_softmax.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c1_classification/default_c1_classification.yml 3 | 4 | pipeline: 5 | 6 | global_publisher: 7 | type: GlobalVariablePublisher 8 | priority: 1 9 | # Add input_size to globals, so classifier will use it. 10 | keys: input_size 11 | values: 2 12 | 13 | # Model - image size classifier. 14 | classifier: 15 | type: FeedForwardNetwork 16 | hidden_sizes: [100] 17 | priority: 3 18 | streams: 19 | inputs: image_sizes 20 | globals: 21 | prediction_size: vocabulary_size_c1 22 | 23 | #: pipeline 24 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c1_classification/c1_classification_question_mimic_rnn.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c1_classification/default_c1_classification.yml 3 | 4 | pipeline: 5 | 6 | # Questions encoding. 7 | question_tokenizer: 8 | type: SentenceTokenizer 9 | priority: 1.1 10 | streams: 11 | inputs: questions 12 | outputs: tokenized_questions 13 | 14 | # Model 1: Embeddings 15 | question_embeddings: 16 | type: SentenceEmbeddings 17 | priority: 1.2 18 | embeddings_size: 300 19 | pretrained_embeddings_file: mimic.fastText.no_clean.300d.pickled 20 | data_folder: ~/data/vqa-med 21 | word_mappings_file: questions.all.word.mappings.csv 22 | streams: 23 | inputs: tokenized_questions 24 | outputs: embedded_questions 25 | 26 | # Model 2: RNN 27 | lstm: 28 | type: RecurrentNeuralNetwork 29 | cell_type: LSTM 30 | prediction_mode: Last 31 | priority: 3 32 | initial_state: Zero 33 | #num_layers: 5 34 | hidden_size: 50 35 | streams: 36 | inputs: embedded_questions 37 | globals: 38 | input_size: embeddings_size 39 | prediction_size: vocabulary_size_c1 40 | 41 | #: pipeline 42 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c1_classification/c1_classification_question_onehot_bow.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c1_classification/default_c1_classification.yml 3 | 4 | pipeline: 5 | 6 | # Questions encoding. 7 | question_tokenizer: 8 | type: SentenceTokenizer 9 | priority: 1.1 10 | streams: 11 | inputs: questions 12 | outputs: tokenized_questions 13 | 14 | question_onehot_encoder: 15 | type: SentenceOneHotEncoder 16 | priority: 1.2 17 | data_folder: ~/data/vqa-med 18 | word_mappings_file: questions.all.word.mappings.csv 19 | export_word_mappings_to_globals: True 20 | streams: 21 | inputs: tokenized_questions 22 | outputs: encoded_questions 23 | globals: 24 | vocabulary_size: question_vocabulary_size 25 | 26 | question_bow_encoder: 27 | type: BOWEncoder 28 | priority: 1.3 29 | streams: 30 | inputs: encoded_questions 31 | outputs: bow_questions 32 | globals: 33 | bow_size: question_vocabulary_size 34 | 35 | # Model 36 | classifier: 37 | type: FeedForwardNetwork 38 | hidden_sizes: [100, 100] 39 | priority: 3 40 | streams: 41 | inputs: bow_questions 42 | globals: 43 | input_size: question_vocabulary_size 44 | prediction_size: vocabulary_size_c1 45 | 46 | #: pipeline 47 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c1_classification/c1_classification_question_rnn.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c1_classification/default_c1_classification.yml 3 | 4 | pipeline: 5 | 6 | # Questions encoding. 7 | question_tokenizer: 8 | type: SentenceTokenizer 9 | priority: 1.1 10 | streams: 11 | inputs: questions 12 | outputs: tokenized_questions 13 | 14 | # Model 1: Embeddings 15 | question_embeddings: 16 | type: SentenceEmbeddings 17 | priority: 1.2 18 | embeddings_size: 50 19 | pretrained_embeddings_file: glove.6B.50d.txt 20 | data_folder: ~/data/vqa-med 21 | word_mappings_file: questions.all.word.mappings.csv 22 | streams: 23 | inputs: tokenized_questions 24 | outputs: embedded_questions 25 | 26 | # Model 2: RNN 27 | lstm: 28 | type: RecurrentNeuralNetwork 29 | cell_type: LSTM 30 | prediction_mode: Last 31 | priority: 3 32 | initial_state: Zero 33 | #num_layers: 5 34 | hidden_size: 50 35 | streams: 36 | inputs: embedded_questions 37 | globals: 38 | input_size: embeddings_size 39 | prediction_size: vocabulary_size_c1 40 | 41 | #: pipeline 42 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c1_classification/default_c1_classification.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/default_vqa_med_2019.yml 3 | 4 | # Training parameters: 5 | training: 6 | task: 7 | categories: C1 8 | export_sample_weights: ~/data/vqa-med/answers.c1.weights.csv 9 | sampler: 10 | weights: ~/data/vqa-med/answers.c1.weights.csv 11 | 12 | # Validation parameters: 13 | validation: 14 | task: 15 | categories: C1 16 | 17 | 18 | pipeline: 19 | 20 | # Answer encoding. 21 | answer_indexer: 22 | type: LabelIndexer 23 | priority: 0.1 24 | data_folder: ~/data/vqa-med 25 | word_mappings_file: answers.c1.word.mappings.csv 26 | # Export mappings and size to globals. 27 | export_word_mappings_to_globals: True 28 | streams: 29 | inputs: answers 30 | outputs: answers_ids 31 | globals: 32 | vocabulary_size: vocabulary_size_c1 33 | word_mappings: word_mappings_c1 34 | 35 | 36 | # Predictions decoder. 37 | prediction_decoder: 38 | type: WordDecoder 39 | priority: 10.1 40 | # Use the same word mappings as label indexer. 41 | import_word_mappings_from_globals: True 42 | streams: 43 | inputs: predictions 44 | outputs: predicted_answers 45 | globals: 46 | vocabulary_size: vocabulary_size_c1 47 | word_mappings: word_mappings_c1 48 | 49 | # Loss 50 | nllloss: 51 | type: NLLLoss 52 | priority: 10.2 53 | targets_dim: 1 54 | streams: 55 | targets: answers_ids 56 | loss: loss 57 | 58 | # Statistics. 59 | batch_size: 60 | type: BatchSizeStatistics 61 | priority: 100.1 62 | 63 | #accuracy: 64 | # type: AccuracyStatistics 65 | # priority: 100.2 66 | # streams: 67 | # targets: answers_ids 68 | 69 | precision_recall: 70 | type: PrecisionRecallStatistics 71 | priority: 100.3 72 | use_word_mappings: True 73 | show_class_scores: True 74 | show_confusion_matrix: True 75 | streams: 76 | targets: answers_ids 77 | globals: 78 | word_mappings: word_mappings_c1 79 | num_classes: vocabulary_size_c1 80 | 81 | # Viewers. 82 | viewer: 83 | type: StreamViewer 84 | priority: 100.4 85 | input_streams: questions,category_names,answers,predicted_answers 86 | 87 | #: pipeline 88 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c2_classification/c2_class_lstm_selfattn.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c2_classification/default_c2_classification.yml 3 | 4 | training: 5 | task: 6 | batch_size: 48 7 | # Appy all preprocessing/data augmentations. 8 | question_preprocessing: lowercase,remove_punctuation,tokenize 9 | streams: 10 | # Task is returning tokenized questions. 11 | questions: tokenized_questions 12 | 13 | validation: 14 | task: 15 | batch_size: 48 16 | # Appy all preprocessing/data augmentations. 17 | question_preprocessing: lowercase,remove_punctuation,tokenize 18 | streams: 19 | # Task is returning tokenized questions. 20 | questions: tokenized_questions 21 | 22 | 23 | pipeline: 24 | 25 | global_publisher: 26 | priority: 0 27 | type: GlobalVariablePublisher 28 | # Add input_size to globals. 29 | keys: [question_encoder_output_size, attention_activation_size] 30 | values: [100, 400] 31 | 32 | ################# PIPE 0: question ################# 33 | 34 | # Model 1: Embeddings 35 | question_embeddings: 36 | priority: 1.2 37 | type: SentenceEmbeddings 38 | embeddings_size: 100 39 | pretrained_embeddings_file: glove.6B.100d.txt 40 | data_folder: ~/data/vqa-med 41 | word_mappings_file: questions.all.word.mappings.csv 42 | streams: 43 | inputs: tokenized_questions 44 | outputs: embedded_questions 45 | 46 | # Model 2: RNN 47 | question_lstm: 48 | priority: 1.3 49 | type: RecurrentNeuralNetwork 50 | cell_type: LSTM 51 | prediction_mode: Dense 52 | use_logsoftmax: False 53 | output_last_state: False 54 | initial_state: Trainable 55 | dropout_rate: 0.1 56 | hidden_size: 50 57 | streams: 58 | inputs: embedded_questions 59 | predictions: question_activations 60 | globals: 61 | input_size: embeddings_size 62 | prediction_size: question_encoder_output_size 63 | 64 | ################# PIPE 3: question attention ################# 65 | # Self Attention for question. 66 | question_attention: 67 | priority: 4.1 68 | type: SelfAttention 69 | latent_size: 128 70 | num_attention_heads: 4 71 | streams: 72 | question_encodings: question_activations 73 | outputs: question_attention_activations 74 | globals: 75 | question_encoding_size: question_encoder_output_size 76 | output_size: attention_activation_size 77 | 78 | classifier: 79 | priority: 5.1 80 | type: FeedForwardNetwork 81 | hidden_sizes: [100] 82 | dropout_rate: 0.5 83 | streams: 84 | inputs: question_attention_activations 85 | globals: 86 | input_size: attention_activation_size 87 | prediction_size: vocabulary_size_c2 88 | 89 | 90 | #: pipeline 91 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c2_classification/c2_classification_all_rnn_vgg16_ewm.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c2_classification/default_c2_classification.yml 3 | 4 | pipeline: 5 | 6 | global_publisher: 7 | priority: 0 8 | type: GlobalVariablePublisher 9 | # Add input_size to globals. 10 | keys: [question_encoder_output_size, image_encoder_output_size, element_wise_activation_size] 11 | values: [100, 100, 100] 12 | 13 | ################# PIPE 0: question ################# 14 | # Questions encoding. 15 | question_tokenizer: 16 | priority: 1.1 17 | type: SentenceTokenizer 18 | streams: 19 | inputs: questions 20 | outputs: tokenized_questions 21 | 22 | # Model 1: Embeddings 23 | question_embeddings: 24 | priority: 1.2 25 | type: SentenceEmbeddings 26 | embeddings_size: 50 27 | pretrained_embeddings_file: glove.6B.50d.txt 28 | data_folder: ~/data/vqa-med 29 | word_mappings_file: questions.all.word.mappings.csv 30 | streams: 31 | inputs: tokenized_questions 32 | outputs: embedded_questions 33 | 34 | # Model 2: RNN 35 | question_lstm: 36 | priority: 1.3 37 | type: RecurrentNeuralNetwork 38 | cell_type: LSTM 39 | prediction_mode: Last 40 | use_logsoftmax: False 41 | initial_state: Zero 42 | hidden_size: 50 43 | streams: 44 | inputs: embedded_questions 45 | predictions: question_activations 46 | globals: 47 | input_size: embeddings_size 48 | prediction_size: question_encoder_output_size 49 | 50 | ################# PIPE 2: image ################# 51 | # Image encoder. 52 | image_encoder: 53 | priority: 3.1 54 | type: GenericImageEncoder 55 | streams: 56 | inputs: images 57 | outputs: image_activations 58 | globals: 59 | output_size: image_encoder_output_size 60 | 61 | ################# PIPE 3: fusion + classification ################# 62 | # Element wise multiplication + FF. 63 | question_image_fusion: 64 | priority: 4.1 65 | type: LowRankBilinearPooling 66 | dropout_rate: 0.5 67 | streams: 68 | image_encodings: image_activations 69 | question_encodings: question_activations 70 | outputs: element_wise_activations 71 | globals: 72 | image_encoding_size: image_encoder_output_size 73 | question_encoding_size: question_encoder_output_size 74 | output_size: element_wise_activation_size 75 | 76 | classifier: 77 | priority: 4.2 78 | type: FeedForwardNetwork 79 | hidden_sizes: [100] 80 | dropout_rate: 0.5 81 | streams: 82 | inputs: element_wise_activations 83 | globals: 84 | input_size: element_wise_activation_size 85 | prediction_size: vocabulary_size_c2 86 | 87 | #: pipeline 88 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c2_classification/c2_classification_all_rnn_vgg16_mcb.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c2_classification/default_c2_classification.yml 3 | 4 | pipeline: 5 | 6 | global_publisher: 7 | priority: 0 8 | type: GlobalVariablePublisher 9 | # Add input_size to globals. 10 | keys: [question_encoder_output_size, image_encoder_output_size, fused_image_question_activation_size] 11 | values: [200, 500, 100] 12 | 13 | ################# PIPE 0: question ################# 14 | # Questions encoding. 15 | question_tokenizer: 16 | priority: 1.1 17 | type: SentenceTokenizer 18 | streams: 19 | inputs: questions 20 | outputs: tokenized_questions 21 | 22 | # Model 1: Embeddings 23 | question_embeddings: 24 | priority: 1.2 25 | type: SentenceEmbeddings 26 | embeddings_size: 50 27 | pretrained_embeddings_file: glove.6B.50d.txt 28 | data_folder: ~/data/vqa-med 29 | word_mappings_file: questions.all.word.mappings.csv 30 | streams: 31 | inputs: tokenized_questions 32 | outputs: embedded_questions 33 | 34 | # Model 2: RNN 35 | question_lstm: 36 | priority: 1.3 37 | type: RecurrentNeuralNetwork 38 | cell_type: LSTM 39 | prediction_mode: Last 40 | use_logsoftmax: False 41 | initial_state: Zero 42 | hidden_size: 50 43 | streams: 44 | inputs: embedded_questions 45 | predictions: question_activations 46 | globals: 47 | input_size: embeddings_size 48 | prediction_size: question_encoder_output_size 49 | 50 | ################# PIPE 2: image ################# 51 | # Image encoder. 52 | image_encoder: 53 | priority: 3.1 54 | type: GenericImageEncoder 55 | streams: 56 | inputs: images 57 | outputs: image_activations 58 | globals: 59 | output_size: image_encoder_output_size 60 | 61 | ################# PIPE 3: fusion + classification ################# 62 | # Element wise multiplication + FF. 63 | question_image_fusion: 64 | priority: 4.1 65 | type: CompactBilinearPooling 66 | streams: 67 | image_encodings: image_activations 68 | question_encodings: question_activations 69 | outputs: fused_image_question_activations 70 | globals: 71 | image_encoding_size: image_encoder_output_size 72 | question_encoding_size: question_encoder_output_size 73 | output_size: fused_image_question_activation_size 74 | 75 | classifier: 76 | priority: 4.2 77 | type: FeedForwardNetwork 78 | hidden_sizes: [100] 79 | dropout_rate: 0.5 80 | streams: 81 | inputs: fused_image_question_activations 82 | globals: 83 | input_size: fused_image_question_activation_size 84 | prediction_size: vocabulary_size_c2 85 | 86 | #: pipeline 87 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c2_classification/c2_word_answer_onehot_bow.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c2_classification/default_c2_classification.yml 3 | 4 | # Training parameters: 5 | training: 6 | task: 7 | batch_size: 128 8 | terminal_conditions: 9 | episode_limit: 1000 10 | 11 | # Validation parameters: 12 | validation: 13 | task: 14 | batch_size: 128 15 | 16 | pipeline: 17 | 18 | # Answer encoding. 19 | answer_tokenizer: 20 | type: SentenceTokenizer 21 | priority: 1.1 22 | preprocessing: lowercase,remove_punctuation 23 | remove_characters: [“,”,’] 24 | streams: 25 | inputs: answers 26 | outputs: tokenized_answer_words 27 | 28 | answer_onehot_encoder: 29 | type: SentenceOneHotEncoder 30 | priority: 1.2 31 | data_folder: ~/data/vqa-med 32 | word_mappings_file: answer_words.c2.preprocessed.word.mappings.csv 33 | export_word_mappings_to_globals: True 34 | streams: 35 | inputs: tokenized_answer_words 36 | outputs: encoded_answer_words 37 | globals: 38 | vocabulary_size: answer_words_vocabulary_size 39 | word_mappings: answer_words_word_mappings 40 | 41 | answer_bow_encoder: 42 | type: BOWEncoder 43 | priority: 1.3 44 | streams: 45 | inputs: encoded_answer_words 46 | outputs: bow_answer_words 47 | globals: 48 | bow_size: answer_words_vocabulary_size 49 | 50 | # Model. 51 | classifier: 52 | type: FeedForwardNetwork 53 | hidden_sizes: [50] 54 | dropout_rate: 0.5 55 | priority: 3 56 | streams: 57 | inputs: bow_answer_words 58 | globals: 59 | input_size: answer_words_vocabulary_size 60 | prediction_size: vocabulary_size_c2 61 | 62 | # Viewers. 63 | viewer: 64 | type: StreamViewer 65 | priority: 100.4 66 | input_streams: answers, tokenized_answer_words, predicted_answers 67 | 68 | #: pipeline 69 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c2_classification/default_c2_classification.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/default_vqa_med_2019.yml 3 | 4 | # Training parameters: 5 | training: 6 | task: 7 | categories: C2 8 | export_sample_weights: ~/data/vqa-med/answers.c2.weights.csv 9 | sampler: 10 | weights: ~/data/vqa-med/answers.c2.weights.csv 11 | 12 | # Validation parameters: 13 | validation: 14 | task: 15 | categories: C2 16 | 17 | 18 | pipeline: 19 | 20 | # Answer encoding. 21 | answer_indexer: 22 | type: LabelIndexer 23 | priority: 0.1 24 | data_folder: ~/data/vqa-med 25 | word_mappings_file: answers.c2.word.mappings.csv 26 | # Export mappings and size to globals. 27 | export_word_mappings_to_globals: True 28 | streams: 29 | inputs: answers 30 | outputs: answers_ids 31 | globals: 32 | vocabulary_size: vocabulary_size_c2 33 | word_mappings: word_mappings_c2 34 | 35 | 36 | # Predictions decoder. 37 | prediction_decoder: 38 | type: WordDecoder 39 | priority: 10.1 40 | # Use the same word mappings as label indexer. 41 | import_word_mappings_from_globals: True 42 | streams: 43 | inputs: predictions 44 | outputs: predicted_answers 45 | globals: 46 | vocabulary_size: vocabulary_size_c2 47 | word_mappings: word_mappings_c2 48 | 49 | # Loss 50 | nllloss: 51 | type: NLLLoss 52 | priority: 10.2 53 | targets_dim: 1 54 | streams: 55 | targets: answers_ids 56 | loss: loss 57 | 58 | # Statistics. 59 | batch_size: 60 | type: BatchSizeStatistics 61 | priority: 100.1 62 | 63 | #accuracy: 64 | # type: AccuracyStatistics 65 | # priority: 100.2 66 | # streams: 67 | # targets: answers_ids 68 | 69 | precision_recall: 70 | type: PrecisionRecallStatistics 71 | priority: 100.3 72 | use_word_mappings: True 73 | show_class_scores: True 74 | show_confusion_matrix: True 75 | streams: 76 | targets: answers_ids 77 | globals: 78 | word_mappings: word_mappings_c2 79 | num_classes: vocabulary_size_c2 80 | 81 | # Viewers. 82 | viewer: 83 | type: StreamViewer 84 | priority: 100.4 85 | input_streams: tokenized_questions,category_names,answers,predicted_answers 86 | 87 | #: pipeline 88 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c3_classification/c3_classification_all_bow_vgg16_concat.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c3_classification/default_c3_classification.yml 3 | 4 | pipeline: 5 | 6 | global_publisher: 7 | type: GlobalVariablePublisher 8 | priority: 0 9 | # Add input_size to globals. 10 | keys: [image_size_encoder_input_size, image_size_encoder_output_size, image_encoder_output_size] 11 | values: [2, 10, 100] 12 | 13 | # First subpipeline: question. 14 | # Questions encoding. 15 | question_tokenizer: 16 | type: SentenceTokenizer 17 | priority: 1.1 18 | streams: 19 | inputs: questions 20 | outputs: tokenized_questions 21 | 22 | question_onehot_encoder: 23 | type: SentenceOneHotEncoder 24 | priority: 1.2 25 | data_folder: ~/data/vqa-med 26 | word_mappings_file: questions.all.word.mappings.csv 27 | export_word_mappings_to_globals: True 28 | streams: 29 | inputs: tokenized_questions 30 | outputs: encoded_questions 31 | globals: 32 | vocabulary_size: question_vocabulary_size 33 | 34 | question_bow_encoder: 35 | type: BOWEncoder 36 | priority: 1.3 37 | streams: 38 | inputs: encoded_questions 39 | outputs: question_activations 40 | globals: 41 | bow_size: question_vocabulary_size 42 | 43 | 44 | # 2nd subpipeline: image size. 45 | # Model - image size classifier. 46 | image_size_encoder: 47 | type: FeedForwardNetwork 48 | priority: 2.1 49 | streams: 50 | inputs: image_sizes 51 | predictions: image_size_activations 52 | globals: 53 | input_size: image_size_encoder_input_size 54 | prediction_size: image_size_encoder_output_size 55 | 56 | # 3rd subpipeline: image. 57 | # Image encoder. 58 | image_encoder: 59 | type: GenericImageEncoder 60 | priority: 3.1 61 | streams: 62 | inputs: images 63 | outputs: image_activations 64 | globals: 65 | output_size: image_encoder_output_size 66 | 67 | # 4th subpipeline: concatenation + FF. 68 | concat: 69 | type: ConcatenateTensor 70 | priority: 4.1 71 | input_streams: [question_activations,image_size_activations,image_activations] 72 | # ConcatenateTensor 73 | dim: 1 # default 74 | input_dims: [[-1,99],[-1,10],[-1,100]] 75 | output_dims: [-1,209] 76 | streams: 77 | outputs: concatenated_activations 78 | globals: 79 | output_size: output_size 80 | 81 | 82 | classifier: 83 | type: FeedForwardNetwork 84 | hidden_sizes: [100] 85 | priority: 4.2 86 | streams: 87 | inputs: concatenated_activations 88 | globals: 89 | input_size: output_size 90 | prediction_size: vocabulary_size_c3 91 | 92 | 93 | #: pipeline 94 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c3_classification/c3_classification_image_cnn_softmax.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c3_classification/default_c3_classification.yml 3 | 4 | pipeline: 5 | 6 | # Image encoder. 7 | image_encoder: 8 | type: ConvNetEncoder 9 | priority: 1.1 10 | streams: 11 | inputs: images 12 | 13 | # Reshape inputs 14 | reshaper: 15 | type: ReshapeTensor 16 | input_dims: [-1, 16, 26, 26] 17 | output_dims: [-1, 10816] 18 | #input_dims: [-1, 16, 6, 6] 19 | #output_dims: [-1, 576] 20 | priority: 1.2 21 | streams: 22 | inputs: feature_maps 23 | outputs: reshaped_maps 24 | globals: 25 | output_size: reshaped_maps_size 26 | 27 | # Model - softmax classifier. 28 | classifier: 29 | type: FeedForwardNetwork 30 | #hidden_sizes: [32] 31 | priority: 3 32 | streams: 33 | inputs: reshaped_maps 34 | globals: 35 | input_size: reshaped_maps_size 36 | prediction_size: vocabulary_size_c3 37 | 38 | #: pipeline 39 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c3_classification/c3_classification_image_plus_size_concat.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c3_classification/default_c3_classification.yml 3 | 4 | pipeline: 5 | 6 | global_publisher: 7 | type: GlobalVariablePublisher 8 | priority: 0 9 | # Add input_size to globals. 10 | keys: [image_size_dims,image_latent_size,image_size_latent_size] 11 | values: [2,100,10] 12 | 13 | # 2nd subpipeline: image size. 14 | # Model - image size classifier. 15 | image_size_ffn: 16 | type: FeedForwardNetwork 17 | #hidden_sizes: [100] 18 | priority: 2 19 | streams: 20 | inputs: image_sizes 21 | predictions: image_size_activations 22 | globals: 23 | input_size: image_size_dims 24 | prediction_size: image_latent_size 25 | 26 | # 3rd subpipeline: image. 27 | # Image encoder. 28 | image_encoder: 29 | type: ConvNetEncoder 30 | priority: 3.1 31 | streams: 32 | inputs: images 33 | 34 | # Reshape inputs 35 | reshaper: 36 | type: ReshapeTensor 37 | input_dims: [-1, 16, 26, 26] 38 | output_dims: [-1, 10816] 39 | priority: 3.2 40 | streams: 41 | inputs: feature_maps 42 | outputs: reshaped_maps 43 | globals: 44 | output_size: reshaped_maps_size 45 | 46 | # Model - feed-forward. 47 | image_ffn: 48 | type: FeedForwardNetwork 49 | hidden_sizes: [1000] 50 | priority: 3.3 51 | streams: 52 | inputs: reshaped_maps 53 | predictions: image_activations 54 | globals: 55 | input_size: reshaped_maps_size 56 | prediction_size: image_size_latent_size 57 | 58 | # 4th subpipeline: concatenation + FF. 59 | concat: 60 | type: ConcatenateTensor 61 | priority: 4.1 62 | input_streams: [image_size_activations,image_activations] 63 | # ConcatenateTensor 64 | dim: 1 # default 65 | input_dims: [[-1,100],[-1,10]] 66 | output_dims: [-1,110] 67 | streams: 68 | outputs: concatenated_activations 69 | globals: 70 | #input_sizes: [latent_size,latent_size,latent_size] 71 | output_size: output_size 72 | 73 | 74 | classifier: 75 | type: FeedForwardNetwork 76 | hidden_sizes: [50] 77 | priority: 4.2 78 | streams: 79 | inputs: concatenated_activations 80 | globals: 81 | input_size: output_size 82 | prediction_size: vocabulary_size_c3 83 | 84 | 85 | #: pipeline 86 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c3_classification/c3_classification_image_size_softmax.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c3_classification/default_c3_classification.yml 3 | 4 | pipeline: 5 | 6 | global_publisher: 7 | type: GlobalVariablePublisher 8 | priority: 1 9 | # Add input_size to globals, so classifier will use it. 10 | keys: input_size 11 | values: 2 12 | 13 | # Model - image size classifier. 14 | classifier: 15 | type: FeedForwardNetwork 16 | #hidden_sizes: [100] 17 | priority: 3 18 | streams: 19 | inputs: image_sizes 20 | globals: 21 | prediction_size: vocabulary_size_c3 22 | 23 | #: pipeline 24 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c3_classification/c3_classification_image_softmax.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c3_classification/default_c3_classification.yml 3 | 4 | training: 5 | task: 6 | resize_image: &resize_image [28, 28] 7 | 8 | validation: 9 | task: 10 | resize_image: *resize_image 11 | 12 | 13 | pipeline: 14 | 15 | # Reshape inputs 16 | reshaper: 17 | type: ReshapeTensor 18 | priority: 1.1 19 | input_dims: [-1, 3, 28, 28] 20 | output_dims: [-1, 2352] 21 | streams: 22 | inputs: images 23 | outputs: reshaped_maps 24 | globals: 25 | output_size: reshaped_maps_size 26 | 27 | # Model - softmax classifier. 28 | classifier: 29 | type: FeedForwardNetwork 30 | priority: 1.2 31 | hidden: [100] 32 | streams: 33 | inputs: reshaped_maps 34 | globals: 35 | input_size: reshaped_maps_size 36 | prediction_size: vocabulary_size_c3 37 | 38 | #: pipeline 39 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c3_classification/c3_classification_image_vgg16_softmax.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c3_classification/default_c3_classification.yml 3 | 4 | pipeline: 5 | 6 | # Image encoder. 7 | image_encoder: 8 | type: GenericImageEncoder 9 | priority: 1.1 10 | streams: 11 | inputs: images 12 | outputs: vgg_images 13 | globals: 14 | output_size: vocabulary_size_c3 15 | 16 | # Model - softmax classifier. 17 | classifier: 18 | type: FeedForwardNetwork 19 | priority: 3 20 | streams: 21 | inputs: vgg_images 22 | globals: 23 | input_size: vocabulary_size_c3 24 | prediction_size: vocabulary_size_c3 25 | 26 | #: pipeline 27 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c3_classification/c3_classification_question_onehot_bow.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c3_classification/default_c3_classification.yml 3 | 4 | pipeline: 5 | 6 | # Questions encoding. 7 | question_tokenizer: 8 | type: SentenceTokenizer 9 | priority: 1.1 10 | streams: 11 | inputs: questions 12 | outputs: tokenized_questions 13 | 14 | question_onehot_encoder: 15 | type: SentenceOneHotEncoder 16 | priority: 1.2 17 | data_folder: ~/data/vqa-med 18 | word_mappings_file: questions.all.word.mappings.csv 19 | export_word_mappings_to_globals: True 20 | streams: 21 | inputs: tokenized_questions 22 | outputs: encoded_questions 23 | globals: 24 | vocabulary_size: sentence_vocabulary_size 25 | 26 | question_bow_encoder: 27 | type: BOWEncoder 28 | priority: 1.3 29 | streams: 30 | inputs: encoded_questions 31 | outputs: bow_questions 32 | globals: 33 | bow_size: sentence_vocabulary_size 34 | 35 | # Model. 36 | classifier: 37 | type: FeedForwardNetwork 38 | hidden_sizes: [100, 100] 39 | priority: 3 40 | streams: 41 | inputs: bow_questions 42 | globals: 43 | input_size: sentence_vocabulary_size 44 | prediction_size: vocabulary_size_c3 45 | 46 | #: pipeline 47 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c3_classification/c3_classification_question_rnn.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c3_classification/default_c3_classification.yml 3 | 4 | pipeline: 5 | 6 | # Questions encoding. 7 | question_tokenizer: 8 | type: SentenceTokenizer 9 | priority: 1.1 10 | streams: 11 | inputs: questions 12 | outputs: tokenized_questions 13 | 14 | # Model 1: Embeddings 15 | question_embeddings: 16 | type: SentenceEmbeddings 17 | priority: 1.2 18 | embeddings_size: 50 19 | pretrained_embeddings_file: glove.6B.50d.txt 20 | data_folder: ~/data/vqa-med 21 | word_mappings_file: questions.all.word.mappings.csv 22 | streams: 23 | inputs: tokenized_questions 24 | outputs: embedded_questions 25 | 26 | # Model 2: RNN 27 | lstm: 28 | type: RecurrentNeuralNetwork 29 | cell_type: LSTM 30 | prediction_mode: Last 31 | priority: 3 32 | initial_state: Zero 33 | #num_layers: 5 34 | hidden_size: 50 35 | streams: 36 | inputs: embedded_questions 37 | globals: 38 | input_size: embeddings_size 39 | prediction_size: vocabulary_size_c3 40 | 41 | #: pipeline 42 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c3_classification/default_c3_classification.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/default_vqa_med_2019.yml 3 | 4 | # Training parameters: 5 | training: 6 | task: 7 | categories: C3 8 | export_sample_weights: ~/data/vqa-med/answers.c3.weights.csv 9 | sampler: 10 | weights: ~/data/vqa-med/answers.c3.weights.csv 11 | 12 | # Validation parameters: 13 | validation: 14 | task: 15 | categories: C3 16 | 17 | 18 | pipeline: 19 | 20 | # Answer encoding. 21 | answer_indexer: 22 | type: LabelIndexer 23 | priority: 0.1 24 | data_folder: ~/data/vqa-med 25 | word_mappings_file: answers.c3.word.mappings.csv 26 | # Export mappings and size to globals. 27 | export_word_mappings_to_globals: True 28 | streams: 29 | inputs: answers 30 | outputs: answers_ids 31 | globals: 32 | vocabulary_size: vocabulary_size_c3 33 | word_mappings: word_mappings_c3 34 | 35 | 36 | # Predictions decoder. 37 | prediction_decoder: 38 | type: WordDecoder 39 | priority: 10.1 40 | # Use the same word mappings as label indexer. 41 | import_word_mappings_from_globals: True 42 | streams: 43 | inputs: predictions 44 | outputs: predicted_answers 45 | globals: 46 | vocabulary_size: vocabulary_size_c3 47 | word_mappings: word_mappings_c3 48 | 49 | # Loss 50 | nllloss: 51 | type: NLLLoss 52 | priority: 10.2 53 | targets_dim: 1 54 | streams: 55 | targets: answers_ids 56 | loss: loss 57 | 58 | # Statistics. 59 | batch_size: 60 | type: BatchSizeStatistics 61 | priority: 100.1 62 | 63 | #accuracy: 64 | # type: AccuracyStatistics 65 | # priority: 100.2 66 | # streams: 67 | # targets: answers_ids 68 | 69 | precision_recall: 70 | type: PrecisionRecallStatistics 71 | priority: 100.3 72 | use_word_mappings: True 73 | show_class_scores: True 74 | show_confusion_matrix: True 75 | streams: 76 | targets: answers_ids 77 | globals: 78 | word_mappings: word_mappings_c3 79 | num_classes: vocabulary_size_c3 80 | 81 | # Viewers. 82 | viewer: 83 | type: StreamViewer 84 | priority: 100.4 85 | input_streams: questions,category_names,answers,predicted_answers 86 | 87 | #: pipeline 88 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c4_classification/c4_word_answer_glove_sum.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c4_classification/default_c4_classification.yml 3 | 4 | # Training parameters: 5 | training: 6 | task: 7 | categories: C4 8 | batch_size: 512 9 | # In here we won't use images at all. 10 | stream_images: False 11 | dataloader: 12 | num_workers: 0 13 | 14 | # Validation parameters: 15 | validation: 16 | task: 17 | categories: C4 18 | batch_size: 512 19 | # In here we won't use images at all. 20 | stream_images: False 21 | dataloader: 22 | num_workers: 0 23 | 24 | 25 | pipeline: 26 | 27 | global_publisher: 28 | priority: 0 29 | type: GlobalVariablePublisher 30 | # Add input_size to globals. 31 | keys: [answer_word_embeddings_size] 32 | values: [100] 33 | 34 | # Answer encoding. 35 | answer_tokenizer: 36 | type: SentenceTokenizer 37 | priority: 1.1 38 | preprocessing: lowercase,remove_punctuation 39 | remove_characters: [“,”,’] 40 | streams: 41 | inputs: answers 42 | outputs: tokenized_answer_words 43 | 44 | # Model 1: Embeddings 45 | answer_embeddings: 46 | priority: 1.2 47 | type: SentenceEmbeddings 48 | embeddings_size: 100 49 | pretrained_embeddings_file: glove.6B.100d.txt 50 | data_folder: ~/data/vqa-med 51 | word_mappings_file: answer_words.c4.preprocessed.word.mappings.csv 52 | export_word_mappings_to_globals: True 53 | streams: 54 | inputs: tokenized_answer_words 55 | outputs: encoded_answer_words 56 | globals: 57 | vocabulary_size: answer_words_vocabulary_size 58 | word_mappings: answer_words_word_mappings 59 | 60 | answer_reduction: 61 | type: ReduceTensor 62 | priority: 1.3 63 | num_inputs_dims: 3 64 | reduction_dim: 1 65 | reduction_type: sum 66 | keepdim: False 67 | streams: 68 | inputs: encoded_answer_words 69 | outputs: reduced_answers 70 | globals: 71 | input_size: answer_word_embeddings_size 72 | 73 | # Model. 74 | classifier: 75 | type: FeedForwardNetwork 76 | hidden_sizes: [500, 500] 77 | dropout_rate: 0.5 78 | priority: 3 79 | streams: 80 | inputs: reduced_answers 81 | globals: 82 | input_size: answer_word_embeddings_size 83 | prediction_size: vocabulary_size_c4 84 | 85 | # Viewers. 86 | viewer: 87 | type: StreamViewer 88 | priority: 100.4 89 | input_streams: answers, tokenized_answer_words, predicted_answers 90 | 91 | #: pipeline 92 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c4_classification/c4_word_answer_mimic_sum.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c4_classification/default_c4_classification.yml 3 | 4 | # Training parameters: 5 | training: 6 | task: 7 | categories: C4 8 | batch_size: 512 9 | # In here we won't use images at all. 10 | stream_images: False 11 | dataloader: 12 | num_workers: 0 13 | 14 | # Validation parameters: 15 | validation: 16 | task: 17 | categories: C4 18 | batch_size: 512 19 | # In here we won't use images at all. 20 | stream_images: False 21 | dataloader: 22 | num_workers: 0 23 | 24 | 25 | pipeline: 26 | 27 | global_publisher: 28 | priority: 0 29 | type: GlobalVariablePublisher 30 | # Add input_size to globals. 31 | keys: [answer_word_embeddings_size] 32 | values: [300] 33 | 34 | # Answer encoding. 35 | answer_tokenizer: 36 | type: SentenceTokenizer 37 | priority: 1.1 38 | preprocessing: lowercase,remove_punctuation 39 | remove_characters: [“,”,’] 40 | streams: 41 | inputs: answers 42 | outputs: tokenized_answer_words 43 | 44 | # Model 1: Embeddings 45 | answer_embeddings: 46 | priority: 1.2 47 | type: SentenceEmbeddings 48 | embeddings_size: 300 49 | pretrained_embeddings_file: mimic.fastText.no_clean.300d.pickled 50 | data_folder: ~/data/vqa-med 51 | word_mappings_file: answer_words.c4.preprocessed.word.mappings.csv 52 | export_word_mappings_to_globals: True 53 | streams: 54 | inputs: tokenized_answer_words 55 | outputs: encoded_answer_words 56 | globals: 57 | vocabulary_size: answer_words_vocabulary_size 58 | word_mappings: answer_words_word_mappings 59 | 60 | answer_reduction: 61 | type: ReduceTensor 62 | priority: 1.3 63 | num_inputs_dims: 3 64 | reduction_dim: 1 65 | reduction_type: sum 66 | keepdim: False 67 | streams: 68 | inputs: encoded_answer_words 69 | outputs: reduced_answers 70 | globals: 71 | input_size: answer_word_embeddings_size 72 | 73 | # Model. 74 | classifier: 75 | type: FeedForwardNetwork 76 | hidden_sizes: [500, 500] 77 | dropout_rate: 0.5 78 | priority: 3 79 | streams: 80 | inputs: reduced_answers 81 | globals: 82 | input_size: answer_word_embeddings_size 83 | prediction_size: vocabulary_size_c4 84 | 85 | # Viewers. 86 | viewer: 87 | type: StreamViewer 88 | priority: 100.4 89 | input_streams: answers, tokenized_answer_words, predicted_answers 90 | 91 | #: pipeline 92 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c4_classification/c4_word_answer_onehot_bow.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c4_classification/default_c4_classification.yml 3 | 4 | # Training parameters: 5 | training: 6 | task: 7 | categories: C4 8 | batch_size: 512 9 | # In here we won't use images at all. 10 | stream_images: False 11 | dataloader: 12 | num_workers: 0 13 | 14 | # Validation parameters: 15 | validation: 16 | task: 17 | categories: C4 18 | batch_size: 512 19 | # In here we won't use images at all. 20 | stream_images: False 21 | dataloader: 22 | num_workers: 0 23 | 24 | 25 | pipeline: 26 | # Answer encoding. 27 | answer_tokenizer: 28 | type: SentenceTokenizer 29 | priority: 1.1 30 | preprocessing: lowercase,remove_punctuation 31 | remove_characters: [“,”,’] 32 | streams: 33 | inputs: answers 34 | outputs: tokenized_answer_words 35 | 36 | answer_onehot_encoder: 37 | type: SentenceOneHotEncoder 38 | priority: 1.2 39 | data_folder: ~/data/vqa-med 40 | word_mappings_file: answer_words.c4.preprocessed.word.mappings.csv 41 | export_word_mappings_to_globals: True 42 | streams: 43 | inputs: tokenized_answer_words 44 | outputs: encoded_answer_words 45 | globals: 46 | vocabulary_size: answer_words_vocabulary_size 47 | word_mappings: answer_words_word_mappings 48 | 49 | answer_bow_encoder: 50 | type: BOWEncoder 51 | priority: 1.3 52 | streams: 53 | inputs: encoded_answer_words 54 | outputs: bow_answer_words 55 | globals: 56 | bow_size: answer_words_vocabulary_size 57 | 58 | # Model. 59 | classifier: 60 | type: FeedForwardNetwork 61 | hidden_sizes: [500, 500] 62 | dropout_rate: 0.5 63 | priority: 3 64 | streams: 65 | inputs: bow_answer_words 66 | globals: 67 | input_size: answer_words_vocabulary_size 68 | prediction_size: vocabulary_size_c4 69 | 70 | # Viewers. 71 | viewer: 72 | type: StreamViewer 73 | priority: 100.4 74 | input_streams: answers, tokenized_answer_words, predicted_answers 75 | 76 | #: pipeline 77 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c4_classification/c4_word_answer_onehot_sum.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/c4_classification/default_c4_classification.yml 3 | 4 | # Training parameters: 5 | training: 6 | task: 7 | categories: C4 8 | batch_size: 512 9 | # In here we won't use images at all. 10 | stream_images: False 11 | dataloader: 12 | num_workers: 0 13 | 14 | # Validation parameters: 15 | validation: 16 | task: 17 | categories: C4 18 | batch_size: 512 19 | # In here we won't use images at all. 20 | stream_images: False 21 | dataloader: 22 | num_workers: 0 23 | 24 | 25 | pipeline: 26 | # Answer encoding. 27 | answer_tokenizer: 28 | type: SentenceTokenizer 29 | priority: 1.1 30 | preprocessing: lowercase,remove_punctuation 31 | remove_characters: [“,”,’] 32 | streams: 33 | inputs: answers 34 | outputs: tokenized_answer_words 35 | 36 | answer_onehot_encoder: 37 | type: SentenceOneHotEncoder 38 | priority: 1.2 39 | data_folder: ~/data/vqa-med 40 | word_mappings_file: answer_words.c4.preprocessed.word.mappings.csv 41 | export_word_mappings_to_globals: True 42 | streams: 43 | inputs: tokenized_answer_words 44 | outputs: encoded_answer_words 45 | globals: 46 | vocabulary_size: answer_words_vocabulary_size 47 | word_mappings: answer_words_word_mappings 48 | 49 | answer_to_tensor: 50 | type: ListToTensor 51 | priority: 1.3 52 | num_inputs_dims: 3 53 | streams: 54 | inputs: encoded_answer_words 55 | outputs: tensor_answer_words 56 | globals: 57 | input_size: answer_words_vocabulary_size 58 | 59 | 60 | answer_reduction: 61 | type: ReduceTensor 62 | priority: 1.4 63 | num_inputs_dims: 3 64 | reduction_dim: 1 65 | reduction_type: sum 66 | keepdim: False 67 | streams: 68 | inputs: tensor_answer_words 69 | outputs: reduced_answer_words 70 | globals: 71 | input_size: answer_words_vocabulary_size 72 | 73 | # Model. 74 | classifier: 75 | type: FeedForwardNetwork 76 | hidden_sizes: [500, 500] 77 | dropout_rate: 0.5 78 | priority: 3 79 | streams: 80 | inputs: reduced_answer_words 81 | globals: 82 | input_size: answer_words_vocabulary_size 83 | prediction_size: vocabulary_size_c4 84 | 85 | # Viewers. 86 | viewer: 87 | type: StreamViewer 88 | priority: 100.4 89 | input_streams: answers, tokenized_answer_words, predicted_answers 90 | 91 | #: pipeline 92 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/c4_classification/default_c4_classification.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/default_vqa_med_2019.yml 3 | 4 | # Training parameters: 5 | training: 6 | task: 7 | categories: C4 8 | export_sample_weights: ~/data/vqa-med/answers.c4.weights.csv 9 | sampler: 10 | weights: ~/data/vqa-med/answers.c4.weights.csv 11 | 12 | # Validation parameters: 13 | validation: 14 | task: 15 | categories: C4 16 | 17 | 18 | pipeline: 19 | 20 | # Answer encoding. 21 | answer_indexer: 22 | type: LabelIndexer 23 | priority: 0.1 24 | data_folder: ~/data/vqa-med 25 | word_mappings_file: answers.c4.word.mappings.csv 26 | # Export mappings and size to globals. 27 | export_word_mappings_to_globals: True 28 | streams: 29 | inputs: answers 30 | outputs: answers_ids 31 | globals: 32 | vocabulary_size: vocabulary_size_c4 33 | word_mappings: word_mappings_c4 34 | 35 | 36 | # Predictions decoder. 37 | prediction_decoder: 38 | type: WordDecoder 39 | priority: 10.1 40 | # Use the same word mappings as label indexer. 41 | import_word_mappings_from_globals: True 42 | streams: 43 | inputs: predictions 44 | outputs: predicted_answers 45 | globals: 46 | vocabulary_size: vocabulary_size_c4 47 | word_mappings: word_mappings_c4 48 | 49 | # Loss 50 | nllloss: 51 | type: NLLLoss 52 | priority: 10.2 53 | targets_dim: 1 54 | streams: 55 | targets: answers_ids 56 | loss: loss 57 | 58 | # Statistics. 59 | batch_size: 60 | type: BatchSizeStatistics 61 | priority: 100.1 62 | 63 | #accuracy: 64 | # type: AccuracyStatistics 65 | # priority: 100.2 66 | # streams: 67 | # targets: answers_ids 68 | 69 | precision_recall: 70 | type: PrecisionRecallStatistics 71 | priority: 100.3 72 | use_word_mappings: True 73 | #show_class_scores: True 74 | #show_confusion_matrix: True 75 | streams: 76 | targets: answers_ids 77 | globals: 78 | word_mappings: word_mappings_c4 79 | num_classes: vocabulary_size_c4 80 | 81 | # Viewers. 82 | viewer: 83 | type: StreamViewer 84 | priority: 100.4 85 | input_streams: questions,category_names,answers,predicted_answers 86 | 87 | #: pipeline 88 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/default_vqa_med_2019.yml: -------------------------------------------------------------------------------- 1 | # Training parameters: 2 | training: 3 | task: 4 | type: &p_type VQAMED2019 5 | data_folder: &data_folder ~/data/vqa-med 6 | split: training_validation 7 | resize_image: &resize_image [224, 224] 8 | batch_size: 64 9 | # Generate and export shuffled indices. 10 | shuffle_indices: True 11 | export_indices: shuffled_indices.npy 12 | 13 | # Default sampler during training. 14 | sampler: 15 | type: kFoldWeightedRandomSampler 16 | folds: 20 17 | epochs_per_fold: 1000 # NEVER CHANGE FOLD! 18 | # Use four workers for loading images. 19 | dataloader: 20 | num_workers: 4 21 | 22 | # Optimizer parameters: 23 | optimizer: 24 | type: Adam 25 | lr: 0.0001 26 | 27 | # Terminal conditions: 28 | terminal_conditions: 29 | loss_stop_threshold: 1.0e-3 30 | episode_limit: 10000 31 | epoch_limit: -1 32 | 33 | # Validation parameters: 34 | validation: 35 | partial_validation_interval: 10 36 | task: 37 | type: *p_type 38 | data_folder: *data_folder 39 | split: training_validation 40 | resize_image: *resize_image 41 | batch_size: 64 42 | # Import shuffled indices. 43 | import_indices: shuffled_indices.npy 44 | 45 | # Default sampler during validation. 46 | sampler: 47 | type: kFoldRandomSampler 48 | folds: 20 49 | epochs_per_fold: 1000 # NEVER CHANGE FOLD! 50 | # Use four workers for loading images. 51 | dataloader: 52 | num_workers: 4 53 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/extend_answers.yml: -------------------------------------------------------------------------------- 1 | # This config is not a standalone config! 2 | # It adds new sections (sets) without samplers and components for saving answers that we can use for getting final answers. 3 | 4 | training_answers: 5 | task: 6 | type: &p_type VQAMED2019 7 | data_folder: &data_folder ~/data/vqa-med 8 | split: training 9 | categories: all 10 | resize_image: &resize_image [224, 224] 11 | batch_size: 64 12 | # Appy all preprocessing/data augmentations. 13 | question_preprocessing: lowercase,remove_punctuation,tokenize 14 | streams: 15 | questions: tokenized_questions 16 | dataloader: 17 | # No sampler, process samples in the same order. 18 | shuffle: false 19 | # Use 1 worker, so batches will follow the samples order. 20 | num_workers: 1 21 | 22 | validation_answers: 23 | task: 24 | type: *p_type 25 | data_folder: *data_folder 26 | split: validation 27 | categories: all 28 | resize_image: *resize_image 29 | batch_size: 64 30 | # Appy all preprocessing/data augmentations. 31 | question_preprocessing: lowercase,remove_punctuation,tokenize 32 | streams: 33 | questions: tokenized_questions 34 | dataloader: 35 | # No sampler, process samples in the same order. 36 | shuffle: false 37 | # Use 1 worker, so batches will follow the samples order. 38 | num_workers: 1 39 | 40 | 41 | # Testing parameters: 42 | test_answers: 43 | task: 44 | type: *p_type 45 | data_folder: *data_folder 46 | split: test_answers 47 | resize_image: *resize_image 48 | batch_size: 64 49 | # Appy all preprocessing/data augmentations. 50 | question_preprocessing: lowercase,remove_punctuation,tokenize 51 | streams: 52 | questions: tokenized_questions 53 | dataloader: 54 | # No sampler, process samples in the same order. 55 | shuffle: false 56 | # Use 1 worker, so batches will follow the samples order. 57 | num_workers: 1 58 | 59 | # Add component for exporting answers to files. 60 | pipeline: 61 | disable: viewer,question_tokenizer 62 | # Viewers. 63 | viewer_extended: 64 | priority: 100.4 65 | type: StreamViewer 66 | sample_number: 0 67 | input_streams: 68 | indices,image_ids,tokenized_questions, 69 | category_names,predicted_category_names, 70 | answers,predicted_answers 71 | 72 | answer_exporter: 73 | priority: 100.5 74 | type: StreamFileExporter 75 | separator: '|' 76 | filename: 'answers.csv' 77 | export_separator_line_to_csv: True 78 | export_header_to_csv: True 79 | input_streams: 80 | indices,image_ids,tokenized_questions, 81 | category_names,predicted_category_names, 82 | answers,predicted_answers 83 | 84 | submission_exporter: 85 | priority: 100.6 86 | type: StreamFileExporter 87 | separator: '|' 88 | filename: 'submission.txt' 89 | input_streams: 90 | image_ids, 91 | predicted_answers 92 | 93 | #: pipeline 94 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/extend_answers_c4.yml: -------------------------------------------------------------------------------- 1 | # This config is not a standalone config! 2 | # It adds new sections (sets) without samplers and components for saving answers that we can use for getting final answers. 3 | 4 | training_answers: 5 | task: 6 | type: &p_type VQAMED2019 7 | data_folder: &data_folder ~/data/vqa-med 8 | split: training 9 | categories: C4 10 | resize_image: &resize_image [224, 224] 11 | batch_size: 64 12 | # Appy all preprocessing/data augmentations. 13 | question_preprocessing: lowercase,remove_punctuation,tokenize 14 | streams: 15 | questions: tokenized_questions 16 | dataloader: 17 | # No sampler, process samples in the same order. 18 | shuffle: false 19 | # Use 1 worker, so batches will follow the samples order. 20 | num_workers: 1 21 | 22 | validation_answers: 23 | task: 24 | type: *p_type 25 | data_folder: *data_folder 26 | split: validation 27 | categories: C4 28 | resize_image: *resize_image 29 | batch_size: 64 30 | # Appy all preprocessing/data augmentations. 31 | question_preprocessing: lowercase,remove_punctuation,tokenize 32 | streams: 33 | questions: tokenized_questions 34 | dataloader: 35 | # No sampler, process samples in the same order. 36 | shuffle: false 37 | # Use 1 worker, so batches will follow the samples order. 38 | num_workers: 1 39 | 40 | 41 | # Add component for exporting answers to files. 42 | pipeline: 43 | disable: viewer,question_tokenizer 44 | # Viewers. 45 | viewer_extended: 46 | priority: 100.4 47 | type: StreamViewer 48 | sample_number: 0 49 | input_streams: 50 | indices,image_ids,tokenized_questions, 51 | category_names,predicted_categories, 52 | answers,tokenized_answers,predicted_answers 53 | 54 | answer_exporter: 55 | priority: 100.5 56 | type: StreamFileExporter 57 | separator: '|' 58 | filename: 'answers.csv' 59 | export_separator_line_to_csv: True 60 | input_streams: 61 | indices,image_ids,tokenized_questions, 62 | category_names,predicted_categories, 63 | answers,tokenized_answers,predicted_answers 64 | 65 | submission_exporter: 66 | priority: 100.6 67 | type: StreamFileExporter 68 | separator: '|' 69 | filename: 'submission.txt' 70 | input_streams: 71 | image_ids, 72 | predicted_answers 73 | 74 | #: pipeline 75 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/frozen_pipelines/frozen_word_answer_glove_sum.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/pytorchpipe/9cb17271666061cb19fe24197ecd5e4c8d32c5da/configs/vqa_med_2019/frozen_pipelines/frozen_word_answer_glove_sum.yml -------------------------------------------------------------------------------- /configs/vqa_med_2019/frozen_pipelines/input_fusion_processor_io.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: 3 | vqa_med_2019/frozen_pipelines/frozen_input_fusion_glove_lstm_vgg_att_is_cat.yml, 4 | vqa_med_2019/frozen_pipelines/frozen_question_categorization_glove_rnn_ffn.yml 5 | 6 | 7 | training_validation: 8 | task: 9 | type: &p_type VQAMED2019 10 | data_folder: &data_folder ~/data/vqa-med 11 | split: training_validation 12 | categories: all 13 | resize_image: &resize_image [224, 224] 14 | batch_size: 64 15 | # Appy all preprocessing/data augmentations. 16 | question_preprocessing: lowercase,remove_punctuation,tokenize 17 | streams: 18 | questions: tokenized_questions 19 | 20 | dataloader: 21 | # No sampler, process samples in the same order. 22 | shuffle: false 23 | # Use 1 worker, so batches will follow the samples order. 24 | num_workers: 1 25 | 26 | 27 | hyperparams: 28 | # Final classifier: FFN. 29 | answer_classifier_hidden_sizes_val: &answer_classifier_hidden_sizes_val [500] 30 | 31 | 32 | # Add component for exporting answers to files. 33 | pipeline: 34 | 35 | ################# PIPE 6: C1 + C2 + C3 questions ################# 36 | 37 | # Answer encoding. 38 | pipe6_c123_binary_yn_answer_indexer: 39 | priority: 6.2 40 | type: LabelIndexer 41 | data_folder: ~/data/vqa-med 42 | word_mappings_file: answers.c1_c2_c3_binary_yn.word.mappings.csv 43 | # Export mappings and size to globals. 44 | export_word_mappings_to_globals: True 45 | streams: 46 | inputs: answers 47 | outputs: answers_ids 48 | globals: 49 | vocabulary_size: vocabulary_size_c123_binary_yn 50 | word_mappings: word_mappings_c123_binary_yn 51 | 52 | 53 | # Viewers. 54 | viewer_extended: 55 | priority: 100.4 56 | type: StreamViewer 57 | sample_number: 0 58 | input_streams: 59 | indices,image_ids,tokenized_questions, 60 | concatenated_activations_size, 61 | category,names, 62 | answers 63 | 64 | fused_inputs_exporter: 65 | priority: 100.5 66 | type: StreamFileExporter 67 | separator: '|' 68 | filename: 'fused_inputs.csv' 69 | export_separator_line_to_csv: True 70 | input_streams: 71 | indices #, concatenated_activations 72 | 73 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/question_categorization/default_question_categorization.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/default_vqa_med_2019.yml 3 | 4 | training: 5 | task: 6 | categories: all 7 | export_sample_weights: ~/data/vqa-med/answers.all.weights.csv 8 | # Do not load and stream images! 9 | stream_images: False 10 | batch_size: 256 11 | sampler: 12 | weights: ~/data/vqa-med/answers.all.weights.csv 13 | terminal_conditions: 14 | loss_stop_threshold: 1.0e-3 15 | 16 | validation: 17 | task: 18 | categories: all 19 | # Do not load and stream images! 20 | stream_images: False 21 | batch_size: 256 22 | 23 | 24 | pipeline: 25 | 26 | # Predictions decoder. 27 | prediction_decoder: 28 | type: WordDecoder 29 | priority: 10.1 30 | # Use the same word mappings as label indexer. 31 | import_word_mappings_from_globals: True 32 | streams: 33 | inputs: predictions 34 | outputs: predicted_category_names 35 | globals: 36 | vocabulary_size: num_categories 37 | word_mappings: category_word_mappings 38 | 39 | # Loss 40 | nllloss: 41 | type: NLLLoss 42 | priority: 10.2 43 | targets_dim: 1 44 | streams: 45 | targets: category_ids 46 | loss: loss 47 | 48 | # Statistics. 49 | batch_size: 50 | type: BatchSizeStatistics 51 | priority: 100.1 52 | 53 | #accuracy: 54 | # type: AccuracyStatistics 55 | # priority: 100.2 56 | # streams: 57 | # targets: category_ids 58 | 59 | precision_recall: 60 | type: PrecisionRecallStatistics 61 | priority: 100.3 62 | use_word_mappings: True 63 | show_class_scores: True 64 | streams: 65 | targets: category_ids 66 | globals: 67 | num_classes: num_categories 68 | word_mappings: category_word_mappings 69 | 70 | 71 | # Viewers. 72 | viewer: 73 | type: StreamViewer 74 | priority: 100.4 75 | input_streams: questions,category_names,predicted_category_names 76 | 77 | #: pipeline 78 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/question_categorization/question_categorization_onehot_bow.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/question_categorization/default_question_categorization.yml 3 | 4 | pipeline: 5 | 6 | # Questions encoding. 7 | question_tokenizer: 8 | type: SentenceTokenizer 9 | priority: 1.1 10 | streams: 11 | inputs: questions 12 | outputs: tokenized_questions 13 | 14 | question_encoder: 15 | type: SentenceOneHotEncoder 16 | priority: 1.2 17 | data_folder: ~/data/vqa-med 18 | word_mappings_file: questions.all.word.mappings.csv 19 | export_word_mappings_to_globals: True 20 | streams: 21 | inputs: tokenized_questions 22 | outputs: encoded_questions 23 | globals: 24 | vocabulary_size: question_vocabulary_size 25 | 26 | bow_encoder: 27 | type: BOWEncoder 28 | priority: 1.3 29 | streams: 30 | inputs: encoded_questions 31 | outputs: bow_questions 32 | globals: 33 | bow_size: question_vocabulary_size # Set by question_encoder. 34 | 35 | # Model 36 | classifier: 37 | type: FeedForwardNetwork 38 | #freeze: True 39 | priority: 3 40 | streams: 41 | inputs: bow_questions 42 | globals: 43 | input_size: question_vocabulary_size # Set by question_encoder. 44 | prediction_size: num_categories # C1,C2,C3,C4 45 | 46 | # Predictions decoder. 47 | prediction_decoder: 48 | type: WordDecoder 49 | priority: 4 50 | # Use the same word mappings as label indexer. 51 | import_word_mappings_from_globals: True 52 | streams: 53 | inputs: predictions 54 | outputs: predicted_categories 55 | globals: 56 | vocabulary_size: num_categories 57 | word_mappings: category_word_mappings 58 | 59 | # Loss 60 | nllloss: 61 | type: NLLLoss 62 | priority: 6 63 | targets_dim: 1 64 | streams: 65 | targets: category_ids 66 | loss: loss 67 | 68 | # Statistics. 69 | accuracy: 70 | type: AccuracyStatistics 71 | priority: 10 72 | streams: 73 | targets: category_ids 74 | batch_size: 75 | type: BatchSizeStatistics 76 | priority: 11 77 | 78 | # Viewers. 79 | viewer: 80 | type: StreamViewer 81 | priority: 12 82 | stream_names: questions,category_names,predicted_categories 83 | 84 | #: pipeline 85 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/question_categorization/question_categorization_onehot_rnn.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/question_categorization/default_question_categorization.yml 3 | 4 | pipeline: 5 | 6 | # Questions encoding. 7 | question_tokenizer: 8 | type: SentenceTokenizer 9 | priority: 1.1 10 | streams: 11 | inputs: questions 12 | outputs: tokenized_questions 13 | 14 | question_encoder: 15 | type: SentenceOneHotEncoder 16 | priority: 1.2 17 | data_folder: ~/data/vqa-med 18 | word_mappings_file: questions.all.word.mappings.csv 19 | export_word_mappings_to_globals: True 20 | streams: 21 | inputs: tokenized_questions 22 | outputs: encoded_questions 23 | globals: 24 | vocabulary_size: question_vocabulary_size 25 | 26 | question_to_tensor: 27 | type: ListToTensor 28 | priority: 1.3 29 | num_inputs_dims: 3 30 | streams: 31 | inputs: encoded_questions 32 | outputs: tensor_questions 33 | globals: 34 | input_size: question_vocabulary_size 35 | 36 | # Model 1: RNN 37 | lstm: 38 | type: RecurrentNeuralNetwork 39 | prediction_mode: Last 40 | priority: 3 41 | initial_state: Zero 42 | hidden_size: 50 43 | streams: 44 | inputs: tensor_questions 45 | globals: 46 | input_size: question_vocabulary_size 47 | prediction_size: num_categories # C1,C2,C3,C4 48 | 49 | #: pipeline 50 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/question_categorization/question_categorization_rnn.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/question_categorization/default_question_categorization.yml 3 | 4 | pipeline: 5 | 6 | # Questions encoding. 7 | question_tokenizer: 8 | type: SentenceTokenizer 9 | priority: 1.1 10 | streams: 11 | inputs: questions 12 | outputs: tokenized_questions 13 | 14 | # Model 2: Embeddings 15 | question_embeddings: 16 | type: SentenceEmbeddings 17 | priority: 1.2 18 | embeddings_size: 50 19 | pretrained_embeddings_file: glove.6B.50d.txt 20 | data_folder: ~/data/vqa-med 21 | word_mappings_file: questions.all.word.mappings.csv 22 | streams: 23 | inputs: tokenized_questions 24 | outputs: embedded_questions 25 | 26 | # Model 2: RNN 27 | lstm: 28 | type: RecurrentNeuralNetwork 29 | cell_type: LSTM 30 | prediction_mode: Last 31 | priority: 3 32 | initial_state: Zero 33 | streams: 34 | inputs: embedded_questions 35 | globals: 36 | input_size: embeddings_size 37 | prediction_size: num_categories # C1,C2,C3,C4,BIN,UNK 38 | 39 | #: pipeline 40 | -------------------------------------------------------------------------------- /configs/vqa_med_2019/question_categorization/question_categorization_rnn_ffn.yml: -------------------------------------------------------------------------------- 1 | # Load config defining tasks for training, validation and testing. 2 | default_configs: vqa_med_2019/question_categorization/default_question_categorization.yml 3 | 4 | pipeline: 5 | 6 | # Add global variables. 7 | global_publisher: 8 | type: GlobalVariablePublisher 9 | priority: 0 10 | # Add input_size to globals. 11 | keys: [question_lstm_output_size, image_size_encoder_input_size, image_size_encoder_output_size, image_encoder_output_size] 12 | values: [100, 2, 10, 100] 13 | 14 | 15 | # Questions encoding. 16 | question_tokenizer: 17 | type: SentenceTokenizer 18 | priority: 1.1 19 | streams: 20 | inputs: questions 21 | outputs: tokenized_questions 22 | 23 | # Model 2: Embeddings 24 | question_embeddings: 25 | type: SentenceEmbeddings 26 | priority: 1.2 27 | embeddings_size: 50 28 | pretrained_embeddings_file: glove.6B.50d.txt 29 | data_folder: ~/data/vqa-med 30 | word_mappings_file: questions.all.word.mappings.csv 31 | streams: 32 | inputs: tokenized_questions 33 | outputs: embedded_questions 34 | 35 | # Model 2: RNN 36 | lstm: 37 | type: RecurrentNeuralNetwork 38 | cell_type: LSTM 39 | prediction_mode: Last 40 | priority: 1.3 41 | initial_state: Zero 42 | use_logsoftmax: False 43 | dropout_rate: 0.5 44 | streams: 45 | inputs: embedded_questions 46 | predictions: lstm_activations_questions 47 | globals: 48 | input_size: embeddings_size 49 | prediction_size: question_lstm_output_size 50 | 51 | # Model 52 | classifier: 53 | type: FeedForwardNetwork 54 | hidden: [50] 55 | priority: 1.4 56 | dropout_rate: 0.5 57 | streams: 58 | inputs: lstm_activations_questions 59 | globals: 60 | input_size: question_lstm_output_size # Set by global publisher 61 | prediction_size: num_categories # C1,C2,C3,C4, BINARY, UNK 62 | 63 | 64 | #: pipeline 65 | -------------------------------------------------------------------------------- /docs/source/img/1_tutorials/data_flow_tutorial_mnist_1_training.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/pytorchpipe/9cb17271666061cb19fe24197ecd5e4c8d32c5da/docs/source/img/1_tutorials/data_flow_tutorial_mnist_1_training.png -------------------------------------------------------------------------------- /docs/source/img/1_tutorials/data_flow_tutorial_mnist_2_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/pytorchpipe/9cb17271666061cb19fe24197ecd5e4c8d32c5da/docs/source/img/1_tutorials/data_flow_tutorial_mnist_2_test.png -------------------------------------------------------------------------------- /docs/source/img/components/ptp_components.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/pytorchpipe/9cb17271666061cb19fe24197ecd5e4c8d32c5da/docs/source/img/components/ptp_components.png -------------------------------------------------------------------------------- /docs/source/img/components/ptp_components_others.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/pytorchpipe/9cb17271666061cb19fe24197ecd5e4c8d32c5da/docs/source/img/components/ptp_components_others.png -------------------------------------------------------------------------------- /docs/source/img/components/ptp_models.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/pytorchpipe/9cb17271666061cb19fe24197ecd5e4c8d32c5da/docs/source/img/components/ptp_models.png -------------------------------------------------------------------------------- /docs/source/img/components/ptp_tasks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/pytorchpipe/9cb17271666061cb19fe24197ecd5e4c8d32c5da/docs/source/img/components/ptp_tasks.png -------------------------------------------------------------------------------- /docs/source/img/data_flow_vqa_5_attention_gpu_loaders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/pytorchpipe/9cb17271666061cb19fe24197ecd5e4c8d32c5da/docs/source/img/data_flow_vqa_5_attention_gpu_loaders.png -------------------------------------------------------------------------------- /ptp/__init__.py: -------------------------------------------------------------------------------- 1 | from .utils import * 2 | 3 | from .application import * 4 | 5 | # Components. 6 | from .components.component import Component 7 | 8 | from .components.language import * 9 | 10 | from .components.losses import * 11 | 12 | from .components.masking import * 13 | 14 | from .components.models import * 15 | 16 | from .components.tasks.task import Task 17 | from .components.tasks.image_text_to_class import * 18 | from .components.tasks.image_to_class import * 19 | from .components.tasks.text_to_class import * 20 | from .components.tasks.text_to_text import * 21 | 22 | from .components.publishers import * 23 | 24 | from .components.transforms import * 25 | 26 | from .components.statistics import * 27 | 28 | from .components.viewers import * 29 | 30 | # Rest. 31 | from .configuration import * 32 | from .data_types import * 33 | 34 | # Workers. 35 | from .workers import * 36 | 37 | -------------------------------------------------------------------------------- /ptp/application/__init__.py: -------------------------------------------------------------------------------- 1 | from .component_factory import ComponentFactory 2 | from .pipeline_manager import PipelineManager 3 | from .task_manager import TaskManager 4 | from .sampler_factory import SamplerFactory 5 | 6 | __all__ = [ 7 | 'ComponentFactory', 8 | 'PipelineManager', 9 | 'TaskManager', 10 | 'SamplerFactory', 11 | ] 12 | -------------------------------------------------------------------------------- /ptp/components/language/__init__.py: -------------------------------------------------------------------------------- 1 | from .bow_encoder import BOWEncoder 2 | from .label_indexer import LabelIndexer 3 | from .sentence_indexer import SentenceIndexer 4 | from .sentence_one_hot_encoder import SentenceOneHotEncoder 5 | from .sentence_tokenizer import SentenceTokenizer 6 | from .word_decoder import WordDecoder 7 | 8 | __all__ = [ 9 | 'BOWEncoder', 10 | 'LabelIndexer', 11 | 'SentenceIndexer', 12 | 'SentenceOneHotEncoder', 13 | 'SentenceTokenizer', 14 | 'WordDecoder' 15 | ] 16 | -------------------------------------------------------------------------------- /ptp/components/losses/__init__.py: -------------------------------------------------------------------------------- 1 | from .loss import Loss 2 | from .nll_loss import NLLLoss 3 | 4 | __all__ = [ 5 | 'NLLLoss', 6 | 'Loss', 7 | ] 8 | -------------------------------------------------------------------------------- /ptp/components/masking/__init__.py: -------------------------------------------------------------------------------- 1 | from .join_masked_predictions import JoinMaskedPredictions 2 | from .string_to_mask import StringToMask 3 | 4 | __all__ = [ 5 | 'JoinMaskedPredictions', 6 | 'StringToMask', 7 | ] 8 | -------------------------------------------------------------------------------- /ptp/components/models/__init__.py: -------------------------------------------------------------------------------- 1 | from .model import Model 2 | 3 | # General usage 4 | from .general_usage.feed_forward_network import FeedForwardNetwork 5 | from .general_usage.recurrent_neural_network import RecurrentNeuralNetwork 6 | from .general_usage.seq2seq import Seq2Seq 7 | from .general_usage.attention_decoder import AttentionDecoder 8 | 9 | # Language 10 | from .language.index_embeddings import IndexEmbeddings 11 | from .language.sentence_embeddings import SentenceEmbeddings 12 | 13 | # Vision 14 | from .vision.convnet_encoder import ConvNetEncoder 15 | from .vision.generic_image_encoder import GenericImageEncoder 16 | from .vision.lenet5 import LeNet5 17 | 18 | # Multi-modal reasoning 19 | from .multi_modal_reasoning.compact_bilinear_pooling import CompactBilinearPooling 20 | from .multi_modal_reasoning.factorized_bilinear_pooling import FactorizedBilinearPooling 21 | from .multi_modal_reasoning.low_rank_bilinear_pooling import LowRankBilinearPooling 22 | from .multi_modal_reasoning.question_driven_attention import QuestionDrivenAttention 23 | from .multi_modal_reasoning.relational_network import RelationalNetwork 24 | from .multi_modal_reasoning.self_attention import SelfAttention 25 | 26 | __all__ = [ 27 | 'Model', 28 | 29 | # General usage 30 | 'FeedForwardNetwork', 31 | 'RecurrentNeuralNetwork', 32 | 'Seq2Seq', 33 | 'AttentionDecoder', 34 | 35 | # Language 36 | 'IndexEmbeddings', 37 | 'SentenceEmbeddings', 38 | 39 | # Vision 40 | 'ConvNetEncoder', 41 | 'GenericImageEncoder', 42 | 'LeNet5', 43 | 44 | # Multi-modal reasoning 45 | 'CompactBilinearPooling', 46 | 'FactorizedBilinearPooling', 47 | 'LowRankBilinearPooling', 48 | 'QuestionDrivenAttention', 49 | 'RelationalNetwork', 50 | 'SelfAttention' 51 | ] 52 | -------------------------------------------------------------------------------- /ptp/components/publishers/__init__.py: -------------------------------------------------------------------------------- 1 | from .global_variable_publisher import GlobalVariablePublisher 2 | from .stream_file_exporter import StreamFileExporter 3 | 4 | __all__ = [ 5 | 'GlobalVariablePublisher', 6 | 'StreamFileExporter', 7 | ] 8 | -------------------------------------------------------------------------------- /ptp/components/statistics/__init__.py: -------------------------------------------------------------------------------- 1 | from .accuracy_statistics import AccuracyStatistics 2 | from .batch_size_statistics import BatchSizeStatistics 3 | from .bleu_statistics import BLEUStatistics 4 | from .precision_recall_statistics import PrecisionRecallStatistics 5 | 6 | __all__ = [ 7 | 'AccuracyStatistics', 8 | 'BatchSizeStatistics', 9 | 'BLEUStatistics', 10 | 'PrecisionRecallStatistics', 11 | ] 12 | -------------------------------------------------------------------------------- /ptp/components/tasks/image_text_to_class/__init__.py: -------------------------------------------------------------------------------- 1 | from .clevr import CLEVR 2 | from .gqa import GQA 3 | from .vqa_med_2019 import VQAMED2019 4 | 5 | __all__ = [ 6 | 'CLEVR', 7 | 'GQA', 8 | 'VQAMED2019', 9 | ] 10 | -------------------------------------------------------------------------------- /ptp/components/tasks/image_to_class/__init__.py: -------------------------------------------------------------------------------- 1 | #from .cifar10 import CIFAR10 2 | from .cifar_100 import CIFAR100 3 | from .mnist import MNIST 4 | from .simple_molecules import SimpleMolecules 5 | 6 | __all__ = [ 7 | 'CIFAR100', 8 | 'MNIST', 9 | 'SimpleMolecules', 10 | ] 11 | -------------------------------------------------------------------------------- /ptp/components/tasks/text_to_class/__init__.py: -------------------------------------------------------------------------------- 1 | from .dummy_language_identification import DummyLanguageIdentification 2 | from .language_identification import LanguageIdentification 3 | from .wily_language_identification import WiLYLanguageIdentification 4 | from .wily_ngram_language_modeling import WiLYNGramLanguageModeling 5 | 6 | __all__ = [ 7 | 'DummyLanguageIdentification', 8 | 'LanguageIdentification', 9 | 'WiLYLanguageIdentification', 10 | 'WiLYNGramLanguageModeling' 11 | ] 12 | -------------------------------------------------------------------------------- /ptp/components/tasks/text_to_text/__init__.py: -------------------------------------------------------------------------------- 1 | from .wikitext_language_modeling import WikiTextLanguageModeling 2 | from .translation_pairs import TranslationPairs 3 | 4 | __all__ = [ 5 | 'WikiTextLanguageModeling', 6 | 'TranslationPairs' 7 | ] 8 | -------------------------------------------------------------------------------- /ptp/components/transforms/__init__.py: -------------------------------------------------------------------------------- 1 | from .concatenate_tensor import ConcatenateTensor 2 | from .list_to_tensor import ListToTensor 3 | from .reduce_tensor import ReduceTensor 4 | from .reshape_tensor import ReshapeTensor 5 | 6 | 7 | __all__ = [ 8 | 'ConcatenateTensor', 9 | 'ListToTensor', 10 | 'ReduceTensor', 11 | 'ReshapeTensor', 12 | ] 13 | -------------------------------------------------------------------------------- /ptp/components/viewers/__init__.py: -------------------------------------------------------------------------------- 1 | from .image_viewer import ImageViewer 2 | from .stream_viewer import StreamViewer 3 | 4 | __all__ = [ 5 | 'ImageViewer', 6 | 'StreamViewer', 7 | ] 8 | -------------------------------------------------------------------------------- /ptp/configuration/__init__.py: -------------------------------------------------------------------------------- 1 | from .config_interface import ConfigInterface 2 | from .config_registry import ConfigRegistry 3 | from .configuration_error import ConfigurationError 4 | #from configs_parsing import load_default_configuration_file 5 | 6 | __all__ = [ 7 | 'ConfigInterface', 8 | 'ConfigRegistry', 9 | 'ConfigurationError', 10 | ] 11 | -------------------------------------------------------------------------------- /ptp/configuration/configuration_error.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) IBM tkornuta, Corporation 2019 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | __author__ = "Tomasz Kornuta" 18 | 19 | 20 | class ConfigurationError(Exception): 21 | """ Error thrown when encountered a configuration issue. """ 22 | def __init__(self, msg): 23 | """ Stores message """ 24 | self.msg = msg 25 | 26 | def __str__(self): 27 | """ Prints the message """ 28 | return repr(self.msg) 29 | 30 | -------------------------------------------------------------------------------- /ptp/data_types/__init__.py: -------------------------------------------------------------------------------- 1 | from .data_streams import DataStreams 2 | from .data_definition import DataDefinition 3 | 4 | __all__ = [ 5 | 'DataStreams', 6 | 'DataDefinition', 7 | ] 8 | -------------------------------------------------------------------------------- /ptp/data_types/data_definition.py: -------------------------------------------------------------------------------- 1 | 2 | #!/usr/bin/env python3 3 | # -*- coding: utf-8 -*- 4 | # 5 | # Copyright (C) IBM Corporation 2019 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | __author__ = "Tomasz Kornuta" 20 | 21 | from collections import namedtuple 22 | 23 | 24 | class DataDefinition(namedtuple("DataDefinition", 'dimensions types description')): 25 | __slots__ = () 26 | -------------------------------------------------------------------------------- /ptp/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from .app_state import AppState 2 | from .data_streams_parallel import DataStreamsParallel 3 | from .globals_facade import GlobalsFacade 4 | from .key_mappings_facade import KeyMappingsFacade 5 | from .samplers import kFoldRandomSampler 6 | from .samplers import kFoldWeightedRandomSampler 7 | from .singleton import SingletonMetaClass 8 | from .statistics_aggregator import StatisticsAggregator 9 | from .statistics_collector import StatisticsCollector 10 | from .termination_condition import TerminationCondition 11 | 12 | 13 | __all__ = [ 14 | 'AppState', 15 | 'DataStreamsParallel', 16 | 'GlobalsFacade', 17 | 'KeyMappingsFacade', 18 | 'kFoldRandomSampler', 19 | 'kFoldWeightedRandomSampler', 20 | 'SingletonMetaClass', 21 | 'StatisticsAggregator', 22 | 'StatisticsCollector', 23 | 'TerminationCondition', 24 | ] 25 | -------------------------------------------------------------------------------- /ptp/utils/globals_facade.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) IBM Corporation 2019 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | __author__ = "Tomasz Kornuta" 18 | 19 | from ptp.utils.app_state import AppState 20 | 21 | class GlobalsFacade(object): 22 | """ 23 | Simple facility for accessing global variables using provided mappings using list-like read-write access. 24 | """ 25 | def __init__(self, key_mappings): 26 | """ 27 | Constructor. Initializes app state and stores key mappings. 28 | 29 | :param key_mappings: Dictionary of global key mappings of the parent object. 30 | """ 31 | # Remember parent object global keys mappings. 32 | self.key_mappings = key_mappings 33 | self.app_state = AppState() 34 | 35 | def __setitem__(self, key, value): 36 | """ 37 | Sets global value using parent object key mapping. 38 | 39 | :param key: Global key name (that will be mapped). 40 | 41 | :param value: Value that will be set. 42 | """ 43 | # Retrieve key using parent object global key mappings. 44 | mapped_key = self.key_mappings.get(key, key) 45 | # Set global balue. 46 | self.app_state[mapped_key] = value 47 | 48 | 49 | def __getitem__(self, key): 50 | """ 51 | Global value getter function. 52 | Uses parent object key mapping for accesing the value. 53 | 54 | :param key: Global key name (that will be mapped). 55 | 56 | :return: Associated Value. 57 | """ 58 | # Retrieve key using parent object global key mappings. 59 | mapped_key = self.key_mappings.get(key, key) 60 | # Retrieve the value. 61 | return self.app_state[mapped_key] -------------------------------------------------------------------------------- /ptp/utils/key_mappings_facade.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) IBM Corporation 2019 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | __author__ = "Tomasz Kornuta" 18 | 19 | class KeyMappingsFacade(object): 20 | """ 21 | Simple facility for accessing key names using provided mappings using list-like (read-only) access. 22 | """ 23 | def __init__(self, key_mappings): 24 | """ 25 | Constructor. Stores key mappings. 26 | 27 | :param key_mappings: Dictionary of key mappings of the parent object. 28 | """ 29 | # Remember parent object global keys. 30 | self.keys_mappings = key_mappings 31 | 32 | def __getitem__(self, key): 33 | """ 34 | Global value getter function. 35 | Uses parent object key mapping for accesing the value. 36 | 37 | :param key: Global key name (that will be mapped). 38 | 39 | :return: Associated Value. 40 | """ 41 | # Retrieve key using parent object global key mappings. 42 | return self.keys_mappings.get(key, key) 43 | -------------------------------------------------------------------------------- /ptp/utils/singleton.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright (C) IBM Corporation 2019 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | __author__ = "Alexis Asseman" 19 | 20 | class SingletonMetaClass(type): 21 | _instances = {} 22 | 23 | def __call__(cls, *args, **kwargs): 24 | if cls not in cls._instances: 25 | cls._instances[cls] = super( 26 | SingletonMetaClass, cls).__call__(*args, **kwargs) 27 | return cls._instances[cls] 28 | -------------------------------------------------------------------------------- /ptp/utils/termination_condition.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) IBM tkornuta, Corporation 2019 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | __author__ = "Tomasz Kornuta" 18 | 19 | 20 | class TerminationCondition(Exception): 21 | """ Exception thrown when worker is supposed to terminate its operation. """ 22 | def __init__(self, msg): 23 | """ Stores message """ 24 | self.msg = msg 25 | 26 | def __str__(self): 27 | """ Prints the message """ 28 | return repr(self.msg) 29 | 30 | -------------------------------------------------------------------------------- /ptp/workers/__init__.py: -------------------------------------------------------------------------------- 1 | from .worker import Worker 2 | from .trainer import Trainer 3 | #from .offline_trainer import OfflineTrainer 4 | from .online_trainer import OnlineTrainer 5 | from .processor import Processor 6 | 7 | __all__ = [ 8 | 'Worker', 9 | 'Trainer', 10 | #'OfflineTrainer', 11 | 'OnlineTrainer', 12 | 'Processor' 13 | ] 14 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | from .application.pipeline_tests import TestPipeline 2 | from .application.sampler_factory_tests import TestSamplerFactory 3 | from .application.samplers_tests import TestkFoldRandomSampler, TestkFoldWeightedRandomSampler 4 | 5 | from .components.component_tests import TestComponent 6 | from .components.tasks.clevr_tests import TestCLEVR 7 | from .components.tasks.gqa_tests import TestGQA 8 | from .components.tasks.task_tests import TestTask 9 | 10 | from .configuration.config_interface_tests import TestConfigInterface 11 | from .configuration.config_registry_tests import TestConfigRegistry 12 | from .configuration.handshaking_tests import TestHandshaking 13 | 14 | from .data_types.data_streams_tests import TestDataStreams 15 | from .data_types.data_definition_tests import TestDataDefinition 16 | 17 | from .utils.app_state_tests import TestAppState 18 | from .utils.statistics_tests import TestStatistics 19 | 20 | __all__ = [ 21 | # Application 22 | 'TestPipeline', 23 | 'TestSamplerFactory', 24 | 'TestkFoldRandomSampler', 25 | 'TestkFoldWeightedRandomSampler', 26 | # Components 27 | 'TestComponent', 28 | 'TestGQA', 29 | 'TestTask', 30 | # Configuration 31 | 'TestConfigRegistry', 32 | 'TestConfigInterface', 33 | 'TestHandshaking', 34 | # DataTypes 35 | 'TestDataStreams', 36 | 'TestDataDefinition', 37 | # Utils 38 | 'TestAppState', 39 | 'TestStatistics', 40 | ] 41 | -------------------------------------------------------------------------------- /tests/components/tasks/task_tests.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) tkornuta, IBM Corporation 2019 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | __author__ = "Tomasz Kornuta" 18 | 19 | import unittest 20 | 21 | from ptp.components.tasks.task import Task 22 | from ptp.data_types.data_definition import DataDefinition 23 | from ptp.configuration.config_interface import ConfigInterface 24 | 25 | 26 | class MockupTask (Task): 27 | """ 28 | Mockup task class. 29 | """ 30 | def __init__(self, name, config): 31 | Task.__init__(self, name, None, config) 32 | 33 | def output_data_definitions(self): 34 | return { 35 | "inputs": DataDefinition([-1, 1], [list, int], "inputs"), 36 | "targets": DataDefinition([-1, -1, -1], [list, list, str], "targets") 37 | } 38 | 39 | 40 | class TestTask(unittest.TestCase): 41 | 42 | def __init__(self, *args, **kwargs): 43 | super(TestTask, self).__init__(*args, **kwargs) 44 | 45 | # Overwrite abc abstract methods. 46 | MockupTask.__abstractmethods__=set() 47 | # Create mocked-up task. 48 | config = ConfigInterface() 49 | self.task = MockupTask("test", config) 50 | 51 | def test_crete_data_streams_key_present(self): 52 | """ Tests whether the created data dict contains required keys. """ 53 | data_streams = self.task.create_data_streams(1) 54 | # Check presence of index. 55 | self.assertEqual(data_streams['indices'], 1) # Even if we didn't explicitly indicated that in definitions! 56 | self.assertEqual(data_streams['inputs'], None) 57 | self.assertEqual(data_streams['targets'], None) 58 | 59 | #if __name__ == "__main__": 60 | # unittest.main() -------------------------------------------------------------------------------- /tests/configuration/config_interface_tests.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) tkornuta, IBM Corporation 2019 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | __author__ = "Tomasz Kornuta" 18 | 19 | import unittest 20 | 21 | from ptp.configuration.config_interface import ConfigInterface 22 | 23 | class TestConfigInterface(unittest.TestCase): 24 | 25 | def test_default_params(self): 26 | config = ConfigInterface() 27 | # Add params - first method. 28 | config.add_default_params({'default_0': {'default_1': 'str'}}) 29 | self.assertNotEqual(config['default_0'], None) 30 | self.assertEqual(config['default_0']['default_1'], 'str') 31 | 32 | # Remove params - first method. 33 | config.del_default_params(['default_0', 'default_1']) 34 | with self.assertRaises(KeyError): 35 | _ = config['default_0']['default_1'] 36 | 37 | # Add params - second method. 38 | config['default_0'].add_default_params({'default_2': 'str'}) 39 | 40 | # Remove params - second method. 41 | config['default_0'].del_default_params('default_2') 42 | with self.assertRaises(KeyError): 43 | _ = config['default_0']['default_2'] 44 | 45 | # Add 3rd parameter under 0. 46 | config['default_0'].add_default_params({'default_3': 'str'}) 47 | 48 | # Remove the main section. 49 | config.del_default_params('default_0') 50 | with self.assertRaises(KeyError): 51 | _ = config['default_0'] 52 | 53 | 54 | def test_config_params(self): 55 | config = ConfigInterface() 56 | # Add params. 57 | config.add_config_params({'config_0': {'config_1': 'int'}}) 58 | self.assertNotEqual(config['config_0'], None) 59 | self.assertEqual(config['config_0']['config_1'], 'int') 60 | 61 | # Remove params. 62 | config.del_config_params(['config_0', 'config_1']) 63 | with self.assertRaises(KeyError): 64 | _ = config['config_0']['config_1'] 65 | 66 | def test_overwrite_params(self): 67 | config = ConfigInterface() 68 | config.add_config_params({'under': True}) 69 | config.add_default_params({'under': False}) 70 | self.assertEqual(config['under'], True) 71 | 72 | #if __name__ == "__main__": 73 | # unittest.main() -------------------------------------------------------------------------------- /tests/configuration/config_registry_tests.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) tkornuta, IBM Corporation 2019 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | __author__ = "Tomasz Kornuta" 18 | 19 | import unittest 20 | 21 | from ptp.configuration.config_registry import ConfigRegistry 22 | 23 | class TestConfigRegistry(unittest.TestCase): 24 | 25 | def test_default_params(self): 26 | config = ConfigRegistry() 27 | # Add params. 28 | config.add_default_params({'default_0': {'default_1': 'str'}}) 29 | self.assertNotEqual(config['default_0'], None) 30 | self.assertEqual(config['default_0']['default_1'], 'str') 31 | 32 | # Remove params. 33 | config.del_default_params(['default_0', 'default_1']) 34 | with self.assertRaises(KeyError): 35 | _ = config['default_0']['default_1'] 36 | 37 | 38 | def test_config_params(self): 39 | config = ConfigRegistry() 40 | # Add params. 41 | config.add_config_params({'config_0': {'config_1': 'int'}}) 42 | self.assertNotEqual(config['config_0'], None) 43 | self.assertEqual(config['config_0']['config_1'], 'int') 44 | 45 | # Remove params. 46 | config.del_config_params(['config_0', 'config_1']) 47 | with self.assertRaises(KeyError): 48 | _ = config['config_0']['config_1'] 49 | 50 | 51 | def test_overwrite_params(self): 52 | config = ConfigRegistry() 53 | config.add_config_params({'under': True}) 54 | config.add_default_params({'under': False}) 55 | self.assertEqual(config['under'], True) 56 | 57 | 58 | #if __name__ == "__main__": 59 | # unittest.main() -------------------------------------------------------------------------------- /tests/data_types/data_definition_tests.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) tkornuta, IBM Corporation 2019 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | __author__ = "Tomasz Kornuta" 18 | 19 | import unittest 20 | 21 | from ptp.data_types.data_definition import DataDefinition 22 | 23 | class TestDataDefinition(unittest.TestCase): 24 | 25 | def test_values(self): 26 | """ Tests whether the values are set. """ 27 | dd = DataDefinition([1], [int], "Value") 28 | 29 | self.assertEqual(dd.dimensions, [1]) 30 | self.assertEqual(dd.types,[int]) 31 | self.assertEqual(dd.description, "Value") 32 | 33 | 34 | def test_override(self): 35 | """ Tests whether values cannot be overriden. """ 36 | dd = DataDefinition([1], [int], "Value") 37 | 38 | with self.assertRaises(AttributeError): 39 | dd.dimensions = [1,2] 40 | with self.assertRaises(AttributeError): 41 | dd.types = [str,list] 42 | with self.assertRaises(AttributeError): 43 | dd.description = "New Description" 44 | 45 | -------------------------------------------------------------------------------- /tests/data_types/data_streams_tests.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) tkornuta, IBM Corporation 2019 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | __author__ = "Tomasz Kornuta" 18 | 19 | import unittest 20 | 21 | from ptp.data_types.data_streams import DataStreams 22 | 23 | class TestDataStreams(unittest.TestCase): 24 | 25 | def __init__(self, *args, **kwargs): 26 | super(TestDataStreams, self).__init__(*args, **kwargs) 27 | 28 | data_definitions = { 29 | 'inputs': None, 30 | 'targets': None 31 | } 32 | # Create object. 33 | self.data_streams = DataStreams(data_definitions) 34 | 35 | def test_keys_present(self): 36 | """ Tests whether the original keys are present and can be retrieved/modified. """ 37 | self.assertTrue('inputs' in self.data_streams.keys() ) 38 | self.assertTrue('targets' in self.data_streams.keys() ) 39 | 40 | # Check initial value. 41 | self.assertEqual(self.data_streams['inputs'], None) 42 | # Modify and retrieve. 43 | self.data_streams['inputs'] = 1.2 44 | self.assertEqual(self.data_streams['inputs'], 1.2) 45 | 46 | 47 | def test_keys_absent(self): 48 | """ Tests whether absent keys are really absent and cannot be simply added. """ 49 | with self.assertRaises(KeyError): 50 | a = self.data_streams["predictions"] 51 | with self.assertRaises(KeyError): 52 | self.data_streams["predictions"] = 12 53 | 54 | 55 | def test_keys_extend(self): 56 | """ Tests whether append works as expected. """ 57 | # Cannot add existing key. 58 | with self.assertRaises(KeyError): 59 | self.data_streams.publish( {"inputs": 1.5 } ) 60 | # Can add new key. 61 | self.data_streams.publish( {"predictions": 12 } ) 62 | self.assertEqual(self.data_streams['predictions'], 12) 63 | 64 | -------------------------------------------------------------------------------- /tests/utils/app_state_tests.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) tkornuta, IBM Corporation 2019 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | __author__ = "Tomasz Kornuta" 18 | 19 | import unittest 20 | from ptp.utils.app_state import AppState 21 | 22 | class TestAppState(unittest.TestCase): 23 | 24 | 25 | def test_01keys_present(self): 26 | """ Tests whether the original keys are present and can be retrieved/modified. """ 27 | # Initialize object. 28 | app_state = AppState() 29 | # Add global. 30 | app_state["global1"] = 1 31 | # Check its value. 32 | self.assertEqual(app_state['global1'], 1) 33 | 34 | def test_02keys_present_singleton(self): 35 | """ Tests whether the original keys are still present in new AppState "instance". """ 36 | # Initialize object. 37 | app_state = AppState() 38 | # Check its value. 39 | self.assertEqual(app_state['global1'], 1) 40 | 41 | def test_03keys_absent(self): 42 | """ Tests whether absent keys are really absent. """ 43 | with self.assertRaises(KeyError): 44 | a = AppState()["global2"] 45 | 46 | def test_04keys_overwrite(self): 47 | """ Tests whether you can overwrite existing key. """ 48 | with self.assertRaises(KeyError): 49 | AppState()["global1"] = 2 50 | --------------------------------------------------------------------------------