hotfix to change factory creation for dictionaries (#1987)
hotfix to change factory creation for dictionaries (#1987)

Summary:
## What does this PR do?
Fixes issue of creating factories causing errors because the lambda function is not proper.

## PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

## Did you have fun?
Make sure you had fun coding �

Pull Request resolved: https://github.com/fairinternal/fairseq-py/pull/1987

Test Plan:
Completed a small pretraining+finetuning procedure:

Pretraining:
```
PYTHONPATH=. python /private/home/neeyanth/project/fairseq/fairseq_cli/hydra_train.py -m \
	--config-dir ${fairseq_dir}/examples/hubert/config/pretrain \
	--config-name hubert_base_librispeech \
	hydra/launcher=submitit_local \
	hydra.launcher.gpus_per_node=1 \
	hydra.launcher.cpus_per_task=8 \
	hydra.launcher.mem_gb=384 \
	task.data=${tsv_dir} \
	task.label_dir=${km_dir} \
	task.labels=["km"] \
	+data=iter1 \
	optimization.max_update=250 \
	hydra.sweep.dir=${exp_dir} \
	hydra.run.dir=${exp_dir} > ${exp_dir}/log.out 2> ${exp_dir}/log.err &
```

Finetuning:
```
PYTHONPATH=. python /private/home/neeyanth/project/fairseq/fairseq_cli/hydra_train.py -m \
	--config-dir ${fairseq_dir}/examples/hubert/config/finetune \
	--config-name base_10h \
	hydra/launcher=submitit_local \
	hydra.launcher.gpus_per_node=1 \
	hydra.launcher.cpus_per_task=8 \
	hydra.launcher.mem_gb=384 \
	task.data=${tsv_dir} \
	task.label_dir=${tsv_dir} \
	model.w2v_path=${model_dir} \
	+data=iter1 \
	optimization.max_update=250 \
	hydra.sweep.dir=${exp_dir} \
	hydra.run.dir=${exp_dir} > ${exp_dir}/log.out 2> ${exp_dir}/log.err &
```

Reviewed By: hikushalhere

Differential Revision: D29266136

Pulled By: neeyanthkvk

fbshipit-source-id: d36c668ae38a7761b4c44f4dcb0c4cc8e15e42ce

pytorch/fairseq,pytorch/fairseq,pytorch/fairseq