Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix contrastive loss with temperature test (#509)
Summary: For some reason when we run pytest on a subdirectory of tests/ PyTorch is unable to find GPUs if they are present. But when we run just `pytest tests/` PyTorch does see the GPU. This means that in the latter case the contrastive_loss_with_temperature test fails due to tensors on different devices (previously only model params were moved to the current device but the embeddings were not). But random initialization on GPU is different than on CPU so the test will give different results across different types of hardware. Since the contrastive loss distributed tests are intended to only run on GPU, we leave those as is. But for the remaining test cases we explicitly move everything to CPU so we can ensure consistent results. Pull Request resolved: #509 Reviewed By: kartikayk Differential Revision: D50975554 Pulled By: ebsmothers fbshipit-source-id: 71cab826f6fa6643f409643939e4a2fda24efaab
- Loading branch information