Thank you @sgugger . I did as you instructed and it worked. So just to recap (in case other people find it helpful), to train the RNNLearner.language_model with FastAI with multiple GPUs we do the following:
- Once we have our
learnobject, parallelize the model by executinglearn.model = torch.nn.DataParallel(learn.model) - Train as instructed in the docs
- Save the parallelized model
learn.save('name') - As instructed by @sgugger here, load the saved model, and strip out the word
modulefrom the keys of the dictionary and create and newstate_dict - Load the newly created
state_dictinto the model, which will now be unparallized - Save both the model and encoder by executing
learn.save('name-unpr')andlearn.save_encoder('name').