make scripts compatible with pytorch 0.4.0
make scripts compatible with pytorch 0.4.0

facebookresearch/ParlAI,facebookresearch/ParlAI,facebookresearch/ParlAI,facebookresearch/ParlAI,facebookresearch/ParlAI